card 1.19.6 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -5,69 +5,94 @@ include File::SelectedAction
|
|
5
5
|
format do
|
6
6
|
include File::Format
|
7
7
|
|
8
|
-
view :closed_content do
|
8
|
+
view :closed_content do
|
9
9
|
_render_core size: :icon
|
10
10
|
end
|
11
11
|
|
12
|
-
view :source do
|
12
|
+
view :source, cache: :never do
|
13
|
+
determine_image_size
|
14
|
+
source_url
|
15
|
+
end
|
16
|
+
|
17
|
+
def source_url
|
13
18
|
return card.raw_content if card.web?
|
14
|
-
|
15
|
-
case
|
16
|
-
when @mode == :closed then :icon
|
17
|
-
when args[:size] then args[:size].to_sym
|
18
|
-
when main? then :large
|
19
|
-
else :medium
|
20
|
-
end
|
21
|
-
style = :original if style.to_sym == :full
|
22
|
-
if style == :original
|
19
|
+
if voo.size == :original
|
23
20
|
card.image.url
|
24
21
|
else
|
25
|
-
card.image.versions[
|
22
|
+
card.image.versions[voo.size.to_sym].url
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_core_args _args={}
|
27
|
+
determine_image_size
|
28
|
+
end
|
29
|
+
|
30
|
+
def determine_image_size
|
31
|
+
voo.size =
|
32
|
+
case
|
33
|
+
when @mode == :closed then :icon
|
34
|
+
when voo.size then voo.size.to_sym
|
35
|
+
when main? then :large
|
36
|
+
else :medium
|
26
37
|
end
|
38
|
+
voo.size = :original if voo.size == :full
|
27
39
|
end
|
28
40
|
end
|
29
41
|
|
42
|
+
|
30
43
|
format :html do
|
31
44
|
include File::HtmlFormat
|
32
45
|
|
33
|
-
view :core do
|
34
|
-
handle_source
|
46
|
+
view :core, cache: :never do
|
47
|
+
handle_source do |source|
|
35
48
|
if source == "missing"
|
36
49
|
"<!-- image missing #{@card.name} -->"
|
37
50
|
else
|
38
|
-
image_tag
|
51
|
+
image_tag source
|
39
52
|
end
|
40
53
|
end
|
41
54
|
end
|
42
55
|
|
43
|
-
def preview
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
56
|
+
def preview
|
57
|
+
return unless card.new_card? && !card.preliminary_upload?
|
58
|
+
voo.size = :medium
|
59
|
+
wrap_with :div, class: "attachment-preview",
|
60
|
+
id: "#{card.attachment.filename}-preview" do
|
61
|
+
_render_core
|
48
62
|
end
|
49
63
|
end
|
50
64
|
|
65
|
+
def show_action_content_toggle? action, view_type
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
51
69
|
view :content_changes do |args|
|
52
|
-
|
53
|
-
size = args[:diff_type] == :summary ? :icon : :medium
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
70
|
+
action = args[:action]
|
71
|
+
voo.size = args[:diff_type] == :summary ? :icon : :medium
|
72
|
+
[old_image(action, args), new_image(action)].compact.join
|
73
|
+
end
|
74
|
+
|
75
|
+
def old_image action, args
|
76
|
+
return if args[:hide_diff] || !action
|
77
|
+
return unless (last_change = card.last_change_on(:db_content, before: action))
|
78
|
+
card.with_selected_action_id last_change.card_action_id do
|
79
|
+
Card::Content::Diff.render_deleted_chunk _render_core
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def new_image action
|
84
|
+
card.with_selected_action_id action.id do
|
85
|
+
Card::Content::Diff.render_added_chunk _render_core
|
58
86
|
end
|
59
|
-
card.selected_action_id = args[:action].id
|
60
|
-
out << Card::Content::Diff.render_added_chunk(_render_core(size: size))
|
61
|
-
out
|
62
87
|
end
|
63
88
|
end
|
64
89
|
|
65
90
|
format :css do
|
66
|
-
view :core do
|
91
|
+
view :core do
|
67
92
|
render_source
|
68
93
|
end
|
69
94
|
|
70
|
-
view :content do
|
95
|
+
view :content do # why is this necessary?
|
71
96
|
render_core
|
72
97
|
end
|
73
98
|
end
|
@@ -75,12 +100,12 @@ end
|
|
75
100
|
format :file do
|
76
101
|
include File::FileFormat
|
77
102
|
|
78
|
-
|
79
|
-
["", "full"].member?(
|
103
|
+
def image_style
|
104
|
+
["", "full"].member?(params[:size].to_s) ? :original : params[:size].to_sym
|
80
105
|
end
|
81
106
|
|
82
107
|
def selected_file_version
|
83
|
-
style =
|
108
|
+
style = voo.size = image_style.to_sym
|
84
109
|
if style && style != :original
|
85
110
|
card.attachment.versions[style]
|
86
111
|
else
|
@@ -66,10 +66,10 @@ describe Card::Set::Type::Image do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe "view:
|
69
|
+
describe "view: content changes" do
|
70
70
|
it "gets image url" do
|
71
|
-
render_args = {
|
72
|
-
act_summary = subject.format.render :
|
71
|
+
render_args = { action: subject.last_action, diff_type: :expanded }
|
72
|
+
act_summary = subject.format.render :content_changes, render_args
|
73
73
|
current_url = subject.image.versions[:medium].url
|
74
74
|
expect(act_summary).to match(/#{Regexp.quote current_url}/)
|
75
75
|
end
|
data/mod/core/chunk/link.rb
CHANGED
@@ -6,19 +6,7 @@ class Card
|
|
6
6
|
class Content
|
7
7
|
module Chunk
|
8
8
|
# Handler for nest chunks: {{example}}
|
9
|
-
class
|
10
|
-
cattr_reader :options
|
11
|
-
@@options = ::Set.new [
|
12
|
-
:inc_name, # name as used in nest
|
13
|
-
:inc_syntax, # full nest syntax
|
14
|
-
:items, # handles pipe-based recursion
|
15
|
-
|
16
|
-
# _conventional options_
|
17
|
-
:view, :type, :title, :params, :variant,
|
18
|
-
:size, # images only
|
19
|
-
:hide, :show, # affects optional rendering
|
20
|
-
:structure # override raw_content
|
21
|
-
]
|
9
|
+
class Nest < Reference
|
22
10
|
attr_reader :options
|
23
11
|
DEFAULT_OPTION = :view # a value without a key is interpreted as view
|
24
12
|
|
@@ -33,8 +21,8 @@ class Card
|
|
33
21
|
if name =~ /^\#/
|
34
22
|
@process_chunk = name =~ /^\#\#/ ? "" : visible_comment(in_brackets)
|
35
23
|
else
|
36
|
-
@options = interpret_options.merge
|
37
|
-
|
24
|
+
@options = interpret_options.merge nest_name: name,
|
25
|
+
nest_syntax: in_brackets
|
38
26
|
@name = name
|
39
27
|
end
|
40
28
|
end
|
@@ -58,33 +46,24 @@ class Card
|
|
58
46
|
|
59
47
|
def interpret_piped_options list_string, items
|
60
48
|
options_hash = items.nil? ? {} : { items: items }
|
61
|
-
|
62
|
-
option_string_to_hash list_string, options_hash, style_hash
|
63
|
-
style_hash_to_string options_hash, style_hash
|
49
|
+
option_string_to_hash list_string, options_hash
|
64
50
|
options_hash
|
65
51
|
end
|
66
52
|
|
67
|
-
def option_string_to_hash list_string, options_hash
|
53
|
+
def option_string_to_hash list_string, options_hash
|
68
54
|
each_option(list_string) do |key, value|
|
69
55
|
key = key.to_sym
|
70
56
|
if key == :item
|
71
57
|
options_hash[:items] ||= {}
|
72
58
|
options_hash[:items][:view] = value
|
73
|
-
elsif
|
59
|
+
elsif Card::View::Options.nest_keys.include? key
|
74
60
|
options_hash[key] = value
|
75
|
-
|
76
|
-
|
61
|
+
# else
|
62
|
+
# handle other keys
|
77
63
|
end
|
78
64
|
end
|
79
65
|
end
|
80
66
|
|
81
|
-
def style_hash_to_string options_hash, style_hash
|
82
|
-
return if style_hash.empty?
|
83
|
-
options_hash[:style] = style_hash.map do |key, value|
|
84
|
-
CGI.escapeHTML "#{key}:#{value};"
|
85
|
-
end * ""
|
86
|
-
end
|
87
|
-
|
88
67
|
def inspect
|
89
68
|
"<##{self.class}:n[#{@name}] p[#{@process_chunk}] txt:#{@text}>"
|
90
69
|
end
|
data/mod/core/chunk/reference.rb
CHANGED
@@ -7,12 +7,11 @@ class Card
|
|
7
7
|
|
8
8
|
def referee_name
|
9
9
|
return if name.nil?
|
10
|
-
@referee_name ||=
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
10
|
+
@referee_name ||= begin
|
11
|
+
rendered_name = render_obj(name)
|
12
|
+
ref_card = fetch_referee_card rendered_name
|
13
|
+
ref_card ? ref_card.cardname : rendered_name.to_name
|
14
|
+
end
|
16
15
|
@referee_name = @referee_name.to_absolute(card.cardname).to_name
|
17
16
|
end
|
18
17
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Card
|
2
|
+
class Content
|
3
|
+
module Chunk
|
4
|
+
class ViewStub < Abstract
|
5
|
+
Chunk.register_class(
|
6
|
+
self,
|
7
|
+
prefix_re: Regexp.escape("<card-view>"),
|
8
|
+
full_re: /\<card-view\>([^\<]*)\<\/card-view\>/,
|
9
|
+
idx_char: "<"
|
10
|
+
)
|
11
|
+
|
12
|
+
def interpret match, _content
|
13
|
+
@options_json = match[1]
|
14
|
+
@stub_hash = JSON.parse(@options_json).symbolize_keys
|
15
|
+
interpret_hash_values
|
16
|
+
end
|
17
|
+
|
18
|
+
def interpret_hash_values
|
19
|
+
@stub_hash.keys.each do |key|
|
20
|
+
send "interpret_#{key}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def interpret_cast
|
25
|
+
@stub_hash[:cast].symbolize_keys!
|
26
|
+
end
|
27
|
+
|
28
|
+
def interpret_options
|
29
|
+
@stub_hash[:options].symbolize_keys!
|
30
|
+
end
|
31
|
+
|
32
|
+
def interpret_mode
|
33
|
+
@stub_hash[:mode] = @stub_hash[:mode].to_sym
|
34
|
+
end
|
35
|
+
|
36
|
+
def process_chunk
|
37
|
+
@processed = yield @stub_hash
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -12,10 +12,31 @@ class Card
|
|
12
12
|
# builtin layouts allow for rescue / testing
|
13
13
|
LAYOUTS = Mod::Loader.load_layouts.merge "none" => "{{_main}}"
|
14
14
|
|
15
|
+
def main?
|
16
|
+
!@main.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def focal? # meaning the current card is the requested card
|
20
|
+
show_layout? ? main? : @depth.zero?
|
21
|
+
end
|
22
|
+
|
23
|
+
def first_head?
|
24
|
+
@first_head ? false : (@first_head = true)
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_nest_view
|
28
|
+
# FIXME: not sure this makes sense as a rule...
|
29
|
+
card.rule(:default_html_view) || :titled
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_item_view
|
33
|
+
:closed
|
34
|
+
end
|
35
|
+
|
15
36
|
# helper methods for layout view
|
16
|
-
def get_layout_content
|
37
|
+
def get_layout_content requested_layout
|
17
38
|
Auth.as_bot do
|
18
|
-
if
|
39
|
+
if requested_layout
|
19
40
|
layout_from_card_or_code requested_layout
|
20
41
|
else
|
21
42
|
layout_from_rule
|
@@ -44,35 +65,11 @@ class Card
|
|
44
65
|
end
|
45
66
|
end
|
46
67
|
|
47
|
-
def get_nest_defaults nested_card
|
48
|
-
{ view: (nested_card.rule(:default_html_view) || :titled) }
|
49
|
-
end
|
50
|
-
|
51
|
-
def default_item_view
|
52
|
-
:closed
|
53
|
-
end
|
54
|
-
|
55
68
|
def html_escape_except_quotes s
|
56
69
|
# to be used inside single quotes (makes for readable json attributes)
|
57
70
|
s.to_s.gsub(/&/, "&").gsub(/\'/, "'")
|
58
71
|
.gsub(/>/, ">").gsub(/</, "<")
|
59
72
|
end
|
60
|
-
|
61
|
-
def main?
|
62
|
-
if show_layout?
|
63
|
-
@depth == 1 && @mainline # assumes layout includes {{_main}}
|
64
|
-
else
|
65
|
-
@depth.zero? && params[:is_main]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def focal? # meaning the current card is the requested card
|
70
|
-
if show_layout?
|
71
|
-
main?
|
72
|
-
else
|
73
|
-
@depth.zero?
|
74
|
-
end
|
75
|
-
end
|
76
73
|
end
|
77
74
|
end
|
78
75
|
end
|
data/mod/core/set/all/actify.rb
CHANGED
@@ -1,22 +1,13 @@
|
|
1
|
+
|
1
2
|
def assign_attributes args={}
|
2
|
-
|
3
|
-
args = args.stringify_keys
|
4
|
-
@set_specific = {}
|
5
|
-
Card.set_specific_attributes.each do |key|
|
6
|
-
@set_specific[key] = args.delete(key) if args[key]
|
7
|
-
end
|
3
|
+
args = prepare_assignment_args args
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
assign_with_subcards args do
|
6
|
+
assign_with_set_modules args do
|
7
|
+
params = prepare_assignment_params args
|
8
|
+
super params
|
9
|
+
end
|
13
10
|
end
|
14
|
-
params = ActionController::Parameters.new(args)
|
15
|
-
params.permit!
|
16
|
-
super params
|
17
|
-
return unless args && subcard_args.present?
|
18
|
-
# name= must come before process subcards
|
19
|
-
subcards.add subcard_args
|
20
11
|
end
|
21
12
|
|
22
13
|
def assign_set_specific_attributes
|
@@ -28,6 +19,54 @@ end
|
|
28
19
|
|
29
20
|
protected
|
30
21
|
|
22
|
+
def prepare_assignment_params args
|
23
|
+
params = ActionController::Parameters.new(args)
|
24
|
+
params.permit!
|
25
|
+
params
|
26
|
+
end
|
27
|
+
|
28
|
+
def prepare_assignment_args args
|
29
|
+
return {} unless args
|
30
|
+
args = args.stringify_keys
|
31
|
+
normalize_type_attributes args
|
32
|
+
stash_set_specific_attributes args
|
33
|
+
args
|
34
|
+
end
|
35
|
+
|
36
|
+
def assign_with_set_modules args
|
37
|
+
set_changed = args["name"] || args["type_id"]
|
38
|
+
return yield unless set_changed
|
39
|
+
|
40
|
+
refresh_set_modules { yield }
|
41
|
+
end
|
42
|
+
|
43
|
+
def assign_with_subcards args
|
44
|
+
subcard_args = extract_subcard_args! args
|
45
|
+
yield
|
46
|
+
# name= must come before process subcards
|
47
|
+
return unless subcard_args.present?
|
48
|
+
subcards.add subcard_args
|
49
|
+
end
|
50
|
+
|
51
|
+
def refresh_set_modules
|
52
|
+
reload_set_modules = @set_mods_loaded
|
53
|
+
yield
|
54
|
+
reset_patterns
|
55
|
+
include_set_modules if reload_set_modules
|
56
|
+
end
|
57
|
+
|
58
|
+
def stash_set_specific_attributes args
|
59
|
+
@set_specific = {}
|
60
|
+
Card.set_specific_attributes.each do |key|
|
61
|
+
@set_specific[key] = args.delete(key) if args[key]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def normalize_type_attributes args
|
66
|
+
new_type_id = extract_type_id! args unless args.delete("skip_type_lookup")
|
67
|
+
args["type_id"] = new_type_id if new_type_id
|
68
|
+
end
|
69
|
+
|
31
70
|
def extract_subcard_args! args
|
32
71
|
subcards = args.delete("subcards") || {}
|
33
72
|
if (subfields = args.delete("subfields"))
|
@@ -61,11 +100,3 @@ def extract_type_id! args={}
|
|
61
100
|
end
|
62
101
|
type_id
|
63
102
|
end
|
64
|
-
|
65
|
-
event :set_content, :store, on: :save do
|
66
|
-
self.db_content = content || "" # necessary?
|
67
|
-
self.db_content = Card::Content.clean!(db_content) if clean_html?
|
68
|
-
@selected_action_id = @selected_content = nil
|
69
|
-
clear_drafts
|
70
|
-
reset_patterns_if_rule true
|
71
|
-
end
|