card 1.19.6 → 1.20.0
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/card.gemspec +8 -7
- data/config/initializers/01_core_extensions/array.rb +4 -0
- data/config/initializers/01_core_extensions/persistent_identifiers.rb +12 -0
- data/config/initializers/02_patches/better_errors.rb +56 -0
- data/config/initializers/core_extensions.rb +13 -18
- data/config/initializers/patches.rb +8 -0
- data/config/locales/de.yml +0 -2
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +22 -12
- data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +17 -0
- data/db/migrate_core_cards/20161103154836_update_keys.rb +46 -0
- data/lib/card.rb +1 -8
- data/lib/card/act_manager.rb +4 -0
- data/lib/card/auth/permissions.rb +5 -3
- data/lib/card/cache.rb +1 -20
- data/lib/card/cache/persistent.rb +6 -0
- data/lib/card/content/chunk.rb +4 -3
- data/lib/card/content/diff.rb +2 -2
- data/lib/card/content/diff/result.rb +11 -0
- data/lib/card/env/success.rb +4 -0
- data/lib/card/error.rb +2 -0
- data/lib/card/format.rb +14 -17
- data/lib/card/format/content.rb +16 -8
- data/lib/card/format/error.rb +3 -5
- data/lib/card/format/names.rb +22 -16
- data/lib/card/format/nest.rb +67 -61
- data/lib/card/format/nest/fetch.rb +40 -33
- data/lib/card/format/nest/main.rb +39 -19
- data/lib/card/format/nest/subformat.rb +3 -16
- data/lib/card/format/nest/view.rb +23 -32
- data/lib/card/format/permission.rb +49 -34
- data/lib/card/format/registration.rb +12 -6
- data/lib/card/format/render.rb +62 -73
- data/lib/card/migration.rb +14 -10
- data/lib/card/migration/import.rb +20 -19
- data/lib/card/migration/import/import_data.rb +50 -59
- data/lib/card/migration/import/import_data/card_attributes.rb +56 -0
- data/lib/card/migration/import/import_data/card_content.rb +33 -0
- data/lib/card/migration/import/merger.rb +47 -0
- data/lib/card/mod/loader.rb +4 -4
- data/lib/card/model/save_helper.rb +49 -10
- data/lib/card/name.rb +16 -52
- data/lib/card/name/fields_and_traits.rb +67 -0
- data/lib/card/name/variants.rb +17 -0
- data/lib/card/query.rb +6 -2
- data/lib/card/query/attributes.rb +1 -1
- data/lib/card/query/interpretation.rb +3 -3
- data/lib/card/set/event.rb +2 -1
- data/lib/card/set/format.rb +18 -7
- data/lib/card/set_pattern.rb +17 -13
- data/lib/card/tasks/card.rake +1 -1
- data/lib/card/view.rb +55 -0
- data/lib/card/view/cache.rb +90 -0
- data/lib/card/view/fetch.rb +109 -0
- data/lib/card/view/options.rb +164 -0
- data/lib/card/view/stub.rb +30 -0
- data/lib/card/view/visibility.rb +95 -0
- data/lib/cardio.rb +3 -2
- data/lib/cardio/schema.rb +21 -8
- data/lib/generators/card.rb +16 -2
- data/lib/generators/card/format/format_generator.rb +10 -9
- data/lib/generators/card/migration/migration_generator.rb +10 -5
- data/lib/generators/card/set/USAGE +1 -1
- data/lib/generators/card/set/set_generator.rb +11 -9
- data/mod/account/set/right/account.rb +38 -40
- data/mod/account/set/right/token.rb +2 -1
- data/mod/account/set/self/account_links.rb +34 -54
- data/mod/account/set/self/signin.rb +107 -93
- data/mod/account/set/type/signup.rb +33 -32
- data/mod/account/set/type/user.rb +28 -21
- data/mod/account/spec/set/all/account_spec.rb +9 -9
- data/mod/account/spec/set/right/account_spec.rb +23 -14
- data/mod/account/spec/set/right/email_spec.rb +6 -6
- data/mod/account/spec/set/right/password_spec.rb +4 -4
- data/mod/account/spec/set/right/token_spec.rb +3 -3
- data/mod/account/spec/set/self/account_links_spec.rb +3 -3
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +7 -8
- data/mod/ace_editor/set/abstract/ace_editor.rb +1 -4
- data/mod/admin/set/self/admin.rb +2 -2
- data/mod/admin/set/self/admin_info.rb +1 -1
- data/mod/admin/set/self/recaptcha_private_key.rb +3 -0
- data/mod/admin/set/self/recaptcha_proxy.rb +3 -0
- data/mod/admin/set/self/recaptcha_public_key.rb +3 -0
- data/mod/admin/set/self/trash.rb +4 -4
- data/mod/admin/spec/set/self/admin_spec.rb +4 -4
- data/mod/admin/spec/set/self/version_spec.rb +1 -1
- data/mod/basic_formats/set/all/all_css.rb +3 -3
- data/mod/basic_formats/set/all/all_csv.rb +6 -6
- data/mod/basic_formats/set/all/all_js.rb +4 -0
- data/mod/basic_formats/set/all/base.rb +40 -62
- data/mod/basic_formats/set/all/json.rb +34 -39
- data/mod/basic_formats/set/all/rss.rb +6 -6
- data/mod/basic_formats/set/all/text.rb +3 -2
- data/mod/basic_formats/set/self/01_head/javascript.rb +2 -2
- data/mod/basic_formats/set/self/head.rb +6 -10
- data/mod/basic_formats/spec/set/all/all_css_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/all_csv_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/base_spec.rb +8 -5
- data/mod/basic_formats/spec/set/all/json_spec.rb +2 -2
- data/mod/basic_formats/spec/set/all/rss_spec.rb +4 -4
- data/mod/basic_types/set/type/plain_text.rb +3 -5
- data/mod/basic_types/spec/set/type/plain_text_spec.rb +2 -2
- data/mod/bootstrap/lib/bootstrap.rb +16 -0
- data/mod/bootstrap/lib/bootstrap/basic_tags.rb +26 -0
- data/mod/bootstrap/lib/bootstrap/component.rb +133 -0
- data/mod/bootstrap/lib/bootstrap/component/form.rb +31 -0
- data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +38 -0
- data/mod/bootstrap/lib/bootstrap/component/layout.rb +83 -0
- data/mod/bootstrap/lib/bootstrap/component/panel.rb +9 -0
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +30 -0
- data/mod/bootstrap/lib/bootstrap/delegate.rb +16 -0
- data/mod/bootstrap/lib/bootstrapper.rb +16 -0
- data/mod/bootstrap/lib/stylesheets/bootstrap/_tables.scss +55 -52
- data/mod/bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +12 -12
- data/mod/bootstrap/lib/stylesheets/bootstrap_cards.scss +12 -0
- data/mod/bootstrap/set/all/bootstrap/accordion.rb +63 -0
- data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -140
- data/mod/bootstrap/set/all/bootstrap/navbar.rb +74 -0
- data/mod/bootstrap/set/all/bootstrap/table.rb +76 -46
- data/mod/bootstrap/set/all/bootstrap/tabs.rb +58 -23
- data/mod/bootstrap/set/all/bootstrap/wrapper.rb +14 -8
- data/mod/bootstrap/set/all/rich_bootstrap.rb +5 -3
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +31 -0
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +20 -0
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +59 -1
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +104 -15
- data/mod/carrierwave/set/abstract/attachment.rb +4 -3
- data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +5 -11
- data/mod/carrierwave/set/type/file.rb +39 -32
- data/mod/carrierwave/set/type/image.rb +59 -34
- data/mod/carrierwave/spec/set/type/image_spec.rb +3 -3
- data/mod/core/chunk/link.rb +5 -0
- data/mod/core/chunk/{include.rb → nest.rb} +8 -29
- data/mod/core/chunk/reference.rb +5 -6
- data/mod/core/chunk/view_stub.rb +42 -0
- data/mod/core/format/html_format.rb +23 -26
- data/mod/core/set/abstract/code_file.rb +1 -1
- data/mod/core/set/all/actify.rb +1 -1
- data/mod/core/set/all/active_card.rb +0 -1
- data/mod/core/set/all/{tracked_attributes.rb → assign_attributes.rb} +55 -24
- data/mod/core/set/all/collection.rb +136 -122
- data/mod/core/set/all/content.rb +8 -0
- data/mod/core/set/all/event.rb +5 -2
- data/mod/core/set/all/export.rb +7 -7
- data/mod/core/set/all/fetch.rb +90 -26
- data/mod/core/set/all/initialize.rb +17 -6
- data/mod/core/set/all/name.rb +2 -3
- data/mod/core/set/all/permissions.rb +19 -11
- data/mod/core/set/all/states.rb +12 -2
- data/mod/core/set/all/trash.rb +1 -1
- data/mod/core/set/all/type.rb +2 -0
- data/mod/core/set/all/utils.rb +4 -3
- data/mod/core/spec/chunk/literal_spec.rb +2 -2
- data/mod/core/spec/chunk/uri_spec.rb +17 -17
- data/mod/core/spec/format/html_format_spec.rb +11 -13
- data/mod/core/spec/set/all/attribute_tracking_spec.rb +2 -2
- data/mod/core/spec/set/all/collection_spec.rb +21 -24
- data/mod/core/spec/set/all/content_spec.rb +1 -1
- data/mod/core/spec/set/all/export_spec.rb +3 -3
- data/mod/core/spec/set/all/fetch_spec.rb +5 -5
- data/mod/core/spec/set/all/initialize_spec.rb +4 -4
- data/mod/core/spec/set/all/name_spec.rb +6 -6
- data/mod/core/spec/set/all/permissions_spec.rb +10 -10
- data/mod/core/spec/set/all/references_spec.rb +1 -1
- data/mod/core/spec/set/all/rules2_spec.rb +24 -24
- data/mod/core/spec/set/all/rules_spec.rb +1 -1
- data/mod/core/spec/set/all/templating_spec.rb +8 -8
- data/mod/core/spec/set/all/tracked_attributes_spec.rb +6 -6
- data/mod/core/spec/set/all/type_spec.rb +5 -5
- data/mod/developer/spec/set/all/event_viz_spec.rb +1 -1
- data/mod/developer/spec/set/right/debug_spec.rb +1 -1
- data/mod/email/set/all/email_html.rb +2 -2
- data/mod/email/set/all/notify.rb +8 -3
- data/mod/email/set/right/bcc.rb +3 -3
- data/mod/email/set/right/follow.rb +5 -5
- data/mod/email/set/right/following.rb +1 -1
- data/mod/email/set/self/follow_defaults.rb +27 -16
- data/mod/email/set/type/email_template.rb +1 -1
- data/mod/email/set/type_plus_right/user/follow.rb +10 -9
- data/mod/history/lib/card/act.rb +4 -0
- data/mod/history/lib/card/act/act_renderer.rb +194 -0
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +25 -0
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +41 -0
- data/mod/history/lib/card/action.rb +1 -0
- data/mod/history/lib/card/action/action_renderer.rb +92 -0
- data/mod/history/lib/card/action/differ.rb +6 -1
- data/mod/history/set/all/act_view.rb +64 -0
- data/mod/history/set/all/action_view.rb +65 -0
- data/mod/history/set/all/content_history.rb +44 -37
- data/mod/history/set/all/history.rb +49 -263
- data/mod/machines/lib/stylesheets/style_cards.scss +30 -115
- data/mod/machines/set/abstract/script.rb +42 -7
- data/mod/machines/set/right/machine_input.rb +4 -0
- data/mod/machines/set/type/coffee_script.rb +8 -22
- data/mod/machines/set/type/css.rb +2 -2
- data/mod/machines/set/type/java_script.rb +4 -24
- data/mod/machines/set/type/scss.rb +1 -1
- data/mod/machines/spec/set/type/css_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +3 -3
- data/mod/machines/spec/set/type/skin_spec.rb +7 -7
- data/mod/pointer/set/abstract/01_pointer.rb +44 -46
- data/mod/pointer/set/abstract/01_pointer/edit.rb +13 -13
- data/mod/pointer/set/right/options.rb +4 -0
- data/mod/pointer/spec/set/type/pointer_spec.rb +7 -7
- data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +3 -3
- data/mod/settings/set/abstract/permission.rb +25 -18
- data/mod/settings/set/right/add_help.rb +3 -3
- data/mod/settings/set/right/structure.rb +10 -16
- data/mod/settings/spec/set/right/comment_spec.rb +3 -3
- data/mod/settings/spec/set/right/create_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -1
- data/mod/settings/spec/set/type/setting_spec.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +4 -4
- data/mod/solid_cache/set/right/solid_cache.rb +9 -10
- data/mod/standard/set/abstract/01_search_params.rb +41 -0
- data/mod/standard/set/abstract/search.rb +132 -0
- data/mod/standard/set/abstract/search/paging.rb +81 -0
- data/mod/standard/set/abstract/search/paging/paging_links.rb +90 -0
- data/mod/standard/set/abstract/wql_search.rb +67 -0
- data/mod/standard/set/all/error.rb +89 -82
- data/mod/standard/set/all/links.rb +1 -1
- data/mod/standard/set/all/rich_html/content.rb +125 -141
- data/mod/standard/set/all/rich_html/editing.rb +115 -178
- data/mod/standard/set/all/rich_html/form.rb +111 -131
- data/mod/standard/set/all/rich_html/header.rb +57 -39
- data/mod/standard/set/all/rich_html/menu.rb +94 -94
- data/mod/standard/set/all/rich_html/modal.rb +5 -10
- data/mod/standard/set/all/rich_html/new.rb +103 -0
- data/mod/standard/set/all/rich_html/toolbar.rb +54 -74
- data/mod/standard/set/all/rich_html/wrapper.rb +111 -138
- data/mod/standard/set/rstar/rules.rb +27 -38
- data/mod/standard/set/rstar/rules_editor.rb +298 -277
- data/mod/standard/set/self/navbox.rb +20 -15
- data/mod/standard/set/self/recent.rb +25 -17
- data/mod/standard/set/self/search.rb +25 -4
- data/mod/standard/set/type/cardtype.rb +11 -9
- data/mod/standard/set/type/date.rb +1 -1
- data/mod/standard/set/type/number.rb +1 -1
- data/mod/standard/set/type/phrase.rb +1 -1
- data/mod/standard/set/type/search_type.rb +17 -282
- data/mod/standard/set/type/session.rb +1 -1
- data/mod/standard/set/type/set.rb +155 -131
- data/mod/standard/set/type/toggle.rb +1 -1
- data/mod/standard/set/type/uri.rb +4 -4
- data/mod/standard/spec/chunk/include_spec.rb +13 -31
- data/mod/standard/spec/chunk/link_spec.rb +1 -1
- data/mod/standard/spec/set/all/error_spec.rb +1 -1
- data/mod/standard/spec/set/all/history_spec.rb +2 -2
- data/mod/standard/spec/set/all/rich_html/form_spec.rb +4 -4
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +22 -0
- data/mod/standard/spec/set/all/rich_html/wrapper_spec.rb +3 -2
- data/mod/standard/spec/set/right/when_created_spec.rb +1 -1
- data/mod/standard/spec/set/right/when_last_edited_spec.rb +1 -1
- data/mod/standard/spec/set/rstar/rules_spec.rb +2 -3
- data/mod/standard/spec/set/self/head_spec.rb +2 -2
- data/mod/standard/spec/set/self/navbox_spec.rb +1 -1
- data/mod/standard/spec/set/self/now_spec.rb +1 -1
- data/mod/standard/spec/set/type/date_spec.rb +1 -1
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -1
- data/mod/standard/spec/set/type/layout_type_spec.rb +1 -1
- data/mod/standard/spec/set/type/number_spec.rb +1 -1
- data/mod/standard/spec/set/type/phrase_spec.rb +1 -1
- data/mod/standard/spec/set/type/search_type_spec.rb +2 -2
- data/mod/standard/spec/set/type/set_spec.rb +2 -2
- data/mod/standard/spec/set/type/toggle_spec.rb +2 -2
- data/mod/standard/spec/set/type/uri_spec.rb +3 -1
- data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
- data/spec/config/initializers/core_extensions_spec.rb +40 -10
- data/spec/lib/card/auth_spec.rb +8 -8
- data/spec/lib/card/cache_spec.rb +3 -3
- data/spec/lib/card/chunk_spec.rb +4 -4
- data/spec/lib/card/codename_spec.rb +2 -2
- data/spec/lib/card/content_spec.rb +23 -23
- data/spec/lib/card/diff_spec.rb +1 -1
- data/spec/lib/card/format_spec.rb +19 -24
- data/spec/lib/card/loader_spec.rb +4 -4
- data/spec/lib/card/name_spec.rb +16 -16
- data/spec/lib/card/query_spec.rb +80 -80
- data/spec/lib/card/reference_spec.rb +5 -5
- data/spec/lib/card/set_spec.rb +6 -6
- data/spec/lib/card/subcards_spec.rb +14 -0
- data/spec/lib/card/view_cache_spec.rb +5 -5
- data/spec/models/card/cardtype_spec.rb +15 -15
- data/spec/models/card/create_spec.rb +2 -2
- data/spec/models/card/trash_spec.rb +24 -24
- data/spec/models/card/type_transition_spec.rb +8 -8
- data/spec/models/card/validation_spec.rb +5 -5
- data/spec/models/card_spec.rb +14 -14
- data/spec/spec_helper.rb +6 -2
- data/spec/support/card_spec_helper.rb +21 -11
- data/spec/support/helper/card_helper.rb +11 -4
- metadata +73 -15
- data/lib/card/cache/view_cache.rb +0 -103
- data/mod/bootstrap/set/all/bootstrap/layout.rb +0 -58
- data/mod/core/set/all/view_cache.rb +0 -9
@@ -1,173 +1,194 @@
|
|
1
1
|
|
2
|
+
include_set Type::SearchType
|
3
|
+
|
2
4
|
format :html do
|
3
|
-
|
4
|
-
|
5
|
-
end
|
5
|
+
COMMON_RULE_SETTINGS =
|
6
|
+
[:create, :read, :update, :delete, :structure, :default, :style].freeze
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
args[:
|
11
|
-
|
8
|
+
view :core do |args|
|
9
|
+
voo.show :set_label, :rule_navbar
|
10
|
+
voo.hide :set_navbar
|
11
|
+
rule_view = args[:rule_view] || :common_rules
|
12
|
+
_render rule_view
|
12
13
|
end
|
13
14
|
|
14
|
-
def with_label_and_navbars
|
15
|
+
def with_label_and_navbars selected_view
|
16
|
+
@selected_rule_navbar_view = selected_view
|
15
17
|
wrap do
|
16
18
|
[
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
_optional_render_set_label,
|
20
|
+
_optional_render_rule_navbar,
|
21
|
+
_optional_render_set_navbar,
|
20
22
|
yield
|
21
23
|
]
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
view :all_rules do
|
26
|
-
with_label_and_navbars
|
27
|
-
rules_table card.visible_setting_codenames.sort
|
27
|
+
view :all_rules do
|
28
|
+
with_label_and_navbars :all_rules do
|
29
|
+
rules_table card.visible_setting_codenames.sort
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
view :grouped_rules do
|
32
|
-
with_label_and_navbars
|
33
|
-
|
34
|
-
|
35
|
-
role: "tablist",
|
36
|
-
"aria-multiselectable" => "true") do
|
33
|
+
view :grouped_rules do
|
34
|
+
with_label_and_navbars :grouped_rules do
|
35
|
+
wrap_with :div, class: "panel-group", id: "accordion",
|
36
|
+
role: "tablist", "aria-multiselectable" => "true" do
|
37
37
|
Card::Setting.groups.keys.map do |group_key|
|
38
|
-
_optional_render
|
39
|
-
end
|
38
|
+
_optional_render group_key
|
39
|
+
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
view :recent_rules do
|
45
|
-
with_label_and_navbars
|
44
|
+
view :recent_rules do
|
45
|
+
with_label_and_navbars :recent_rules do
|
46
46
|
recent_settings = Card[:recent_settings].item_cards.map(&:codename)
|
47
47
|
settings = recent_settings.map(&:to_sym) & card.visible_setting_codenames
|
48
|
-
rules_table settings
|
48
|
+
rules_table settings
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
view :common_rules do
|
53
|
-
with_label_and_navbars
|
54
|
-
settings =
|
55
|
-
|
56
|
-
|
57
|
-
rules_table settings, args
|
52
|
+
view :common_rules do
|
53
|
+
with_label_and_navbars :common_rules do
|
54
|
+
settings = card.visible_setting_codenames & COMMON_RULE_SETTINGS
|
55
|
+
# "&" = set intersection
|
56
|
+
rules_table settings
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
|
-
view :field_related_rules do
|
62
|
-
with_label_and_navbars
|
60
|
+
view :field_related_rules do
|
61
|
+
with_label_and_navbars :field_related_rules do
|
63
62
|
field_settings = [:default, :help, :structure]
|
64
63
|
if card.type_id == PointerID
|
64
|
+
# FIXME: should be done with override in pointer set module
|
65
65
|
field_settings += [:input, :options, :options_label]
|
66
66
|
end
|
67
|
-
|
67
|
+
settings = card.visible_setting_codenames & field_settings
|
68
|
+
rules_table settings
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
|
-
view :set_label do
|
72
|
-
|
72
|
+
view :set_label do
|
73
|
+
wrap_with :h3, card.label, class: "set-label"
|
73
74
|
end
|
74
75
|
|
75
76
|
Card::Setting.groups.keys.each do |group_key|
|
76
|
-
view group_key.to_sym do
|
77
|
+
view group_key.to_sym do
|
77
78
|
settings = card.visible_settings group_key
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
end),
|
96
|
-
(content_tag :div, id: collapse_id,
|
97
|
-
class: "panel-collapse collapse",
|
98
|
-
role: "tabpanel",
|
99
|
-
"aria-labelledby" => heading_id do
|
100
|
-
rules_table settings.map(&:codename), args
|
101
|
-
end)
|
102
|
-
]
|
79
|
+
return unless settings.present?
|
80
|
+
group_panels group_key
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def group_panels group_key
|
85
|
+
output [group_tab(group_key), group_tabpanel(group_key)]
|
86
|
+
end
|
87
|
+
|
88
|
+
def group_tab group_key
|
89
|
+
heading_id = "heading-#{group_key}"
|
90
|
+
wrap_with :div, class: "panel panel-default" do
|
91
|
+
wrap_with :div, class: "panel-heading", role: "tab", id: heading_id do
|
92
|
+
wrap_with :h4, class: "panel-title" do
|
93
|
+
group_collapse_link group_key
|
94
|
+
end
|
103
95
|
end
|
104
96
|
end
|
105
97
|
end
|
106
98
|
|
107
|
-
def
|
99
|
+
def group_collapse_link group_key
|
100
|
+
collapse_id = group_collapse_id group_key
|
101
|
+
group_name = Card::Setting.group_names[group_key] || group_key.to_s
|
102
|
+
link_to group_name,
|
103
|
+
href: "##{collapse_id}",
|
104
|
+
"data-toggle" => "collapse", "aria-expanded" => "false",
|
105
|
+
"data-parent" => "#accordion", "aria-controls" => collapse_id
|
106
|
+
end
|
107
|
+
|
108
|
+
def group_collapse_id group_key
|
109
|
+
"collapse-#{card.cardname.safe_key}-#{group_key}"
|
110
|
+
end
|
111
|
+
|
112
|
+
def group_tabpanel group_key
|
113
|
+
collapse_id = group_collapse_id group_key
|
114
|
+
heading_id = "heading-#{group_key}"
|
115
|
+
settings = card.visible_settings group_key
|
116
|
+
wrap_with :div, id: collapse_id, class: "panel-collapse collapse",
|
117
|
+
role: "tabpanel", "aria-labelledby" => heading_id do
|
118
|
+
rules_table settings.map(&:codename)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def rules_table settings
|
108
123
|
wrap_with :table, class: "set-rules table" do
|
109
|
-
[
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
nest(rule_card, view: :closed_rule).html_safe
|
117
|
-
end
|
118
|
-
end * "\n")
|
119
|
-
]
|
124
|
+
[rules_table_headings, rules_table_body(settings)]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def rules_table_headings
|
129
|
+
wrap_with :tr, class: "rule-group" do
|
130
|
+
wrap_each_with :th, %w(Trait Content Set), class: "rule-heading"
|
120
131
|
end
|
121
132
|
end
|
122
133
|
|
123
|
-
|
134
|
+
def rules_table_body settings
|
135
|
+
settings.map do |setting|
|
136
|
+
next unless show_view? setting
|
137
|
+
rule_card = card.fetch trait: setting, new: {}
|
138
|
+
nest(rule_card, view: :closed_rule).html_safe
|
139
|
+
end * "\n"
|
140
|
+
end
|
141
|
+
|
142
|
+
view :editor do
|
124
143
|
"Cannot currently edit Sets" # ENGLISH
|
125
144
|
end
|
126
145
|
|
127
|
-
view :template_link do
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
"{{#{link}}"
|
146
|
+
view :template_link, cache: :never do
|
147
|
+
wrap do
|
148
|
+
link = link_to_view :template_editor, parent.voo.nest_syntax,
|
149
|
+
class: "slotter"
|
150
|
+
"{{#{link}}}"
|
132
151
|
end
|
133
152
|
end
|
134
153
|
|
135
|
-
view :template_closer do
|
154
|
+
view :template_closer do
|
136
155
|
link_classes = "slotter glyphicon glyphicon-remove template-editor-close"
|
137
156
|
link_to_view :template_link, "", class: link_classes
|
138
157
|
end
|
139
158
|
|
140
|
-
view :template_editor do
|
141
|
-
wrap
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
159
|
+
view :template_editor do
|
160
|
+
wrap do
|
161
|
+
[
|
162
|
+
wrap_with(:div, "{{", class: "template-editor-left"),
|
163
|
+
wrap_with(:div, class: "template-editor-main") do
|
164
|
+
render_template_editor_frame
|
165
|
+
end,
|
166
|
+
wrap_with(:div, "}}", class: "template-editor-right")
|
167
|
+
]
|
149
168
|
end
|
150
169
|
end
|
151
170
|
|
152
|
-
view :template_editor_frame do
|
153
|
-
|
154
|
-
|
171
|
+
view :template_editor_frame do
|
172
|
+
voo.title = card.label
|
173
|
+
voo.hide :set_label
|
174
|
+
template_frame do
|
175
|
+
_render_core
|
155
176
|
end
|
156
177
|
end
|
157
178
|
|
158
|
-
view :closed_content do
|
179
|
+
view :closed_content do
|
159
180
|
""
|
160
181
|
end
|
161
182
|
|
162
183
|
view :set_navbar do |args|
|
163
|
-
id = "rule-navbar-#{card.cardname.safe_key}-#{
|
184
|
+
id = "rule-navbar-#{card.cardname.safe_key}-#{voo.home_view}"
|
164
185
|
related_sets = card.related_sets(true)
|
165
186
|
return "" if related_sets.size <= 1
|
166
187
|
navbar id, toggle: 'Rules<span class="caret"></span>', toggle_align: :left,
|
167
188
|
class: "slotter toolbar", navbar_type: "inverse",
|
168
189
|
collapsed_content: close_link(class: "pull-right visible-xs") do
|
169
190
|
[
|
170
|
-
|
191
|
+
wrap_with(:span, "Set:", class: "navbar-text hidden-xs"),
|
171
192
|
(wrap_with :ul, class: "nav navbar-nav nav-pills" do
|
172
193
|
related_sets.map do |name, label|
|
173
194
|
slot_opts = { subheader: showname(name),
|
@@ -188,37 +209,44 @@ format :html do
|
|
188
209
|
"<li role='presentation' #{"class='active'" if active}>#{content}</li>"
|
189
210
|
end
|
190
211
|
|
191
|
-
view :rule_navbar do
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
[
|
198
|
-
content_tag(:span, "Rules:", class: "navbar-text hidden-xs"),
|
199
|
-
(wrap_with :ul, class: "nav navbar-nav nav-pills" do
|
200
|
-
[
|
201
|
-
(view_link_pill("field", :field_related_rules, args) if card.junction?),
|
202
|
-
view_link_pill("common", :common_rules, args),
|
203
|
-
view_link_pill("by group", :grouped_rules, args),
|
204
|
-
view_link_pill("by name", :all_rules, args),
|
205
|
-
(view_link_pill("recent", :recent_rules, args) if recently_edited_settings?)
|
206
|
-
]
|
207
|
-
end)
|
208
|
-
]
|
212
|
+
view :rule_navbar do
|
213
|
+
navbar "rule-navbar-#{card.cardname.safe_key}-#{voo.home_view}",
|
214
|
+
toggle: 'Rules<span class="caret"></span>', toggle_align: :left,
|
215
|
+
class: "slotter toolbar", navbar_type: "inverse",
|
216
|
+
collapsed_content: close_link(class: "pull-right visible-xs") do
|
217
|
+
[rule_navbar_heading, rule_navbar_content]
|
209
218
|
end
|
210
219
|
end
|
211
220
|
|
212
|
-
def
|
213
|
-
|
221
|
+
def rule_navbar_heading
|
222
|
+
wrap_with :span, "Rules:", class: "navbar-text hidden-xs"
|
223
|
+
end
|
224
|
+
|
225
|
+
def rule_navbar_pills
|
226
|
+
pills = [["common", :common_rules],
|
227
|
+
["by group", :grouped_rules],
|
228
|
+
["by name", :all_rules]]
|
229
|
+
pills.unshift ["field", :field_related_rules] if card.junction?
|
230
|
+
pills.push ["recent", :recent_rules] if recently_edited_settings?
|
231
|
+
pills
|
232
|
+
end
|
233
|
+
|
234
|
+
def rule_navbar_content
|
235
|
+
wrap_with :ul, class: "nav navbar-nav nav-pills" do
|
236
|
+
rule_navbar_pills.map do |label, symbol|
|
237
|
+
view_link_pill label, symbol
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def view_link_pill name, view
|
243
|
+
selected_view = @selected_rule_navbar_view || @slot_view || voo.home_view
|
214
244
|
link = link_to_view view, name, class: "slotter", role: "pill",
|
215
|
-
path:
|
245
|
+
path: { slot: { show: :rule_navbar } }
|
216
246
|
li_pill link, selected_view == view
|
217
247
|
end
|
218
248
|
end
|
219
249
|
|
220
|
-
include Card::Set::Type::SearchType
|
221
|
-
|
222
250
|
def followed_by? user_id=nil
|
223
251
|
all_members_followed_by? user_id
|
224
252
|
end
|
@@ -256,6 +284,13 @@ def label
|
|
256
284
|
end
|
257
285
|
end
|
258
286
|
|
287
|
+
def uncapitalized_label
|
288
|
+
label = label.to_s
|
289
|
+
return label unless label[0]
|
290
|
+
label[0] = label[0].downcase
|
291
|
+
label
|
292
|
+
end
|
293
|
+
|
259
294
|
def follow_label
|
260
295
|
if (klass = subclass_for_set)
|
261
296
|
klass.follow_label cardname.left
|
@@ -276,17 +311,6 @@ def follow_rule_name user=nil
|
|
276
311
|
end
|
277
312
|
end
|
278
313
|
|
279
|
-
# def to_following_item_name args
|
280
|
-
# left_part = follow_rule_name( args[:user] )
|
281
|
-
# option = args[:option] || if (rule_card = Card.fetch(left_part))
|
282
|
-
# rule_card.content
|
283
|
-
# else
|
284
|
-
# Card[:nothing].name
|
285
|
-
# end
|
286
|
-
#
|
287
|
-
# "#{left_part}+#{option}"
|
288
|
-
# end
|
289
|
-
|
290
314
|
def all_user_ids_with_rule_for setting_code
|
291
315
|
Card.all_user_ids_with_rule_for self, setting_code
|
292
316
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
format do
|
2
2
|
include Phrase::Format
|
3
3
|
|
4
|
-
view :core do
|
5
|
-
link_to_resource _render_raw
|
4
|
+
view :core do
|
5
|
+
link_to_resource _render_raw, render_title
|
6
6
|
end
|
7
7
|
|
8
|
-
view :url_link do
|
9
|
-
link_to_resource _render_raw
|
8
|
+
view :url_link do
|
9
|
+
link_to_resource _render_raw
|
10
10
|
end
|
11
11
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe Card::Content::Chunk::
|
3
|
+
describe Card::Content::Chunk::Nest, "Inclusion" do
|
4
4
|
context "syntax parsing" do
|
5
5
|
before do
|
6
|
-
@class = Card::Content::Chunk::
|
6
|
+
@class = Card::Content::Chunk::Nest
|
7
7
|
end
|
8
8
|
|
9
9
|
let :instance do
|
@@ -18,25 +18,28 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
18
18
|
it "handles visible comments" do
|
19
19
|
expect(render_content("{{# now you see me}}"))
|
20
20
|
.to eq("<!-- # now you see me -->")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "handles weird characters in nest comments" do
|
21
24
|
expect(render_content("{{# -->}}")).to eq("<!-- # --> -->")
|
22
25
|
end
|
23
26
|
|
24
27
|
it "handles empty nests" do
|
25
28
|
@chunk = "{{ }}"
|
26
29
|
expect(name).to eq("")
|
27
|
-
expect(options[:
|
30
|
+
expect(options[:nest_syntax]).to eq(" ")
|
28
31
|
end
|
29
32
|
|
30
33
|
it "handles empty nests with pipe" do
|
31
34
|
@chunk = "{{|}}"
|
32
35
|
expect(name).to eq("")
|
33
|
-
expect(options[:
|
36
|
+
expect(options[:nest_syntax]).to eq("|")
|
34
37
|
end
|
35
38
|
|
36
39
|
it "handles no pipes" do
|
37
40
|
@chunk = "{{toy}}"
|
38
41
|
expect(name).to eq("toy")
|
39
|
-
expect(options[:
|
42
|
+
expect(options[:nest_name]).to eq("toy")
|
40
43
|
expect(options.key?(:view)).to eq(false)
|
41
44
|
end
|
42
45
|
|
@@ -58,7 +61,7 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
58
61
|
|
59
62
|
it "handles single pipe" do
|
60
63
|
@chunk = "{{toy|view:link;hide:me}}"
|
61
|
-
expect(options[:
|
64
|
+
expect(options[:nest_name]).to eq("toy")
|
62
65
|
expect(options[:view]).to eq("link")
|
63
66
|
expect(options[:hide]).to eq("me")
|
64
67
|
expect(options.key?(:items)).to eq(false)
|
@@ -66,7 +69,7 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
66
69
|
|
67
70
|
it "handles multiple pipes" do
|
68
71
|
@chunk = "{{box|open|closed}}"
|
69
|
-
expect(options[:
|
72
|
+
expect(options[:nest_name]).to eq("box")
|
70
73
|
expect(options[:view]).to eq("open")
|
71
74
|
expect(options[:items][:view]).to eq("closed")
|
72
75
|
expect(options[:items].key?(:items)).to eq(false)
|
@@ -74,14 +77,14 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
74
77
|
|
75
78
|
it "handles multiple pipes with blank lists" do
|
76
79
|
@chunk = "{{box||closed}}"
|
77
|
-
expect(options[:
|
80
|
+
expect(options[:nest_name]).to eq("box")
|
78
81
|
expect(options[:view]).to eq(nil)
|
79
82
|
expect(options[:items][:view]).to eq("closed")
|
80
83
|
end
|
81
84
|
|
82
85
|
it "treats :item as view of next level" do
|
83
86
|
@chunk = "{{toy|link;item:name}}"
|
84
|
-
expect(options[:
|
87
|
+
expect(options[:nest_name]).to eq("toy")
|
85
88
|
expect(options[:view]).to eq("link")
|
86
89
|
expect(options[:items][:view]).to eq("name")
|
87
90
|
end
|
@@ -165,7 +168,7 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
165
168
|
it "handles structured cards" do
|
166
169
|
create!("age")
|
167
170
|
Card["*template"]
|
168
|
-
specialtype = Card.create type_code:
|
171
|
+
specialtype = Card.create type_code: :cardtype, name: "SpecialType"
|
169
172
|
specialtype_template = specialtype.fetch(trait: :type, new: {})
|
170
173
|
.fetch(trait: :structure, new: {})
|
171
174
|
specialtype_template.content = "{{#{Card::Name.joint}age}}"
|
@@ -178,26 +181,5 @@ describe Card::Content::Chunk::Include, "Inclusion" do
|
|
178
181
|
expect(wooga_age.format.render_core).to eq("39")
|
179
182
|
expect(wooga_age.includers.map(&:name)).to eq(["Wooga"])
|
180
183
|
end
|
181
|
-
|
182
|
-
it "handles shading" do
|
183
|
-
create! "Alpha", "Pooey"
|
184
|
-
create! "Beta", "{{Alpha|shade:off}}"
|
185
|
-
r = create!("Bee", "{{Alpha|shade:off}}").format.render_core
|
186
|
-
assert_view_select r, 'div[style~="shade:off;"]' do
|
187
|
-
assert_select "div[class~=card-content]", "Pooey"
|
188
|
-
end
|
189
|
-
r = create!("Cee", "{{Alpha| shade: off }}").format.render_core
|
190
|
-
assert_view_select r, 'div[style~="shade:off;"]' do
|
191
|
-
assert_select "div[class~=card-content]", "Pooey"
|
192
|
-
end
|
193
|
-
r = create!("Dee", "{{Alpha| shade:off }}").format.render_core
|
194
|
-
assert_view_select r, 'div[style~="shade:off;"]' do
|
195
|
-
assert_select 'div[class~="card-content"]', "Pooey"
|
196
|
-
end
|
197
|
-
r = create!("Eee", "{{Alpha| shade:on }}").format.render_core
|
198
|
-
assert_view_select r, 'div[style~="shade:on;"]' do
|
199
|
-
assert_select 'div[class~="card-content"]', "Pooey"
|
200
|
-
end
|
201
|
-
end
|
202
184
|
end
|
203
185
|
end
|