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
@@ -2,117 +2,110 @@ def show_comment_box_in_related?
|
|
2
2
|
false
|
3
3
|
end
|
4
4
|
|
5
|
+
def help_rule_card
|
6
|
+
setting = new_card? ? [:add_help, { fallback: :help }] : :help
|
7
|
+
help_card = rule_card(*setting)
|
8
|
+
help_card if help_card && help_card.ok?(:read)
|
9
|
+
end
|
10
|
+
|
5
11
|
format :html do
|
6
12
|
def show view, args
|
7
|
-
|
8
|
-
args[:view] = view if view
|
9
|
-
@main_opts = args
|
10
|
-
render :layout
|
11
|
-
else
|
12
|
-
view ||= args[:home_view] || :open
|
13
|
-
@nest_opts = (args[:items] || {}).clone
|
14
|
-
render view, args
|
15
|
-
end
|
13
|
+
send "show_#{show_layout? ? :with : :without}_layout", view, args
|
16
14
|
end
|
17
15
|
|
18
16
|
def show_layout?
|
19
17
|
!Env.ajax? || params[:layout]
|
20
18
|
end
|
21
19
|
|
22
|
-
view
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
def show_with_layout view, args
|
21
|
+
args[:view] = view if view
|
22
|
+
@main = false
|
23
|
+
@main_opts = args
|
24
|
+
render :layout, title: params[:layout]
|
25
|
+
# FIXME: using title because it's a standard view option. hack!
|
28
26
|
end
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
def show_without_layout view, args
|
29
|
+
@main = true if params[:is_main] || args[:main]
|
30
|
+
view ||= args[:home_view] || :open
|
31
|
+
render view, args
|
32
|
+
end
|
33
|
+
|
34
|
+
view :layout, perms: :none do
|
35
|
+
layout = process_content get_layout_content(voo.title),
|
36
|
+
content_opts: { chunk_list: :references }
|
37
|
+
output [layout, _render_modal_slot]
|
38
|
+
end
|
39
|
+
|
40
|
+
view :content do
|
41
|
+
class_up "card-slot", "card-content"
|
42
|
+
voo.hide :menu
|
43
|
+
wrap { [_optional_render_menu, _render_core] }
|
37
44
|
end
|
38
45
|
|
39
|
-
view :content_panel do
|
40
|
-
|
46
|
+
view :content_panel do
|
47
|
+
class_up "card-slot", "card-content panel panel-default"
|
48
|
+
voo.hide :menu
|
49
|
+
wrap do
|
41
50
|
wrap_with :div, class: "panel-body" do
|
42
|
-
[
|
43
|
-
_optional_render(:menu, args, :hide),
|
44
|
-
_render_core(args)
|
45
|
-
].join("\n")
|
51
|
+
[_optional_render_menu, _render_core]
|
46
52
|
end
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
50
|
-
view :titled, tags: :comment do
|
51
|
-
|
56
|
+
view :titled, tags: :comment do
|
57
|
+
@content_body = true
|
58
|
+
wrap do
|
52
59
|
[
|
53
|
-
|
54
|
-
_render_header
|
55
|
-
wrap_body
|
56
|
-
|
60
|
+
_optional_render_menu,
|
61
|
+
_render_header,
|
62
|
+
wrap_body { _render_core },
|
63
|
+
optional_render_comment_box
|
57
64
|
]
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
61
|
-
view :labeled do
|
62
|
-
|
68
|
+
view :labeled do
|
69
|
+
class_up "card-body", "closed-content"
|
70
|
+
@content_body = true
|
71
|
+
wrap do
|
63
72
|
[
|
64
|
-
|
65
|
-
|
66
|
-
wrap_body
|
67
|
-
_render_closed_content
|
73
|
+
_optional_render_menu,
|
74
|
+
wrap_with(:label, _render_title),
|
75
|
+
wrap_body do
|
76
|
+
_render_closed_content
|
68
77
|
end
|
69
78
|
]
|
70
79
|
end
|
71
80
|
end
|
72
81
|
|
73
|
-
view :title do
|
74
|
-
title = fancy_title
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
title
|
82
|
+
view :title do
|
83
|
+
title = fancy_title super()
|
84
|
+
if show_view? :title_link, :hide
|
85
|
+
title = _render_title_link title_ready: title
|
86
|
+
end
|
79
87
|
add_name_context
|
80
88
|
title
|
81
89
|
end
|
82
90
|
|
83
91
|
view :title_link do |args|
|
84
|
-
title_text = args[:title_ready] || showname(
|
92
|
+
title_text = args[:title_ready] || showname(voo.title)
|
85
93
|
link_to_card card.cardname, title_text
|
86
94
|
end
|
87
95
|
|
88
96
|
view :type_info do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
view :title_editable do |args|
|
94
|
-
links = card.cardname.parts.map { |name| link_to_card name }
|
95
|
-
res = links.shift
|
96
|
-
links.each_with_index do |link, index|
|
97
|
-
name = card.cardname.parts[0..index + 1].join "+"
|
98
|
-
res += link_to_card name, glyphicon("plus", "header-icon")
|
99
|
-
res += link
|
97
|
+
return unless show_view?(:toolbar, :hide) && card.type_code != :basic
|
98
|
+
wrap_with :span, class: "type-info pull-right" do
|
99
|
+
link_to_card card.type_name, nil, class: "navbar-link"
|
100
100
|
end
|
101
|
-
res += " "
|
102
|
-
res.concat link_to_view(
|
103
|
-
:edit_name, glyphicon("edit", "header-icon"),
|
104
|
-
class: "slotter", "data-toggle" => "tooltip", title: "edit name"
|
105
|
-
)
|
106
|
-
res.concat _optional_render(:type_link, args, :show)
|
107
101
|
end
|
108
102
|
|
109
|
-
view :open, tags: :comment do
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
]
|
103
|
+
view :open, tags: :comment do
|
104
|
+
voo.show! :toolbar if toolbar_pinned?
|
105
|
+
voo.viz :toggle, (main? ? :hide : :show)
|
106
|
+
@content_body = true
|
107
|
+
frame do
|
108
|
+
[_render_open_content, optional_render_comment_box]
|
116
109
|
end
|
117
110
|
end
|
118
111
|
|
@@ -125,26 +118,22 @@ format :html do
|
|
125
118
|
link_to_card card.type_card, nil, class: klasses
|
126
119
|
end
|
127
120
|
|
128
|
-
view :closed do
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
) do
|
136
|
-
_optional_render :closed_content, args
|
137
|
-
end
|
121
|
+
view :closed do
|
122
|
+
voo.show :toggle
|
123
|
+
voo.hide! :toolbar
|
124
|
+
class_up "card-body", "closed-content"
|
125
|
+
@content_body = true
|
126
|
+
@toggle_mode = :close
|
127
|
+
frame { _optional_render :closed_content }
|
138
128
|
end
|
139
129
|
|
140
|
-
view :change do
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
]
|
130
|
+
view :change do
|
131
|
+
voo.show :title_link
|
132
|
+
voo.hide :menu
|
133
|
+
wrap do
|
134
|
+
[_optional_render_title,
|
135
|
+
_optional_render_menu,
|
136
|
+
_optional_render_last_action]
|
148
137
|
end
|
149
138
|
end
|
150
139
|
|
@@ -157,60 +146,51 @@ format :html do
|
|
157
146
|
Card.fetch(set_name)
|
158
147
|
end
|
159
148
|
|
149
|
+
# subheader = with_name_context(card.name) do
|
150
|
+
# subformat(rcard)._render_title(args)
|
151
|
+
# end
|
152
|
+
|
160
153
|
view :related do |args|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
154
|
+
related_card, options = related_card_and_options args
|
155
|
+
return unless related_card
|
156
|
+
voo.show :toolbar, :menu, :help
|
157
|
+
frame do
|
158
|
+
voo.hide :header, :toggle
|
159
|
+
nest related_card, options
|
165
160
|
end
|
166
161
|
end
|
167
162
|
|
168
|
-
def
|
169
|
-
|
170
|
-
return unless
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
163
|
+
def related_card_and_options args
|
164
|
+
options = (args[:related] || params[:related]).symbolize_keys
|
165
|
+
return unless options
|
166
|
+
related_card = related_card_from_options options
|
167
|
+
options[:view] ||= :open
|
168
|
+
options[:show] ||= []
|
169
|
+
options[:show] << :comment_box if related_card.show_comment_box_in_related?
|
170
|
+
[related_card, options]
|
171
|
+
end
|
175
172
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
end
|
197
|
-
|
198
|
-
view :help, tags: :unknown_ok do |args|
|
199
|
-
text = args[:help_text] || begin
|
200
|
-
setting = card.new_card? ? [:add_help, { fallback: :help }] : :help
|
201
|
-
help_card = card.rule_card(*setting)
|
202
|
-
if help_card && help_card.ok?(:read)
|
203
|
-
with_nest_mode :normal do
|
204
|
-
raw_help_content = _render_raw args.merge(structure: help_card.name)
|
205
|
-
process_content raw_help_content, content_opts:
|
206
|
-
{ chunk_list: :references }
|
207
|
-
# render help card with current card's format
|
208
|
-
# so current card's context is used in help card nests
|
209
|
-
end
|
210
|
-
end
|
173
|
+
def related_card_from_options options
|
174
|
+
related_card = options.delete :card
|
175
|
+
return related_card if related_card
|
176
|
+
related_name = options.delete(:name).to_name.to_absolute_name card.cardname
|
177
|
+
Card.fetch related_name, new: {}
|
178
|
+
end
|
179
|
+
|
180
|
+
view :help, tags: :unknown_ok do
|
181
|
+
help_text = voo.help || rule_based_help
|
182
|
+
return "" unless help_text.present?
|
183
|
+
wrap_with :div, help_text, class: classy("help-text")
|
184
|
+
end
|
185
|
+
|
186
|
+
def rule_based_help
|
187
|
+
return "" unless (rule_card = card.help_rule_card)
|
188
|
+
with_nest_mode :normal do
|
189
|
+
process_content _render_raw(structure: rule_card.name),
|
190
|
+
content_opts: { chunk_list: :references }
|
191
|
+
# render help card with current card's format
|
192
|
+
# so current card's context is used in help card nests
|
211
193
|
end
|
212
|
-
klass = [args[:help_class], "help-text"].compact * " "
|
213
|
-
%(<div class="#{klass}">#{raw text}</div>) if text
|
214
194
|
end
|
215
195
|
|
216
196
|
view :last_action do
|
@@ -236,9 +216,13 @@ format :html do
|
|
236
216
|
|
237
217
|
private
|
238
218
|
|
239
|
-
def fancy_title title=nil
|
240
|
-
|
241
|
-
|
242
|
-
|
219
|
+
def fancy_title title=nil
|
220
|
+
wrap_with :span, class: classy("card-title") do
|
221
|
+
showname(title).to_name.parts.join fancy_joint
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def fancy_joint
|
226
|
+
wrap_with :span, "+", classy("joint")
|
243
227
|
end
|
244
228
|
end
|
@@ -1,240 +1,177 @@
|
|
1
1
|
format :html do
|
2
2
|
###---( TOP_LEVEL (used by menu) NEW / EDIT VIEWS )
|
3
|
-
|
4
|
-
|
5
|
-
frame_and_form :
|
3
|
+
view :edit, perms: :update, tags: :unknown_ok, cache: :never do
|
4
|
+
voo.show :toolbar, :help
|
5
|
+
frame_and_form :update do
|
6
6
|
[
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
_optional_render(:button_formgroup, args)
|
7
|
+
edit_view_hidden,
|
8
|
+
_optional_render_content_formgroup,
|
9
|
+
_optional_render_edit_buttons
|
11
10
|
]
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
|
17
|
-
hidden[:success] ||= card.rule(:thanks) || "_self"
|
18
|
-
hidden[:card] ||= {}
|
19
|
-
|
20
|
-
args[:optional_help] ||= :show
|
21
|
-
|
22
|
-
default_new_args_for_name_field_or_title args
|
23
|
-
default_new_args_for_type_field args
|
24
|
-
default_new_args_buttons args
|
14
|
+
def edit_view_hidden
|
15
|
+
# for override
|
25
16
|
end
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# name is ready and will show up in title
|
31
|
-
hidden[:card][:name] ||= card.name
|
32
|
-
else
|
33
|
-
args[:title] ||= generic_new_card_title
|
34
|
-
# FIXME: - overrides nest args
|
35
|
-
unless card.rule_card :autoname
|
36
|
-
# prompt for name
|
37
|
-
hidden[:name_prompt] = true unless hidden.key? :name_prompt
|
38
|
-
args[:optional_name_formgroup] ||= :show
|
39
|
-
end
|
18
|
+
view :edit_buttons do
|
19
|
+
button_formgroup do
|
20
|
+
[standard_submit_button, standard_cancel_button]
|
40
21
|
end
|
41
|
-
args[:optional_name_formgroup] ||= :hide
|
42
22
|
end
|
43
23
|
|
44
|
-
def
|
45
|
-
|
46
|
-
"New"
|
47
|
-
else
|
48
|
-
"New #{card.type_name}"
|
49
|
-
end
|
24
|
+
def standard_submit_button
|
25
|
+
submit_button class: "submit-button"
|
50
26
|
end
|
51
27
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
else
|
56
|
-
args[:hidden][:card][:type_id] ||= card.type_id
|
57
|
-
args[:optional_type_formgroup] = :hide
|
58
|
-
end
|
28
|
+
def standard_cancel_button href=nil
|
29
|
+
href ||= path
|
30
|
+
cancel_button class: "cancel-button", href: href
|
59
31
|
end
|
60
32
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
33
|
+
view :edit_name, perms: :update do
|
34
|
+
voo.show :toolbar
|
35
|
+
frame_and_form({ action: :update, id: card.id },
|
36
|
+
"main-success" => "REDIRECT") do
|
37
|
+
[hidden_edit_name_fields,
|
38
|
+
_optional_render_name_formgroup,
|
39
|
+
rename_confirmation_alert,
|
40
|
+
edit_name_buttons]
|
41
|
+
end
|
65
42
|
end
|
66
43
|
|
67
|
-
def
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
cancel_button(class: "create-cancel-button", href: cancel_path)
|
72
|
-
].join "\n"
|
44
|
+
def hidden_edit_name_fields
|
45
|
+
hidden_tags success: "_self",
|
46
|
+
old_name: card.name,
|
47
|
+
card: { update_referers: false }
|
73
48
|
end
|
74
49
|
|
75
|
-
|
76
|
-
|
77
|
-
[
|
78
|
-
_optional_render(:content_formgroup, args),
|
79
|
-
_optional_render(:button_formgroup, args)
|
80
|
-
]
|
50
|
+
def edit_name_buttons
|
51
|
+
button_formgroup do
|
52
|
+
[rename_and_update_button, rename_button, standard_cancel_button]
|
81
53
|
end
|
82
54
|
end
|
83
55
|
|
84
|
-
def
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
args[:buttons] ||= %(
|
89
|
-
#{submit_button class: 'submit-button'}
|
90
|
-
#{cancel_button href: (args[:cancel_path] || path),
|
91
|
-
class: 'cancel-button',
|
92
|
-
'data-slot-selector' => args[:cancel_slot_selector]}
|
93
|
-
)
|
56
|
+
def rename_and_update_button
|
57
|
+
submit_button text: "Rename and Update", disable_with: "Renaming",
|
58
|
+
class: "renamer-updater"
|
94
59
|
end
|
95
60
|
|
96
|
-
|
97
|
-
|
98
|
-
{ action: :update, id: card.id }, args, "main-success" => "REDIRECT"
|
99
|
-
) do
|
100
|
-
[
|
101
|
-
_render_name_formgroup(args),
|
102
|
-
_optional_render(:confirm_rename, args),
|
103
|
-
_optional_render(:button_formgroup, args)
|
104
|
-
]
|
105
|
-
end
|
61
|
+
def rename_button
|
62
|
+
button_tag "Rename", data: { disable_with: "Renaming" }, class: "renamer"
|
106
63
|
end
|
107
64
|
|
108
|
-
|
109
|
-
referers = args[:referers]
|
110
|
-
descendants = card.descendants
|
65
|
+
def rename_confirmation_alert
|
111
66
|
msg = "<h5>Are you sure you want to rename <em>#{card.name}</em>?</h5>"
|
112
|
-
|
113
|
-
msg << rename_info(referers, descendants)
|
114
|
-
end
|
67
|
+
msg << rename_effects_and_options
|
115
68
|
alert("warning") { msg }
|
116
69
|
end
|
117
70
|
|
118
|
-
def
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
if referers.any? # FIXME: count, don't instantiate
|
125
|
-
count = referers.size
|
126
|
-
refs = count == 1 ? "reference" : "references"
|
127
|
-
effects << "affect at least #{count} #{refs} to \"#{card.name}\""
|
128
|
-
options = "You may choose to <em>update or ignore</em> the referers."
|
129
|
-
end
|
130
|
-
effects = effects.map { |effect| "<li>#{effect}</li>" }.join("")
|
131
|
-
"<h6>This change will...</h6><ul>#{effects}</ul><p>#{options}</p>"
|
132
|
-
end
|
133
|
-
|
134
|
-
def default_edit_name_args args
|
135
|
-
referers = args[:referers] = card.family_referers
|
136
|
-
args[:hidden] ||= {}
|
137
|
-
args[:hidden].reverse_merge!(
|
138
|
-
success: "_self",
|
139
|
-
old_name: card.name,
|
140
|
-
referers: referers.size, # FIXME: count, don't instantiate
|
141
|
-
card: { update_referers: false }
|
142
|
-
)
|
143
|
-
args[:optional_toolbar] ||= :show
|
144
|
-
args[:buttons] = default_rename_buttons
|
71
|
+
def rename_effects_and_options
|
72
|
+
descendant_effect = rename_descendant_effect
|
73
|
+
referer_effect, referer_option = rename_referer_effect_and_option
|
74
|
+
effects = [descendant_effect, referer_effect].compact
|
75
|
+
return "" if effects.empty?
|
76
|
+
format_rename_effects_and_options effects, referer_option
|
145
77
|
end
|
146
78
|
|
147
|
-
def
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
79
|
+
def format_rename_effects_and_options effects, referer_option
|
80
|
+
effects = effects.map { |effect| "<li>#{effect}</li>" }.join
|
81
|
+
info = %(<h6>This change will...</h6>)
|
82
|
+
info += %(<ul>#{effects}</ul>)
|
83
|
+
info += %(<p>#{referer_option}</p>) if referer_option
|
84
|
+
info
|
153
85
|
end
|
154
86
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
87
|
+
def rename_descendant_effect
|
88
|
+
descendants = card.descendants
|
89
|
+
return unless descendants.any? # FIXME: count, don't instantiate
|
90
|
+
"automatically alter #{descendants.size} related name(s)."
|
91
|
+
end
|
92
|
+
|
93
|
+
def rename_referer_effect_and_option
|
94
|
+
referers = card.family_referers
|
95
|
+
return unless referers.any? # FIXME: count, don't instantiate
|
96
|
+
count = referers.size
|
97
|
+
refs = count == 1 ? "reference" : "references"
|
98
|
+
effect = "affect at least #{count} #{refs} to \"#{card.name}\""
|
99
|
+
effect += hidden_field_tag(:referers, count)
|
100
|
+
option = "You may choose to <em>update or ignore</em> the referers."
|
101
|
+
[effect, option]
|
102
|
+
end
|
103
|
+
|
104
|
+
view :edit_type, cache: :never, perms: :update do
|
105
|
+
voo.show :toolbar
|
106
|
+
frame_and_form :update do
|
159
107
|
[
|
160
|
-
|
161
|
-
|
108
|
+
hidden_edit_type_fields,
|
109
|
+
_render_type_formgroup,
|
110
|
+
edit_type_buttons
|
162
111
|
]
|
163
112
|
end
|
164
113
|
end
|
165
114
|
|
166
|
-
def
|
167
|
-
|
168
|
-
args[:optional_toolbar] ||= :show
|
169
|
-
args[:hidden] ||= { success: { view: :edit } }
|
170
|
-
args[:buttons] = [
|
171
|
-
submit_button, cancel_button(href: path(view: :edit))
|
172
|
-
].join "\n"
|
173
|
-
end
|
174
|
-
|
175
|
-
view :edit_rules, tags: :unknown_ok do |args|
|
176
|
-
view = args[:rule_view] || :common_rules
|
177
|
-
slot_args =
|
178
|
-
{
|
179
|
-
rule_view: view,
|
180
|
-
optional_set_navbar: :show,
|
181
|
-
optional_set_label: :hide,
|
182
|
-
optional_rule_navbar: :hide
|
183
|
-
}
|
184
|
-
_render_related args.merge(
|
185
|
-
related: { card: current_set_card, view: :open, slot: slot_args }
|
186
|
-
)
|
115
|
+
def hidden_edit_type_fields
|
116
|
+
hidden_field_tag "success[view]", "edit"
|
187
117
|
end
|
188
118
|
|
189
|
-
def
|
190
|
-
|
119
|
+
def edit_type_buttons
|
120
|
+
cancel_path = path view: :edit
|
121
|
+
button_formgroup do
|
122
|
+
[standard_submit_button, standard_cancel_button(cancel_path)]
|
123
|
+
end
|
191
124
|
end
|
192
125
|
|
193
|
-
|
194
|
-
|
126
|
+
view :edit_rules, cache: :never, tags: :unknown_ok do |args|
|
127
|
+
voo.show :set_navbar, :toolbar
|
128
|
+
voo.hide :set_label, :rule_navbar
|
195
129
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
optional_edit_toolbar: :hide,
|
202
|
-
hidden: { success: { view: :open, "slot[subframe]" => true } }
|
130
|
+
_render_related args.merge(
|
131
|
+
related: {
|
132
|
+
card: current_set_card,
|
133
|
+
view: :open,
|
134
|
+
slot: { rule_view: (args[:rule_view] || :common_rules) }
|
203
135
|
}
|
204
|
-
render_related args.merge(
|
205
|
-
related: { card: card.structure, view: :edit, slot: slot_args }
|
206
136
|
)
|
207
137
|
end
|
208
138
|
|
209
|
-
|
210
|
-
|
139
|
+
view :edit_structure, cache: :never do |args|
|
140
|
+
voo.show :toolbar
|
141
|
+
render_related args.merge(
|
142
|
+
related: {
|
143
|
+
card: card.structure,
|
144
|
+
view: :edit
|
145
|
+
}
|
146
|
+
# FIXME: this stuff:
|
147
|
+
# slot: {
|
148
|
+
# cancel_slot_selector: ".card-slot.related-view",
|
149
|
+
# cancel_path: card.format.path(view: :edit), hide: :edit_toolbar,
|
150
|
+
# hidden: { success: { view: :open, "slot[subframe]" => true } }
|
151
|
+
# }
|
152
|
+
# }
|
153
|
+
)
|
211
154
|
end
|
212
155
|
|
213
|
-
view :edit_nests do
|
214
|
-
|
156
|
+
view :edit_nests, cache: :never do
|
157
|
+
voo.show :toolbar
|
158
|
+
frame do
|
215
159
|
with_nest_mode :edit do
|
216
|
-
process_nested_fields
|
160
|
+
process_nested_fields hide: :toolbar
|
217
161
|
end
|
218
162
|
end
|
219
163
|
end
|
220
|
-
def default_edit_nests_args args
|
221
|
-
args[:optional_toolbar] ||= :show
|
222
|
-
end
|
223
164
|
|
224
|
-
view :edit_nest_rules do |args|
|
165
|
+
view :edit_nest_rules, cache: :never do |args|
|
166
|
+
voo.show :toolbar
|
225
167
|
view = args[:rule_view] || :field_related_rules
|
226
|
-
frame
|
168
|
+
frame do
|
227
169
|
# with_nest_mode :edit do
|
228
|
-
nested_fields
|
229
|
-
nest Card.fetch(
|
230
|
-
view: :titled, title:
|
231
|
-
|
232
|
-
optional_rule_navbar: :show
|
170
|
+
nested_fields.map do |name, _options|
|
171
|
+
nest Card.fetch(name.to_name.trait(:self)),
|
172
|
+
view: :titled, title: name, rule_view: view,
|
173
|
+
hide: :set_label, show: :rule_navbar
|
233
174
|
end
|
234
175
|
end
|
235
176
|
end
|
236
|
-
|
237
|
-
def default_edit_nest_rules_args args
|
238
|
-
args[:optional_toolbar] ||= :show
|
239
|
-
end
|
240
177
|
end
|