card 1.99.1 → 1.99.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/initializers/01_core_extensions/array.rb +1 -0
- data/config/initializers/01_core_extensions/persistent_identifiers.rb +1 -1
- data/config/initializers/02_patches/zeitwerk.rb +13 -0
- data/config/initializers/patches.rb +7 -0
- data/config/initializers/recaptcha.rb +1 -2
- data/config/initializers/zeitwerk.rb +5 -0
- data/config/locales/de.yml +1 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/es.yml +1 -1
- data/db/migrate/20110511221913_require_earlier_migrations.rb +0 -3
- data/db/migrate/20141001105348_move_revisions_to_actions.rb +1 -1
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +5 -5
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +1 -1
- data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +1 -1
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +2 -2
- data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +4 -4
- data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +1 -1
- data/db/migrate_core_cards/20190204195039_add_rule_card.rb +1 -1
- data/db/migrate_core_cards/20191008201046_fixture_fix.rb +3 -1
- data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +8 -0
- data/db/migrate_core_cards/20191115160748_history_cleanup.rb +27 -0
- data/db/migrate_core_cards/20191118145629_codename_fixes.rb +6 -0
- data/db/seed/new/card_actions.yml +874 -874
- data/db/seed/new/card_acts.yml +2 -2
- data/db/seed/new/card_references.yml +2 -2
- data/db/seed/new/cards.yml +1576 -1576
- data/db/seed/new/schema_migrations_core_cards.yml +8 -0
- data/db/seed/test/fixtures/card_actions.yml +1815 -1815
- data/db/seed/test/fixtures/card_acts.yml +499 -499
- data/db/seed/test/fixtures/card_changes.yml +66 -66
- data/db/seed/test/fixtures/card_references.yml +634 -634
- data/db/seed/test/fixtures/cards.yml +2730 -2730
- data/db/seed/test/fixtures/schema_migrations_core_cards.yml +8 -0
- data/db/test_seed.rb +10 -11
- data/lib/card.rb +9 -30
- data/lib/card/act_manager.rb +0 -2
- data/lib/card/auth.rb +0 -5
- data/lib/card/auth/current.rb +32 -59
- data/lib/card/auth/setup.rb +1 -1
- data/lib/card/codename.rb +5 -6
- data/lib/card/content.rb +5 -8
- data/lib/card/content/chunk.rb +0 -78
- data/lib/card/content/chunk/abstract.rb +88 -0
- data/lib/card/content/clean.rb +3 -3
- data/lib/card/content/diff/{lcs.rb → l_c_s.rb} +5 -7
- data/lib/card/content/diff/{processor.rb → l_c_s/processor.rb} +0 -0
- data/lib/card/content/parser.rb +1 -1
- data/lib/card/dirty.rb +25 -31
- data/lib/card/dirty/method_factory.rb +15 -0
- data/lib/card/env.rb +0 -3
- data/lib/card/error.rb +6 -2
- data/lib/card/format.rb +5 -5
- data/lib/card/format/nest/fetch.rb +2 -1
- data/lib/card/mark.rb +1 -0
- data/lib/card/migration.rb +4 -0
- data/lib/card/mod.rb +2 -5
- data/lib/card/mod/dirs.rb +1 -0
- data/lib/card/mod/load_strategy.rb +23 -12
- data/lib/card/mod/loader.rb +13 -13
- data/lib/card/mod/loader/set_loader.rb +7 -1
- data/lib/card/mod/loader/set_pattern_loader.rb +2 -2
- data/lib/card/mod/module_template.rb +1 -5
- data/lib/card/mod_inflector.rb +16 -0
- data/lib/card/model/save_helper.rb +2 -2
- data/lib/card/name.rb +2 -2
- data/lib/card/name/name_variants.rb +19 -0
- data/lib/card/query.rb +4 -2
- data/lib/card/query/card_query/reference_attributes.rb +2 -2
- data/lib/card/query/sql_statement.rb +4 -0
- data/lib/card/set.rb +18 -3
- data/lib/card/set/abstract.rb +6 -0
- data/lib/card/set/event.rb +13 -11
- data/lib/card/set/event/delayed_event.rb +2 -0
- data/lib/card/set/format.rb +3 -3
- data/lib/card/set/helpers.rb +20 -8
- data/lib/card/set/loader.rb +1 -1
- data/lib/card/set/pattern.rb +47 -0
- data/lib/card/{set_pattern.rb → set/pattern/base.rb} +11 -92
- data/lib/card/set/required_field.rb +64 -30
- data/lib/card/set/trait.rb +3 -2
- data/lib/card/set/type.rb +46 -0
- data/lib/card/subcards.rb +0 -4
- data/lib/card/tasks/card.rake +1 -0
- data/lib/card/tasks/card/migrate.rake +1 -1
- data/lib/card/view.rb +2 -7
- data/lib/card/view/cache.rb +3 -0
- data/lib/card/view/cache/stub.rb +5 -0
- data/lib/cardio.rb +73 -46
- data/mod/account/set/abstract/accountable.rb +49 -0
- data/mod/account/set/all/account.rb +3 -3
- data/mod/account/set/right/account.rb +1 -1
- data/mod/account/set/self/signin.rb +2 -2
- data/mod/account/set/type/role.rb +1 -1
- data/mod/account/set/type/signup.rb +2 -2
- data/mod/account/set/type/signup/views.rb +1 -1
- data/mod/account/set/type/user.rb +1 -1
- data/mod/account/spec/set/abstract/accountable_spec.rb +7 -0
- data/mod/account/spec/set/all/account_spec.rb +3 -3
- data/mod/account/spec/set/right/account_spec.rb +1 -1
- data/mod/account/spec/set/type/signup_spec.rb +4 -4
- data/mod/admin/set/self/admin.rb +1 -1
- data/mod/admin/set/self/admin_info.rb +2 -2
- data/mod/admin/set/self/version.rb +1 -1
- data/mod/basic_types/set/type/json.rb +4 -0
- data/mod/basic_types/spec/set/type/html_spec.rb +1 -1
- data/mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +2 -2
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +1 -1
- data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +1 -0
- data/mod/bootstrap/set/abstract/bootswatch_theme.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/tabs.rb +4 -4
- data/mod/bootstrap/set/type/customized_bootswatch_skin.rb +5 -4
- data/mod/carrierwave/config/core_initializers/carrierwave.rb +1 -3
- data/mod/carrierwave/lib/carrier_wave/{cardmount.rb → card_mount.rb} +2 -2
- data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +27 -12
- data/mod/carrierwave/set/abstract/attachment.rb +0 -2
- data/mod/carrierwave/set/all/file_utils.rb +5 -1
- data/mod/carrierwave/set/self/admin.rb +1 -1
- data/mod/core/chunk/link.rb +99 -91
- data/mod/core/chunk/nest.rb +2 -2
- data/mod/core/chunk/query_reference.rb +79 -74
- data/mod/core/chunk/view_stub.rb +10 -1
- data/mod/core/format/html_format.rb +1 -1
- data/mod/core/set/abstract/code_file.rb +6 -6
- data/mod/core/set/all/content.rb +1 -1
- data/mod/core/set/all/event_conditions.rb +1 -2
- data/mod/core/set/all/fetch.rb +22 -19
- data/mod/core/set/all/fetch_helper.rb +7 -5
- data/mod/core/set/all/initialize.rb +35 -9
- data/mod/core/set/all/item.rb +16 -6
- data/mod/core/set/all/name.rb +19 -15
- data/mod/core/set/all/pattern.rb +4 -0
- data/mod/core/set/all/permissions.rb +13 -11
- data/mod/core/set/all/rename.rb +1 -0
- data/mod/core/set/all/rules.rb +4 -4
- data/mod/core/set/all/subcards.rb +36 -1
- data/mod/core/set/all/type.rb +1 -1
- data/mod/core/set_pattern/03_type.rb +2 -0
- data/mod/core/spec/chunk/nest_spec.rb +7 -2
- data/mod/core/spec/set/all/fetch_spec.rb +1 -1
- data/mod/core/spec/set/all/permissions_spec.rb +11 -12
- data/mod/core/spec/set/all/rules_spec.rb +3 -3
- data/mod/edit/set/all/bridge.rb +1 -3
- data/mod/edit/set/all/bridge/tab_views.rb +0 -7
- data/mod/edit/set/all/bridge/tab_visibility.rb +5 -7
- data/mod/edit/set/all/form_buttons.rb +1 -1
- data/mod/edit/set/all/form_elements.rb +1 -0
- data/mod/edit/set/all/new.rb +2 -2
- data/mod/edit/spec/set/all/bridge/tab_views_spec.rb +1 -1
- data/mod/edit/spec/set/all/{nest_editor → reference_editor/nest_editor}/nest_parser_spec.rb +1 -1
- data/mod/edit/spec/set/all/{nest_editor_spec.rb → reference_editor/nest_editor_spec.rb} +6 -3
- data/mod/edit/spec/set/all/{nest_image_spec.rb → reference_editor/nest_image_spec.rb} +1 -1
- data/mod/email/set/abstract/test_context.rb +1 -1
- data/mod/email/set/type/email_template/email_config.rb +1 -1
- data/mod/follow/set/all/notify.rb +1 -1
- data/mod/follow/set/all/notify/base_views.rb +1 -1
- data/mod/follow/set/right/account.rb +8 -6
- data/mod/follow/set/right/followers.rb +2 -5
- data/mod/follow/set/right/following.rb +1 -1
- data/mod/follow/spec/set/all/follow_spec.rb +3 -3
- data/mod/follow/spec/set/all/notify_spec.rb +1 -1
- data/mod/follow/spec/set/right/followers_spec.rb +2 -2
- data/mod/history/lib/card/act.rb +3 -1
- data/mod/history/lib/card/action.rb +3 -3
- data/mod/history/lib/card/action/admin.rb +0 -11
- data/mod/history/set/all/history_bridge.rb +1 -1
- data/mod/machines/file/all_script_machine_output/file.js +38415 -69
- data/mod/machines/file/all_style_machine_output/file.css +2 -2
- data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
- data/mod/machines/lib/javascript/decko/filter.js.coffee +7 -1
- data/mod/machines/lib/javascript/decko/filter_links.js.coffee +13 -2
- data/mod/machines/lib/javascript/decko/link_editor.js.coffee +64 -0
- data/mod/machines/lib/javascript/decko/mod.js.coffee +3 -0
- data/mod/machines/lib/javascript/decko/nest_editor.js.coffee +49 -29
- data/mod/machines/lib/javascript/decko/nest_editor_name.js.coffee +30 -7
- data/mod/machines/lib/javascript/decko/slot.js.coffee +4 -1
- data/mod/machines/lib/stylesheets/style_cards.scss +31 -19
- data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
- data/mod/machines/set/abstract/machine/output_update.rb +1 -1
- data/mod/machines/set/all/reset_machines.rb +2 -2
- data/mod/machines/set/self/script_decko.rb +1 -0
- data/mod/media/set/abstract/media.rb +1 -1
- data/mod/media/set/type/image.rb +1 -1
- data/mod/navbar/set/abstract/account_dropdown.rb +5 -1
- data/mod/navbar/set/right/enabled_roles.rb +1 -1
- data/mod/navbar/set/self/account_links.rb +1 -1
- data/mod/pointer/set/abstract/02_pointer.rb +1 -1
- data/mod/pointer/set/abstract/02_pointer/events.rb +30 -10
- data/mod/pointer/set/abstract/02_pointer/html_views.rb +6 -2
- data/mod/pointer/set/abstract/02_pointer/html_views/autocomplete_input.haml +1 -1
- data/mod/pointer/set/abstract/02_pointer/html_views/filter.rb +1 -1
- data/mod/pointer/set/abstract/02_pointer/item_api.rb +51 -31
- data/mod/pointer/set/abstract/id_pointer.rb +21 -0
- data/mod/pointer/set/type/link_list.rb +1 -1
- data/mod/pointer/set/type/mirror_list.rb +1 -1
- data/mod/pointer/set/type/mirrored_list.rb +2 -2
- data/mod/pointer/spec/set/abstract/paging_params_spec.rb +1 -1
- data/mod/pointer/spec/set/abstract/pointer/item_api_spec.rb +1 -1
- data/mod/recaptcha/set/all/recaptcha.rb +4 -9
- data/mod/rules/set/rule/editor.rb +2 -2
- data/mod/rules/set/type/set/html_views/rule_lists.rb +1 -1
- data/mod/rules/spec/set/type/set_spec.rb +1 -1
- data/mod/search/set/abstract/03_filter/filter_form.haml +1 -1
- data/mod/search/set/abstract/03_filter/filter_form.rb +23 -2
- data/mod/search/set/abstract/03_filter/quick_filters.haml +7 -10
- data/mod/search/template/abstract/search/checkbox_item.haml +5 -6
- data/mod/settings/set/abstract/permission.rb +2 -2
- data/mod/settings/set/right/input_type.rb +3 -3
- data/mod/settings/set/right/structure.rb +1 -1
- data/mod/settings/set/right/style.rb +1 -1
- data/mod/settings/set/type/setting.rb +2 -2
- data/mod/standard/set/all/rich_html/html_views/guide.rb +1 -1
- data/mod/standard/set/all/rich_html/menu.rb +6 -5
- data/mod/standard/set/self/cardtype.rb +1 -1
- data/mod/standard/set/type/cardtype.rb +33 -17
- data/mod/standard/set/type/session.rb +12 -0
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +1 -2
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -3
- data/mod/tinymce_editor/lib/javascript/script_tinymce_config.js.coffee +3 -2
- data/mod/tinymce_editor/public/assets/tinymce/plugins/nest/plugin.min.js +1 -1
- data/mod/tinymce_editor/set/all/reference_editor.rb +23 -0
- data/mod/tinymce_editor/set/all/reference_editor/_link_editor.haml +18 -0
- data/mod/tinymce_editor/set/all/reference_editor/_nest_editor.haml +17 -0
- data/mod/tinymce_editor/set/all/reference_editor/link_editor.rb +33 -0
- data/mod/tinymce_editor/set/all/reference_editor/link_editor/link_parser.rb +35 -0
- data/mod/tinymce_editor/set/all/reference_editor/nest_editor.rb +174 -0
- data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_help.haml +0 -0
- data/mod/tinymce_editor/set/all/reference_editor/nest_editor/_options.haml +12 -0
- data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_options_select.haml +0 -0
- data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_options_select_row.haml +0 -0
- data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/nest_parser.rb +7 -1
- data/mod/tinymce_editor/set/all/reference_editor/nest_image.rb +70 -0
- data/mod/tinymce_editor/set/all/reference_editor/reference_editor.haml +18 -0
- metadata +39 -21
- data/mod/account/set/abstract/accounted.rb +0 -15
- data/mod/edit/set/all/bridge/account_section.rb +0 -16
- data/mod/edit/set/all/nest_editor.rb +0 -122
- data/mod/edit/set/all/nest_editor/_options.haml +0 -12
- data/mod/edit/set/all/nest_editor/nest_editor.haml +0 -31
- data/mod/edit/set/all/nest_image.rb +0 -37
@@ -1,64 +1,97 @@
|
|
1
1
|
class Card
|
2
2
|
module Set
|
3
3
|
class RequiredField
|
4
|
-
attr_reader :parent_set, :
|
4
|
+
attr_reader :parent_set, :field, :options
|
5
5
|
|
6
|
-
def initialize parent_set, field
|
6
|
+
def initialize parent_set, field, options={}
|
7
7
|
@parent_set = parent_set
|
8
|
-
@field_set = ensure_field_set parent_set, field
|
9
8
|
@field = field
|
9
|
+
@options = options
|
10
10
|
end
|
11
11
|
|
12
12
|
def add
|
13
13
|
create_parent_event
|
14
|
+
return unless field_events?
|
15
|
+
|
16
|
+
define_field_test
|
14
17
|
create_field_events
|
15
18
|
end
|
16
19
|
|
17
20
|
def parent_event_name
|
18
|
-
[parent_set.underscore, "requires_field",
|
21
|
+
[parent_set.underscore, "requires_field", field].join("__").to_sym
|
19
22
|
end
|
20
23
|
|
21
24
|
def field_event_name action
|
22
|
-
[
|
25
|
+
[field, "required_by", parent_set.underscore, "on", action].join("__").to_sym
|
23
26
|
end
|
24
27
|
|
25
28
|
private
|
26
29
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
+
def define_field_test
|
31
|
+
return unless (test = event_test)
|
32
|
+
method_name = field_test_name
|
33
|
+
field_set.class_exec do
|
34
|
+
define_method method_name do
|
35
|
+
left.send test
|
36
|
+
end
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
def field_test_name
|
41
|
+
return unless event_test
|
42
|
+
"_when_left_#{event_test}".to_sym
|
43
|
+
end
|
36
44
|
|
37
|
-
|
38
|
-
|
39
|
-
|
45
|
+
def event_test
|
46
|
+
return @event_test unless @event_test.nil?
|
47
|
+
test = options[:when]
|
48
|
+
@event_test = test&.is_a?(Symbol) ? test : false
|
40
49
|
end
|
41
50
|
|
42
|
-
def
|
43
|
-
field_set
|
44
|
-
|
45
|
-
on: :update, changing: :name do
|
46
|
-
return if superleft&.attribute_is_changing? :name
|
51
|
+
def field_set
|
52
|
+
@field_set ||= ensure_field_set parent_set, field
|
53
|
+
end
|
47
54
|
|
48
|
-
|
49
|
-
|
55
|
+
# for now, we only support field events on type sets. That's because only type sets
|
56
|
+
# have fields that are set-addressable (via type plus right sets)
|
57
|
+
def field_events?
|
58
|
+
parent_set.type_set?
|
59
|
+
end
|
50
60
|
|
51
|
-
|
61
|
+
def create_field_events
|
62
|
+
create_field_event :delete, "deleted", :trashed_left?
|
63
|
+
create_field_event :update, "renamed", :same_field?, changing: :name
|
64
|
+
end
|
65
|
+
|
66
|
+
def field_event_options action, extra_options
|
67
|
+
options = { on: action }.merge extra_options
|
68
|
+
options[:when] = field_test_name if event_test
|
69
|
+
options
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_field_event action, action_verb, allow_test, extra_options={}
|
73
|
+
event_name = field_event_name action
|
74
|
+
event_options = field_event_options action, extra_options
|
75
|
+
field_set.class_exec(self) do |required|
|
76
|
+
event event_name, :validate, event_options do
|
77
|
+
return if send allow_test
|
78
|
+
|
79
|
+
errors.add required.field, "can't be #{action_verb}; required field"
|
52
80
|
end
|
53
81
|
end
|
54
82
|
end
|
55
83
|
|
56
84
|
def create_parent_event
|
57
85
|
parent_set.class_exec(self) do |required|
|
58
|
-
event required.parent_event_name, :validate,
|
59
|
-
|
86
|
+
event required.parent_event_name, :validate,
|
87
|
+
required.options.merge(on: :create) do
|
88
|
+
return if field?(required.field) || left&.type_id == Card::CardtypeID
|
60
89
|
|
61
90
|
# Without the Cardtype exemption, we can get errors on type plus right sets
|
91
|
+
# eg, if right/account has require_field :email, then when we're trying
|
92
|
+
# to create User+*account+*type_plus right rules, it fails, because
|
93
|
+
# User+*account doesn't have an +email field.
|
94
|
+
#
|
62
95
|
# Need a better solution so we can require fields on cardtype+X cards, too.
|
63
96
|
|
64
97
|
errors.add required.field, "required" # LOCALIZE
|
@@ -66,14 +99,15 @@ class Card
|
|
66
99
|
end
|
67
100
|
end
|
68
101
|
|
69
|
-
def ensure_field_set
|
70
|
-
field_set =
|
102
|
+
def ensure_field_set parent_set, field
|
103
|
+
field_set = parent_set.ensure_set { field_set_name parent_set, field }
|
71
104
|
Card::Set.register_set field_set
|
72
105
|
field_set
|
73
106
|
end
|
107
|
+
|
108
|
+
def field_set_name parent_set, field
|
109
|
+
"TypePlusRight::#{parent_set.set_name_parts.last}::#{field.to_s.capitalize}"
|
110
|
+
end
|
74
111
|
end
|
75
112
|
end
|
76
113
|
end
|
77
|
-
|
78
|
-
|
79
|
-
|
data/lib/card/set/trait.rb
CHANGED
@@ -18,8 +18,9 @@ class Card
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def require_field *fields
|
21
|
+
options = fields.last.is_a?(Hash) ? fields.pop : {}
|
21
22
|
fields.each do |field|
|
22
|
-
Card::Set::RequiredField.new(self, field).add
|
23
|
+
Card::Set::RequiredField.new(self, field, options).add
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -55,7 +56,7 @@ class Card
|
|
55
56
|
def define_trait_card trait, opts
|
56
57
|
define_method "#{trait}_card" do
|
57
58
|
trait_var "@#{trait}_card" do
|
58
|
-
fetch trait
|
59
|
+
fetch trait.to_sym, new: opts.clone
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Card
|
2
|
+
module Set
|
3
|
+
class Type < Pattern::Base
|
4
|
+
def initialize card
|
5
|
+
super
|
6
|
+
# support type inheritance
|
7
|
+
@inherit_card = card unless module_key
|
8
|
+
end
|
9
|
+
|
10
|
+
def lookup_module_list modules_hash
|
11
|
+
lookup_key = module_key || inherited_key
|
12
|
+
modules_hash[lookup_key] if lookup_key
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def inherited_key
|
18
|
+
if defined?(@inherited_key)
|
19
|
+
@inherited_key
|
20
|
+
else
|
21
|
+
@inherited_key = lookup_inherited_key
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def lookup_inherited_key
|
26
|
+
return unless (card = @inherit_card)
|
27
|
+
|
28
|
+
@inherit_card = nil
|
29
|
+
return unless (type_code = default_type_code card)
|
30
|
+
|
31
|
+
mod_key = "Type::#{type_code.to_s.camelize}"
|
32
|
+
mod_key if mods_exist_for_key? mod_key
|
33
|
+
end
|
34
|
+
|
35
|
+
def default_type_code card
|
36
|
+
card.rule_card(:default)&.type_code
|
37
|
+
end
|
38
|
+
|
39
|
+
def mods_exist_for_key? mod_key
|
40
|
+
list_of_hashes = Card::Set.modules[:nonbase_format].values
|
41
|
+
list_of_hashes << Card::Set.modules[:nonbase]
|
42
|
+
list_of_hashes.any? { |h| h[mod_key] }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/card/subcards.rb
CHANGED
@@ -11,10 +11,6 @@ class Card
|
|
11
11
|
# Together with "my address" you want to create the subcards
|
12
12
|
# "my address+name", "my address+street", etc.
|
13
13
|
class Subcards
|
14
|
-
require_dependency "card/subcards/add"
|
15
|
-
require_dependency "card/subcards/remove"
|
16
|
-
require_dependency "card/subcards/relate"
|
17
|
-
|
18
14
|
include Add
|
19
15
|
include Remove
|
20
16
|
include Relate
|
data/lib/card/tasks/card.rake
CHANGED
data/lib/card/view.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
require_dependency "card/view/cache"
|
2
|
-
require_dependency "card/view/options"
|
3
|
-
require_dependency "card/view/classy"
|
4
|
-
require_dependency "card/view/permission"
|
5
|
-
|
6
1
|
class Card
|
7
2
|
# Card::View manages {Options view options}, {Cache view caching}, and
|
8
3
|
# {Permission view permissions}.
|
@@ -25,11 +20,11 @@ class Card
|
|
25
20
|
#
|
26
21
|
class View
|
27
22
|
include Options
|
28
|
-
include Cache
|
23
|
+
include ::Card::View::Cache
|
29
24
|
include Classy
|
30
25
|
include Permission
|
31
26
|
|
32
|
-
extend Cache::ClassMethods
|
27
|
+
extend ::Card::View::Cache::ClassMethods
|
33
28
|
|
34
29
|
attr_reader :format, :parent, :card
|
35
30
|
|
data/lib/card/view/cache.rb
CHANGED
data/lib/card/view/cache/stub.rb
CHANGED
data/lib/cardio.rb
CHANGED
@@ -13,84 +13,95 @@ end
|
|
13
13
|
module Cardio
|
14
14
|
extend Schema
|
15
15
|
extend Utils
|
16
|
-
CARD_GEM_ROOT = File.expand_path("
|
16
|
+
CARD_GEM_ROOT = File.expand_path("..", __dir__)
|
17
17
|
|
18
18
|
mattr_reader :paths, :config
|
19
19
|
|
20
20
|
class << self
|
21
|
+
def card_defined?
|
22
|
+
const_defined? "Card"
|
23
|
+
end
|
24
|
+
|
21
25
|
def load_card?
|
22
|
-
ActiveRecord::Base.connection && !
|
26
|
+
ActiveRecord::Base.connection && !card_defined?
|
23
27
|
rescue
|
24
28
|
false
|
25
29
|
end
|
26
30
|
|
31
|
+
def load_card!
|
32
|
+
require "card"
|
33
|
+
ActiveSupport.run_load_hooks :after_card
|
34
|
+
end
|
35
|
+
|
27
36
|
def cache
|
28
37
|
@cache ||= ::Rails.cache
|
29
38
|
end
|
30
39
|
|
31
40
|
def default_configs
|
32
41
|
{
|
33
|
-
read_only:
|
42
|
+
read_only: read_only?,
|
34
43
|
|
35
44
|
# if you disable inline styles tinymce's formatting options stop working
|
36
|
-
allow_inline_styles:
|
45
|
+
allow_inline_styles: true,
|
37
46
|
|
38
|
-
recaptcha_public_key:
|
39
|
-
recaptcha_private_key:
|
40
|
-
recaptcha_proxy:
|
41
|
-
recaptcha_site_key:
|
42
|
-
recaptcha_secret_key:
|
47
|
+
recaptcha_public_key: nil, # deprecated; use recaptcha_site_key instead
|
48
|
+
recaptcha_private_key: nil, # deprecated; use recaptcha_secret_key instead
|
49
|
+
recaptcha_proxy: nil,
|
50
|
+
recaptcha_site_key: nil,
|
51
|
+
recaptcha_secret_key: nil,
|
43
52
|
recaptcha_minimum_score: 0.5,
|
44
53
|
|
45
|
-
override_host:
|
46
|
-
override_protocol:
|
54
|
+
override_host: nil,
|
55
|
+
override_protocol: nil,
|
47
56
|
|
48
|
-
no_authentication:
|
49
|
-
files_web_path:
|
57
|
+
no_authentication: false,
|
58
|
+
files_web_path: "files",
|
50
59
|
|
51
|
-
max_char_count:
|
52
|
-
max_depth:
|
53
|
-
email_defaults:
|
60
|
+
max_char_count: 200,
|
61
|
+
max_depth: 20,
|
62
|
+
email_defaults: nil,
|
54
63
|
|
55
|
-
token_expiry:
|
56
|
-
acts_per_page:
|
64
|
+
token_expiry: 2.days,
|
65
|
+
acts_per_page: 10,
|
57
66
|
space_last_in_multispace: true,
|
58
|
-
closed_search_limit:
|
59
|
-
paging_limit:
|
67
|
+
closed_search_limit: 10,
|
68
|
+
paging_limit: 20,
|
60
69
|
|
61
|
-
non_createable_types:
|
62
|
-
view_cache:
|
63
|
-
rss_enabled:
|
64
|
-
double_click:
|
70
|
+
non_createable_types: [%w[signup setting set session bootswatch_skin customized_bootswatch_skin]], # FIXME
|
71
|
+
view_cache: false,
|
72
|
+
rss_enabled: false,
|
73
|
+
double_click: :signed_in,
|
65
74
|
|
66
|
-
encoding:
|
67
|
-
request_logger:
|
68
|
-
performance_logger:
|
69
|
-
sql_comments:
|
75
|
+
encoding: "utf-8",
|
76
|
+
request_logger: false,
|
77
|
+
performance_logger: false,
|
78
|
+
sql_comments: true,
|
70
79
|
|
71
|
-
file_storage:
|
72
|
-
file_buckets:
|
73
|
-
file_default_bucket:
|
74
|
-
protocol_and_host:
|
80
|
+
file_storage: :local,
|
81
|
+
file_buckets: {},
|
82
|
+
file_default_bucket: nil,
|
83
|
+
protocol_and_host: nil,
|
75
84
|
|
76
|
-
rich_text_editor:
|
85
|
+
rich_text_editor: :tinymce,
|
77
86
|
|
78
|
-
persistent_cache:
|
79
|
-
prepopulate_cache:
|
80
|
-
machine_refresh:
|
81
|
-
compress_javascript:
|
87
|
+
persistent_cache: true,
|
88
|
+
prepopulate_cache: false,
|
89
|
+
machine_refresh: :cautious, # options: eager, cautious, never
|
90
|
+
compress_javascript: true,
|
82
91
|
|
83
92
|
allow_irreversible_admin_tasks: false,
|
84
|
-
raise_all_rendering_errors:
|
85
|
-
rescue_all_in_controller:
|
86
|
-
navbox_match_start_only:
|
87
|
-
|
93
|
+
raise_all_rendering_errors: false,
|
94
|
+
rescue_all_in_controller: true,
|
95
|
+
navbox_match_start_only: true,
|
96
|
+
|
97
|
+
reload_sets: false,
|
98
|
+
load_strategy: :eval
|
88
99
|
}
|
89
100
|
end
|
90
101
|
|
91
102
|
def set_config config
|
92
103
|
@@config = config
|
93
|
-
config.active_job.queue_adapter = :delayed_job #better place for this?
|
104
|
+
config.active_job.queue_adapter = :delayed_job # better place for this?
|
94
105
|
|
95
106
|
add_lib_dirs_to_autoload_paths config
|
96
107
|
|
@@ -100,12 +111,27 @@ module Cardio
|
|
100
111
|
end
|
101
112
|
|
102
113
|
def add_lib_dirs_to_autoload_paths config
|
103
|
-
config.autoload_paths += Dir["#{gem_root}/lib
|
104
|
-
config.autoload_paths += Dir["#{gem_root}/mod/*/lib
|
105
|
-
config.
|
114
|
+
config.autoload_paths += Dir["#{gem_root}/lib"]
|
115
|
+
config.autoload_paths += Dir["#{gem_root}/mod/*/lib"]
|
116
|
+
config.watchable_dirs["#{gem_root}/mod/*/set"] = [:rb]
|
117
|
+
|
118
|
+
config.autoload_paths += Dir["#{root}/mod/*/lib"]
|
119
|
+
config.watchable_dirs["#{root}/mod/*/set"] = [:rb]
|
106
120
|
gem_mod_paths.each do |_mod_name, mod_path|
|
107
|
-
config.autoload_paths += Dir["#{mod_path}/lib
|
121
|
+
config.autoload_paths += Dir["#{mod_path}/lib"]
|
122
|
+
config.watchable_dirs["#{mod_path}/set"] = [:rb]
|
108
123
|
end
|
124
|
+
# the watachable_dirs are processes in
|
125
|
+
# set_clear_dependencies_hook hook in the railties gem in finisher.rb
|
126
|
+
|
127
|
+
# TODO: move this to the right place in decko
|
128
|
+
config.autoload_paths += Dir["#{Decko.gem_root}/lib"]
|
129
|
+
# config.autoload_paths += Dir["#{gem_root}/lib/**/"]
|
130
|
+
# config.autoload_paths += Dir["#{gem_root}/mod/*/lib/**/"]
|
131
|
+
# config.autoload_paths += Dir["#{root}/mod/*/lib/**/"]
|
132
|
+
# gem_mod_paths.each do |_mod_name, mod_path|
|
133
|
+
# config.autoload_paths += Dir["#{mod_path}/lib/**/"]
|
134
|
+
# end
|
109
135
|
end
|
110
136
|
|
111
137
|
# @return Hash with key mod names (without card-mod prefix) and values the
|
@@ -115,6 +141,7 @@ module Cardio
|
|
115
141
|
Bundler.definition.specs.each_with_object({}) do |gem_spec, h|
|
116
142
|
mod_name = mod_name_from_gem_spec gem_spec
|
117
143
|
next unless mod_name
|
144
|
+
|
118
145
|
h[mod_name] = gem_spec.full_gem_path
|
119
146
|
end
|
120
147
|
end
|