card 1.20.4 → 1.21.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 +9 -9
- data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +20 -0
- data/db/migrate_core_cards/20170608083819_add_full_width_layout_card.rb +23 -0
- data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +8 -0
- data/db/seed/new/card_actions.yml +783 -791
- data/db/seed/new/card_acts.yml +65 -47
- data/db/seed/new/card_changes.yml +3198 -3177
- data/db/seed/new/card_references.yml +604 -534
- data/db/seed/new/cards.yml +2355 -2256
- data/db/seed/test/fixtures/card_actions.yml +1795 -1803
- data/db/seed/test/fixtures/card_acts.yml +264 -246
- data/db/seed/test/fixtures/card_changes.yml +6275 -6184
- data/db/seed/test/fixtures/card_references.yml +1305 -1263
- data/db/seed/test/fixtures/cards.yml +3393 -3298
- data/db/seed/test/seed.rb +2 -2
- data/db/version_core_cards.txt +1 -1
- data/lib/card.rb +4 -0
- data/lib/card/act_manager/subdirector_array.rb +1 -0
- data/lib/card/auth/current.rb +7 -3
- data/lib/card/env.rb +5 -0
- data/lib/card/env/success.rb +1 -1
- data/lib/card/format/names.rb +3 -13
- data/lib/card/model/save_helper.rb +4 -6
- data/lib/card/query.rb +2 -1
- data/lib/card/query/attributes.rb +34 -14
- data/lib/card/query/value.rb +3 -4
- data/lib/card/set/format.rb +29 -4
- data/lib/card/set/format/haml_views.rb +25 -13
- data/lib/card/set/trait.rb +1 -0
- data/lib/card/set_pattern.rb +17 -1
- data/lib/card/subcards.rb +3 -2
- data/lib/generators/card/format/format_generator.rb +2 -0
- data/lib/generators/card/set/set_generator.rb +2 -0
- data/lib/generators/card/template/USAGE +10 -0
- data/lib/generators/card/template/template_generator.rb +46 -0
- data/lib/generators/card/template/templates/haml_template.erb +1 -0
- data/mod/Modfile +1 -1
- data/mod/account/set/all/account.rb +9 -5
- data/mod/account/set/right/account.rb +17 -5
- data/mod/account/set/self/account_links.rb +1 -2
- data/mod/account/set/type/signup.rb +4 -5
- data/mod/account/set/type/user.rb +1 -1
- data/mod/account/spec/set/all/account_spec.rb +2 -2
- data/mod/account/spec/set/right/account_spec.rb +2 -2
- data/mod/account/spec/set/right/email_spec.rb +1 -1
- data/mod/account/spec/set/right/password_spec.rb +1 -1
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +4 -0
- data/mod/ace_editor/set/abstract/ace_editor.rb +6 -3
- data/mod/ace_editor/set/self/script_ace.rb +1 -0
- data/mod/admin/set/self/admin.rb +1 -1
- data/mod/admin/set/self/version.rb +1 -0
- data/mod/basic_formats/format/css_format.rb +1 -0
- data/mod/basic_formats/format/csv_format.rb +1 -0
- data/mod/basic_formats/format/file_format.rb +1 -0
- data/mod/basic_formats/format/js_format.rb +1 -0
- data/mod/basic_formats/format/json_format.rb +1 -0
- data/mod/basic_formats/format/rss_format.rb +1 -0
- data/mod/basic_formats/format/xml_format.rb +1 -0
- data/mod/basic_formats/set/all/all_csv.rb +1 -1
- data/mod/basic_formats/set/all/base.rb +11 -3
- data/mod/basic_formats/set/all/json.rb +50 -8
- data/mod/basic_formats/set/all/rss.rb +21 -7
- data/mod/basic_formats/set/self/01_head/javascript.rb +1 -1
- data/mod/basic_formats/set/self/head.rb +1 -1
- data/mod/basic_formats/spec/set/all/base_spec.rb +13 -0
- data/mod/basic_types/set/type/html.rb +6 -2
- data/mod/basic_types/set/type/plain_text.rb +2 -3
- data/mod/bootstrap/lib/bootstrap.rb +2 -2
- data/mod/bootstrap/lib/bootstrap/basic_tags.rb +1 -1
- data/mod/bootstrap/lib/bootstrap/component.rb +2 -3
- data/mod/bootstrap/lib/bootstrap/component/form.rb +6 -5
- data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +1 -1
- data/mod/bootstrap/lib/bootstrap/component/layout.rb +3 -3
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +0 -2
- data/mod/bootstrap/lib/bootstrap/delegate.rb +2 -2
- data/mod/bootstrap/lib/bootstrapper.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/accordion.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/form.rb +2 -2
- data/mod/bootstrap/set/all/bootstrap/helper.rb +1 -0
- data/mod/bootstrap/set/all/bootstrap/wrapper.rb +1 -1
- data/mod/bootstrap/set/self/bootstrap_js.rb +1 -1
- data/mod/bootstrap/set/self/bootswatch_shared.rb +6 -6
- data/mod/bootstrap/set/self/script_mods.rb +1 -1
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +7 -6
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +2 -1
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +6 -3
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +3 -2
- data/mod/carrierwave/set/abstract/attachment.rb +1 -3
- data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +11 -1
- data/mod/carrierwave/set/type/file.rb +3 -3
- data/mod/carrierwave/spec/lib/carrier_wave/file_card_uploader_spec.rb +3 -0
- data/mod/carrierwave/spec/set/type/file_spec.rb +24 -6
- data/mod/carrierwave/spec/set/type/image_spec.rb +3 -0
- data/mod/core/chunk/link.rb +1 -1
- data/mod/core/chunk/nest.rb +2 -1
- data/mod/core/chunk/query_reference.rb +1 -1
- data/mod/core/chunk/reference.rb +1 -0
- data/mod/core/chunk/uri.rb +4 -3
- data/mod/core/set/abstract/lock.rb +26 -0
- data/mod/core/set/all/assign_attributes.rb +8 -4
- data/mod/core/set/all/collection.rb +16 -7
- data/mod/core/set/all/content.rb +6 -0
- data/mod/core/set/all/event.rb +1 -1
- data/mod/core/set/all/fetch.rb +2 -2
- data/mod/core/set/all/haml.rb +5 -15
- data/mod/core/set/all/initialize.rb +2 -2
- data/mod/core/set/all/name.rb +1 -1
- data/mod/core/set/all/permissions.rb +28 -16
- data/mod/core/set/all/rules.rb +1 -2
- data/mod/core/set/all/subcards.rb +3 -3
- data/mod/core/set/all/templating.rb +5 -1
- data/mod/core/set/all/trash.rb +1 -1
- data/mod/core/set/all/utils.rb +1 -1
- data/mod/core/spec/set/all/actify_spec.rb +1 -1
- data/mod/core/spec/set/all/assign_attributes_spec.rb +2 -2
- data/mod/core/spec/set/all/collection_spec.rb +6 -3
- data/mod/core/spec/set/all/export_spec.rb +40 -112
- data/mod/core/spec/set/all/name_spec.rb +1 -1
- data/mod/core/spec/set/all/permissions_spec.rb +7 -7
- data/mod/core/spec/set/all/rules2_spec.rb +25 -25
- data/mod/core/spec/set/all/rules_spec.rb +2 -7
- data/mod/developer/set/all/event_viz.rb +1 -1
- data/mod/developer/set/right/debug.rb +1 -1
- data/mod/history/lib/card/act.rb +1 -0
- data/mod/history/lib/card/act/act_renderer.rb +23 -20
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +0 -1
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +1 -0
- data/mod/history/lib/card/action.rb +1 -1
- data/mod/history/lib/card/action/action_renderer.rb +2 -2
- data/mod/history/lib/card/change.rb +2 -1
- data/mod/history/set/all/action_view.rb +1 -1
- data/mod/history/set/all/content_history.rb +7 -4
- data/mod/history/set/all/history.rb +6 -6
- data/mod/machines/file/all_script_machine_output/file.js +50 -34
- data/mod/machines/file/all_style_machine_output/file.css +1 -1
- data/mod/machines/lib/javascript/wagn.js.coffee +29 -18
- data/mod/machines/lib/javascript/wagn_layout.js.coffee +7 -3
- data/mod/machines/lib/stylesheets/style_cards.scss +10 -10
- data/mod/machines/set/abstract/machine.rb +5 -28
- data/mod/machines/set/abstract/script.rb +7 -4
- data/mod/machines/set/all/reset_machines.rb +1 -1
- data/mod/machines/set/self/script_jquery_helper.rb +2 -2
- data/mod/machines/set/self/script_slot.rb +1 -1
- data/mod/machines/set/type/coffee_script.rb +3 -2
- data/mod/machines/set/type/css.rb +7 -3
- data/mod/machines/set/type/scss.rb +7 -1
- data/mod/machines/spec/set/type/coffeescript_spec.rb +1 -1
- data/mod/machines/spec/set/type/javascript_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +3 -2
- data/mod/machines/spec/set/type/skin_spec.rb +1 -1
- data/mod/machines/spec/shared_examples/machine.rb +5 -3
- data/mod/machines/spec/shared_examples/machine_input.rb +1 -0
- data/mod/notifications/format/email_html_format.rb +1 -0
- data/mod/notifications/set/all/follow.rb +1 -1
- data/mod/notifications/set/all/observer.rb +1 -1
- data/mod/notifications/set/all/send_notifications.rb +2 -2
- data/mod/notifications/set/self/follow_defaults.rb +3 -8
- data/mod/notifications/set/type/email_template/email_config.rb +2 -2
- data/mod/notifications/set/type_plus_right/user/follow.rb +2 -2
- data/mod/notifications/spec/set/all/follow_spec.rb +7 -0
- data/mod/notifications/spec/set/all/notify_spec.rb +3 -0
- data/mod/notifications/spec/set/all/observer_spec.rb +1 -1
- data/mod/notifications/spec/set/right/followers_spec.rb +1 -0
- data/mod/pointer/set/abstract/00_paging_params.rb +11 -0
- data/mod/pointer/set/abstract/{00_paging.rb → 01_paging.rb} +10 -6
- data/mod/pointer/set/abstract/{00_paging → 01_paging}/paging_links.rb +0 -0
- data/mod/pointer/set/abstract/{01_pointer.rb → 02_pointer.rb} +26 -5
- data/mod/pointer/set/abstract/{01_pointer → 02_pointer}/edit.rb +3 -5
- data/mod/pointer/set/self/input_options.rb +12 -0
- data/mod/pointer/spec/set/self/input_options_spec.rb +8 -0
- data/mod/pointer/spec/set/type/pointer_spec.rb +3 -2
- data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +1 -1
- data/mod/prosemirror_editor/set/self/script_prosemirror.rb +1 -0
- data/mod/settings/lib/card/setting.rb +1 -2
- data/mod/settings/set/abstract/permission.rb +1 -1
- data/mod/settings/set/self/add_help.rb +1 -1
- data/mod/settings/set/self/autoname.rb +1 -1
- data/mod/settings/set/self/csv_structure.rb +2 -0
- data/mod/settings/set/self/help.rb +1 -1
- data/mod/settings/set/self/input.rb +1 -2
- data/mod/settings/set/self/options.rb +2 -2
- data/mod/settings/set/self/options_label.rb +2 -2
- data/mod/settings/set/type/setting.rb +1 -1
- data/mod/settings/spec/set/right/script_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +5 -3
- data/mod/solid_cache/spec/set/abstract/solid_cache_spec.rb +4 -3
- data/mod/standard/set/abstract/01_search_params.rb +4 -3
- data/mod/standard/set/abstract/search.rb +2 -1
- data/mod/standard/set/abstract/toolbar_split_button.rb +22 -0
- data/mod/standard/set/all/links.rb +3 -3
- data/mod/standard/set/all/rich_html/classy.rb +37 -0
- data/mod/standard/set/all/rich_html/editing.rb +6 -2
- data/mod/standard/set/all/rich_html/editor.rb +50 -0
- data/mod/standard/set/all/rich_html/form.rb +19 -12
- data/mod/standard/set/all/rich_html/form_elements.rb +2 -2
- data/mod/standard/set/all/rich_html/formgroup.rb +2 -1
- data/mod/standard/set/all/rich_html/header.rb +2 -27
- data/mod/standard/set/all/rich_html/menu.rb +1 -1
- data/mod/standard/set/all/rich_html/new.rb +5 -1
- data/mod/standard/set/all/rich_html/toolbar.rb +15 -60
- data/mod/standard/set/all/rich_html/wrapper.rb +6 -3
- data/mod/standard/set/right/when_created.rb +2 -2
- data/mod/standard/set/rstar/rules_editor.rb +10 -7
- data/mod/standard/set/self/activity_toolbar_button.rb +14 -0
- data/mod/standard/set/self/recent.rb +7 -2
- data/mod/standard/set/self/rules_toolbar_button.rb +42 -0
- data/mod/standard/set/self/search.rb +19 -6
- data/mod/standard/set/type/basic.rb +6 -6
- data/mod/standard/set/type/cardtype.rb +7 -3
- data/mod/standard/set/type/date.rb +2 -4
- data/mod/standard/set/type/layout_type.rb +1 -0
- data/mod/standard/set/type/list.rb +1 -1
- data/mod/standard/set/type/listed_by.rb +1 -2
- data/mod/standard/set/type/number.rb +4 -2
- data/mod/standard/set/type/phrase.rb +4 -2
- data/mod/standard/set/type/search_type.rb +11 -3
- data/mod/standard/set/type/set.rb +8 -8
- data/mod/standard/set/type/toggle.rb +1 -3
- data/mod/standard/set/type/uri.rb +6 -2
- data/mod/standard/spec/chunk/include_spec.rb +3 -2
- data/mod/standard/spec/chunk/query_reference_spec.rb +2 -2
- data/mod/standard/spec/set/all/history_spec.rb +1 -0
- data/mod/standard/spec/set/all/links_spec.rb +1 -0
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +2 -0
- data/mod/standard/spec/set/self/activity_toolbar_button_spec.rb +22 -0
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +10 -8
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -0
- data/mod/standard/spec/set/type/list_spec.rb +2 -0
- data/mod/standard/spec/set/type/listed_by_spec.rb +5 -0
- data/mod/standard/spec/set/type/search_type_spec.rb +1 -1
- data/mod/standard/spec/set/type/toggle_spec.rb +1 -2
- data/mod/standard/spec/set/type/uri_spec.rb +0 -1
- data/mod/tinymce_editor/db/migrate_cards/20160804112560_add_tinymce_cards.rb +3 -1
- data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
- data/mod/tinymce_editor/set/self/script_tinymce.rb +1 -0
- data/mod/twitter/db/migrate_cards/20170305112346_add_twitter_cards.rb +1 -1
- data/mod/twitter/set/type/twitter_template.rb +1 -1
- data/spec/lib/card/format_spec.rb +26 -7
- data/spec/lib/card/loader_spec.rb +96 -35
- data/spec/lib/card/query_spec.rb +0 -1
- data/spec/support/card_spec_loader.rb +1 -0
- data/spec/support/helper/card_helper.rb +0 -36
- data/spec/support/helper/set_helper.rb +80 -0
- data/spec/support/matchers.rb +74 -0
- data/tmpsets/set/mod001-core/all/actify.rb +5 -6
- data/tmpsets/set/mod001-core/all/fetch.rb +14 -12
- data/tmpsets/set/mod001-core/all/name.rb +1 -1
- data/tmpsets/set/mod001-core/all/permissions.rb +12 -22
- data/tmpsets/set/mod001-core/all/tracked_attributes.rb +76 -0
- data/tmpsets/set/mod001-core/all/utils.rb +40 -3
- data/tmpsets/set/mod002-history/all/history.rb +1 -2
- data/tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb +1 -1
- data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +282 -0
- data/tmpsets/set/mod013-carrierwave/type/file.rb +155 -0
- data/tmpsets/set/mod013-carrierwave/type/image.rb +96 -0
- data/tmpsets/set/mod014-admin/self/admin.rb +113 -0
- data/tmpsets/set/mod014-admin/self/admin_info.rb +110 -0
- data/tmpsets/set/mod014-admin/self/version.rb +15 -0
- data/tmpsets/set/mod015-developer/all/event_viz.rb +59 -0
- data/tmpsets/set/mod015-developer/all/view_viz.rb +30 -0
- data/tmpsets/set/mod015-developer/right/debug.rb +96 -0
- metadata +52 -22
@@ -12,10 +12,8 @@ event :insert_item_event, :prepare_to_validate,
|
|
12
12
|
end
|
13
13
|
|
14
14
|
format :html do
|
15
|
-
|
16
15
|
view :editor do |args|
|
17
|
-
|
18
|
-
raw(_render(part_view, args))
|
16
|
+
_render_hidden_content_field + raw(_render(part_view, args))
|
19
17
|
# .merge(pointer_item_class: 'form-control')))
|
20
18
|
end
|
21
19
|
|
@@ -28,8 +26,8 @@ format :html do
|
|
28
26
|
items = args[:item_list] || card.item_names(context: :raw)
|
29
27
|
items = [""] if items.empty?
|
30
28
|
rendered_items = items.map do |item|
|
31
|
-
|
32
|
-
|
29
|
+
_render_list_item args.merge(pointer_item: item)
|
30
|
+
end.join "\n"
|
33
31
|
extra_css_class = args[:extra_css_class] || "pointer-list-ul"
|
34
32
|
|
35
33
|
<<-HTML
|
@@ -0,0 +1,12 @@
|
|
1
|
+
include_set Abstract::Pointer
|
2
|
+
|
3
|
+
basket :options
|
4
|
+
add_to_basket :options, "radio"
|
5
|
+
add_to_basket :options, "checkbox"
|
6
|
+
add_to_basket :options, "select"
|
7
|
+
add_to_basket :options, "multiselect"
|
8
|
+
add_to_basket :options, "list"
|
9
|
+
|
10
|
+
def raw_content
|
11
|
+
options.to_pointer_content
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
describe Card::Set::Self::InputOptions do
|
2
|
+
it "loads the self set" do
|
3
|
+
expect(Card[:input, :right, :options].item_names).to contain_exactly(
|
4
|
+
"radio", "checkbox", "select", "multiselect", "list", "ace editor",
|
5
|
+
"prosemirror editor", "tinymce editor", "text area", "text field", "calendar"
|
6
|
+
)
|
7
|
+
end
|
8
|
+
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
+
|
2
3
|
describe Card::Set::Type::Pointer do
|
3
4
|
describe "item_names" do
|
4
5
|
it "returns array of names of items referred to by a pointer" do
|
5
6
|
card = Card.new(type: "Pointer", content: "[[Busy]]\n[[Body]]")
|
6
|
-
card.item_names.should == %w
|
7
|
+
card.item_names.should == %w[Busy Body]
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
@@ -113,7 +114,7 @@ describe Card::Set::Type::Pointer do
|
|
113
114
|
in_stage :validate,
|
114
115
|
on: :save,
|
115
116
|
trigger: pointer_update("[[item1]]\n[[item3]]") do
|
116
|
-
expect(changed_item_names.sort).to eq %w
|
117
|
+
expect(changed_item_names.sort).to eq %w[item2 item3]
|
117
118
|
end
|
118
119
|
end
|
119
120
|
end
|
@@ -24,7 +24,7 @@ format :html do
|
|
24
24
|
view :editor do
|
25
25
|
item_names = inheriting? ? [] : card.item_names
|
26
26
|
%(
|
27
|
-
#{
|
27
|
+
#{_render_hidden_content_field}
|
28
28
|
<div class="perm-editor">
|
29
29
|
#{inheritance_checkbox}
|
30
30
|
<div class="perm-group perm-vals perm-section">
|
@@ -1,2 +1,2 @@
|
|
1
1
|
extend Card::Setting
|
2
|
-
setting_opts group: :
|
2
|
+
setting_opts group: :editing, position: 2, rule_type_editable: true
|
@@ -1,2 +1,2 @@
|
|
1
1
|
extend Card::Setting
|
2
|
-
setting_opts group: :templating, position:
|
2
|
+
setting_opts group: :templating, position: 4
|
@@ -1,2 +1,2 @@
|
|
1
1
|
extend Card::Setting
|
2
|
-
setting_opts group: :
|
2
|
+
setting_opts group: :editing, position: 1, rule_type_editable: true
|
@@ -8,7 +8,7 @@ describe Card::Set::Right::Script do
|
|
8
8
|
let(:new_js) { 'alert( "Hey" );' }
|
9
9
|
let(:compressed_new_js) { 'alert("Hey");' }
|
10
10
|
|
11
|
-
|
11
|
+
it_behaves_like "pointer machine", that_produces: :js do
|
12
12
|
let(:input_name) { "test js" }
|
13
13
|
let(:machine_card) do
|
14
14
|
Card.gimme! "test my style+*script", type: :pointer, content: ""
|
@@ -10,7 +10,7 @@ describe Card::Set::Right::Style do
|
|
10
10
|
let(:new_css) { "#box{ display: none}\n" }
|
11
11
|
let(:compressed_new_css) { "#box{display:none}\n" }
|
12
12
|
|
13
|
-
|
13
|
+
it_behaves_like "pointer machine", that_produces: :css do
|
14
14
|
let(:machine_card) do
|
15
15
|
Card.gimme! "test my style+*style", type: :pointer, content: ""
|
16
16
|
end
|
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
card_accessor :solid_cache, type: :html
|
12
12
|
|
13
|
+
include_set Abstract::Lock
|
14
|
+
|
13
15
|
def self.included host_class
|
14
16
|
host_class.format(host_class.try(:cached_format) || :base) do
|
15
17
|
view :core do |args|
|
@@ -56,7 +58,7 @@ module ClassMethods
|
|
56
58
|
|
57
59
|
def define_event_to_update_expired_cached_cards set_of_changed_card, args,
|
58
60
|
method_name
|
59
|
-
args[:on] ||= [
|
61
|
+
args[:on] ||= %i[create update delete]
|
60
62
|
name = event_name set_of_changed_card, args
|
61
63
|
stage = args[:in_stage] || :integrate
|
62
64
|
Card::Set.register_set set_of_changed_card
|
@@ -79,7 +81,7 @@ module ClassMethods
|
|
79
81
|
end
|
80
82
|
|
81
83
|
def expire_solid_cache _changed_card=nil
|
82
|
-
return unless solid_cache?
|
84
|
+
return unless solid_cache? && solid_cache_card.real?
|
83
85
|
Auth.as_bot do
|
84
86
|
solid_cache_card.delete!
|
85
87
|
end
|
@@ -109,7 +111,7 @@ def updated_content_for_cache _changed_card=nil
|
|
109
111
|
end
|
110
112
|
|
111
113
|
def write_to_solid_cache new_content
|
112
|
-
|
114
|
+
lock do
|
113
115
|
if solid_cache_card.new_card?
|
114
116
|
solid_cache_card.update_attributes! content: new_content
|
115
117
|
elsif new_content != solid_cache_card.content
|
@@ -8,9 +8,10 @@ describe Card::Set::Abstract::SolidCache do
|
|
8
8
|
|
9
9
|
# let(:core_view) { 'Alpha <a class="known-card" href="/Z">Z</a>' }
|
10
10
|
let(:core_view) { "Alpha Z[/Z]" }
|
11
|
+
|
11
12
|
context "with solid cache" do
|
12
13
|
it "saves core view in solid cache card" do
|
13
|
-
@card.format_with_set(
|
14
|
+
@card.format_with_set(described_class, &:render_core)
|
14
15
|
Card::Auth.as_bot do
|
15
16
|
expect(Card["A", :solid_cache]).to be_instance_of(Card)
|
16
17
|
expect(Card["A", :solid_cache].content).to eq(core_view)
|
@@ -18,7 +19,7 @@ describe Card::Set::Abstract::SolidCache do
|
|
18
19
|
end
|
19
20
|
|
20
21
|
it "uses solid cache card content as core view" do
|
21
|
-
@card.format_with_set(
|
22
|
+
@card.format_with_set(described_class) do |format|
|
22
23
|
Card::Auth.as_bot do
|
23
24
|
Card["A"].solid_cache_card.update_attributes! content: "cache"
|
24
25
|
end
|
@@ -28,7 +29,7 @@ describe Card::Set::Abstract::SolidCache do
|
|
28
29
|
end
|
29
30
|
context "with solid cache disabled" do
|
30
31
|
it "ignores solid cache card content" do
|
31
|
-
@card.format_with_set(
|
32
|
+
@card.format_with_set(described_class) do |format|
|
32
33
|
Card::Auth.as_bot do
|
33
34
|
Card["A"].solid_cache_card.update_attributes! content: "cache"
|
34
35
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
include_set Abstract::PagingParams
|
2
|
+
|
1
3
|
format do
|
2
4
|
def offset
|
3
5
|
search_params[:offset] || 0
|
@@ -20,9 +22,8 @@ format do
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def offset_and_limit_search_params hash
|
23
|
-
[:offset
|
24
|
-
|
25
|
-
end
|
25
|
+
hash[:offset] = offset_param
|
26
|
+
hash[:limit] = limit_param
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -16,6 +16,7 @@ def returning item, args
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def item_cards args={}
|
19
|
+
args[:limit] ||= 0
|
19
20
|
returning(:card, args) { search args }
|
20
21
|
end
|
21
22
|
|
@@ -78,7 +79,7 @@ format do
|
|
78
79
|
|
79
80
|
def implicit_item_view
|
80
81
|
view = voo_items_view || query_with_params.statement[:item] ||
|
81
|
-
|
82
|
+
default_item_view
|
82
83
|
Card::View.canonicalize view
|
83
84
|
end
|
84
85
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
format :html do
|
2
|
+
def toolbar_split_button name, button_link_opts
|
3
|
+
button_link = toolbar_split_button_link name, button_link_opts
|
4
|
+
split_button(button_link, active_toolbar_item) { yield }
|
5
|
+
end
|
6
|
+
|
7
|
+
def toolbar_split_button_link name, opts
|
8
|
+
link_text = toolbar_split_button_link_text name, opts
|
9
|
+
opts[:class] = "active" if active_toolbar_button == name
|
10
|
+
button_link link_text, opts
|
11
|
+
end
|
12
|
+
|
13
|
+
def toolbar_split_button_link_text name, opts
|
14
|
+
icon = glyphicon opts.delete(:icon)
|
15
|
+
icon + content_tag(:span, " #{name}".html_safe,
|
16
|
+
class: "visible-md visible-lg pull-right")
|
17
|
+
end
|
18
|
+
|
19
|
+
def subject
|
20
|
+
parent || self
|
21
|
+
end
|
22
|
+
end
|
@@ -9,7 +9,7 @@ format :html do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def interpret_data_opts_to_link_to opts
|
12
|
-
[
|
12
|
+
%i[remote method].each do |key|
|
13
13
|
next unless (val = opts.delete key)
|
14
14
|
opts["data-#{key}"] = val
|
15
15
|
end
|
@@ -85,7 +85,7 @@ format do
|
|
85
85
|
# :view, :related, :card, or :resource, it will use the respective method to
|
86
86
|
# render a link.
|
87
87
|
def smart_link_to text, opts={}
|
88
|
-
if (linktype = [
|
88
|
+
if (linktype = %i[view related card resource].find { |key| opts[key] })
|
89
89
|
send "link_to_#{linktype}", opts.delete(linktype), text, opts
|
90
90
|
else
|
91
91
|
send :link_to, text, opts
|
@@ -133,7 +133,7 @@ format do
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def standardize_action! opts
|
136
|
-
return if [
|
136
|
+
return if %i[create update delete].member? opts[:action]
|
137
137
|
opts.delete :action
|
138
138
|
end
|
139
139
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
format :html do
|
2
|
+
# Classy home for classes and klasses
|
3
|
+
def class_up klass, classier, force=false
|
4
|
+
key = klass.to_s
|
5
|
+
return if !force && class_list[key]
|
6
|
+
class_list[key] = classier.to_s
|
7
|
+
end
|
8
|
+
|
9
|
+
def class_down klass, classier
|
10
|
+
class_list.delete klass if class_list[klass] == classier
|
11
|
+
end
|
12
|
+
|
13
|
+
def with_class_up klass, classier, force=false
|
14
|
+
class_up klass, classier, force
|
15
|
+
yield
|
16
|
+
ensure
|
17
|
+
class_down klass, classier
|
18
|
+
end
|
19
|
+
|
20
|
+
# don't use in the given block the additional class that
|
21
|
+
# was added to `klass`
|
22
|
+
def without_upped_class klass
|
23
|
+
tmp_class = class_list.delete klass
|
24
|
+
result = yield tmp_class
|
25
|
+
class_list[klass] = tmp_class
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
29
|
+
def class_list
|
30
|
+
@class_list ||= {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def classy *classes
|
34
|
+
classes = Array.wrap(classes).flatten
|
35
|
+
[classes, class_list[classes.first]].flatten.compact.join " "
|
36
|
+
end
|
37
|
+
end
|
@@ -2,7 +2,7 @@ format :html do
|
|
2
2
|
###---( TOP_LEVEL (used by menu) NEW / EDIT VIEWS )
|
3
3
|
view :edit, perms: :update, tags: :unknown_ok, cache: :never do
|
4
4
|
voo.show :toolbar, :help
|
5
|
-
frame_and_form :update do
|
5
|
+
frame_and_form :update, edit_form_opts do
|
6
6
|
[
|
7
7
|
edit_view_hidden,
|
8
8
|
_optional_render_content_formgroup,
|
@@ -11,6 +11,10 @@ format :html do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def edit_form_opts
|
15
|
+
# for override
|
16
|
+
end
|
17
|
+
|
14
18
|
def edit_view_hidden
|
15
19
|
# for override
|
16
20
|
end
|
@@ -163,7 +167,7 @@ format :html do
|
|
163
167
|
|
164
168
|
view :edit_nest_rules, cache: :never do |args|
|
165
169
|
return ""
|
166
|
-
# FIXME - view can recurse. temporarily turned off
|
170
|
+
# FIXME: - view can recurse. temporarily turned off
|
167
171
|
voo.show :toolbar
|
168
172
|
view = args[:rule_view] || :field_related_rules
|
169
173
|
frame do
|
@@ -0,0 +1,50 @@
|
|
1
|
+
include_set Abstract::ProsemirrorEditor
|
2
|
+
include_set Abstract::TinymceEditor
|
3
|
+
include_set Abstract::AceEditor
|
4
|
+
|
5
|
+
Self::InputOptions.add_to_basket :options, "text area"
|
6
|
+
Self::InputOptions.add_to_basket :options, "text field"
|
7
|
+
Self::InputOptions.add_to_basket :options, "calendar"
|
8
|
+
|
9
|
+
format :html do
|
10
|
+
def editor
|
11
|
+
(c = card.rule(:input)) && c.gsub(/[\[\]]/, "").tr(" ", "_")
|
12
|
+
end
|
13
|
+
|
14
|
+
def editor_method editor_type
|
15
|
+
"#{editor_type}_input"
|
16
|
+
end
|
17
|
+
|
18
|
+
def editor_defined_by_card
|
19
|
+
return unless (editor_card = Card[editor])
|
20
|
+
nest editor_card, view: :core
|
21
|
+
end
|
22
|
+
|
23
|
+
view :editor do
|
24
|
+
try(editor_method(editor)) ||
|
25
|
+
editor_defined_by_card ||
|
26
|
+
send(editor_method(default_editor))
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_editor
|
30
|
+
:rich_text
|
31
|
+
end
|
32
|
+
|
33
|
+
# overriden by mods that provide rich text editors
|
34
|
+
def rich_text_input
|
35
|
+
prosemirror_editor_input
|
36
|
+
end
|
37
|
+
|
38
|
+
def text_area_input
|
39
|
+
text_area :content, rows: 5, class: "card-content",
|
40
|
+
"data-card-type-code" => card.type_code
|
41
|
+
end
|
42
|
+
|
43
|
+
def text_field_input
|
44
|
+
text_field :content, class: "card-content"
|
45
|
+
end
|
46
|
+
|
47
|
+
def calendar_input
|
48
|
+
text_field :content, class: "date-editor"
|
49
|
+
end
|
50
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
|
3
3
|
format :html do
|
4
4
|
# FIELDSET VIEWS
|
@@ -7,7 +7,7 @@ format :html do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
view :name_formgroup do
|
10
|
-
formgroup "name", editor: "name" do
|
10
|
+
formgroup "name", editor: "name", help: false do
|
11
11
|
raw name_field
|
12
12
|
end
|
13
13
|
end
|
@@ -24,7 +24,7 @@ format :html do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def wrap_type_formgroup
|
27
|
-
formgroup "type", editor: "type", class: "type-formgroup" do
|
27
|
+
formgroup "type", editor: "type", class: "type-formgroup", help: false do
|
28
28
|
yield
|
29
29
|
end
|
30
30
|
end
|
@@ -77,7 +77,6 @@ format :html do
|
|
77
77
|
hidden_field :last_action_id_before_edit, class: "current_revision_id"
|
78
78
|
end
|
79
79
|
|
80
|
-
|
81
80
|
def edit_slot
|
82
81
|
if inline_nests_editor?
|
83
82
|
_render_core
|
@@ -115,7 +114,7 @@ format :html do
|
|
115
114
|
def single_card_edit_slot
|
116
115
|
if voo.show?(:type_formgroup) || voo.show?(:name_formgroup)
|
117
116
|
# display content field in formgroup for consistency with other fields
|
118
|
-
formgroup("", editor: :content) { content_field }
|
117
|
+
formgroup("", editor: :content, help: false) { content_field }
|
119
118
|
else
|
120
119
|
editor_wrap(:content) { content_field }
|
121
120
|
end
|
@@ -168,10 +167,8 @@ format :html do
|
|
168
167
|
|
169
168
|
def card_form action, opts={}
|
170
169
|
@form_root = true
|
171
|
-
url, action = card_form_url_and_action action
|
172
170
|
success = opts.delete(:success)
|
173
|
-
|
174
|
-
form_for card, url: url, html: html_opts, remote: true do |form|
|
171
|
+
form_for card, card_form_opts(action, opts) do |form|
|
175
172
|
@form = form
|
176
173
|
success_tags(success) + output(yield(form))
|
177
174
|
end
|
@@ -191,11 +188,21 @@ format :html do
|
|
191
188
|
end
|
192
189
|
end
|
193
190
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
191
|
+
# @param action [Symbol] :create or :update
|
192
|
+
# @param opts [Hash] html options
|
193
|
+
# @option opts [Boolean] :redirect (false) if true form is no "slotter"
|
194
|
+
def card_form_opts action, opts={}
|
195
|
+
url, action = card_form_url_and_action action
|
196
|
+
html_opts = card_form_html_opts action, opts
|
197
|
+
form_opts = { url: url, html: html_opts }
|
198
|
+
form_opts[:remote] = true unless html_opts.delete(:redirect)
|
199
|
+
form_opts
|
200
|
+
end
|
198
201
|
|
202
|
+
def card_form_html_opts action, opts={}
|
203
|
+
add_class opts, "card-form"
|
204
|
+
add_class opts, "slotter" unless opts[:redirect]
|
205
|
+
add_class opts, "autosave" if action == :update
|
199
206
|
opts[:recaptcha] ||= "on" if card.recaptcha_on?
|
200
207
|
opts.delete :recaptcha if opts[:recaptcha] == :off
|
201
208
|
opts
|