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
@@ -29,11 +29,11 @@ module RenameMethods
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe Card::Set::All::
|
32
|
+
describe Card::Set::All::AssignAttributes do
|
33
33
|
include RenameMethods
|
34
34
|
|
35
35
|
describe "set_name" do
|
36
|
-
it "
|
36
|
+
it "handles case variants" do
|
37
37
|
@c = Card.create! name: "chump"
|
38
38
|
expect(@c.name).to eq("chump")
|
39
39
|
@c.name = "Chump"
|
@@ -41,7 +41,7 @@ describe Card::Set::All::TrackedAttributes do
|
|
41
41
|
expect(@c.name).to eq("Chump")
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "handles changing from plus card to simple" do
|
45
45
|
c = Card.create! name: "four+five"
|
46
46
|
c.name = "nine"
|
47
47
|
c.save!
|
@@ -144,7 +144,7 @@ describe Card::Set::All::TrackedAttributes do
|
|
144
144
|
@t = card "T"
|
145
145
|
@t.name = "A+B"
|
146
146
|
assert !@t.save, "save should fail"
|
147
|
-
assert @t.errors[:name], "
|
147
|
+
assert @t.errors[:name], "has errors on key"
|
148
148
|
end
|
149
149
|
|
150
150
|
it "test_used_as_tag" do
|
@@ -209,7 +209,7 @@ describe Card::Set::All::TrackedAttributes do
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
it "
|
212
|
+
it "handles plus cards that have children" do
|
213
213
|
Card::Auth.as_bot do
|
214
214
|
Card.create name: "a+b+c+d"
|
215
215
|
ab = Card["a+b"]
|
@@ -259,7 +259,7 @@ describe Card::Set::All::TrackedAttributes do
|
|
259
259
|
assert_equal "[[/new/{{_self|name}}|new]]", Card["Buttah"].content
|
260
260
|
end
|
261
261
|
|
262
|
-
it "
|
262
|
+
it "renames card without updating references" do
|
263
263
|
c = Card["Dairy"]
|
264
264
|
c.update_attributes name: "Newt", update_referers: false
|
265
265
|
assert_equal "[[/new/{{_self|name}}|new]]", Card["Newt"].content
|
@@ -9,19 +9,19 @@ describe Card::Set::All::Type do
|
|
9
9
|
@hat = Card.new type: "Hat"
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "has a type_name" do
|
13
13
|
expect(@hat.type_name).to eq("Hat")
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "does not have a type_code" do
|
17
17
|
expect(@hat.type_code).to eq(nil)
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
20
|
+
it "has a type_id" do
|
21
21
|
expect(@hat.type_id).to eq(@type.id)
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "has a type_card" do
|
25
25
|
expect(@hat.type_card).to eq(@type)
|
26
26
|
end
|
27
27
|
end
|
@@ -36,7 +36,7 @@ describe Card::Set::All::Type do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "clears cache of structured nested card after saving" do
|
40
40
|
pending "need new mechanism to replace #reset_type_specific_fields"
|
41
41
|
Card::Auth.as_bot do
|
42
42
|
expect(Card.fetch("t1+results", new: {}).type_name).to eq("Basic")
|
data/mod/email/set/all/notify.rb
CHANGED
@@ -76,14 +76,17 @@ event :only_notify_on_web_requests, :initialize,
|
|
76
76
|
@silent_change = true
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
79
|
def notable_change?
|
81
80
|
!silent_change? && current_act_card? &&
|
82
81
|
Card::Auth.current_id != WagnBotID && followable?
|
83
82
|
end
|
84
83
|
|
85
84
|
def current_act_card?
|
86
|
-
|
85
|
+
return false unless current_act
|
86
|
+
current_act.card_id.nil? || current_act.card_id == id
|
87
|
+
# FIXME: currently card_id is nil for deleted acts (at least
|
88
|
+
# in the store phase when it's tested). This nil test was needed
|
89
|
+
# to make this work.
|
87
90
|
end
|
88
91
|
|
89
92
|
event :notify_followers_after_save, :integrate_with_delay,
|
@@ -95,10 +98,12 @@ end
|
|
95
98
|
# but we can't pass the follower_stash through the ActiveJob queue.
|
96
99
|
# We have to deal with the notifications in the integrate phase instead of the
|
97
100
|
# integrate_with_delay phase
|
98
|
-
event :stash_followers, :store,
|
101
|
+
event :stash_followers, :store,
|
102
|
+
on: :delete, when: proc { |ca| ca.notable_change? } do
|
99
103
|
act_card.follower_stash ||= FollowerStash.new
|
100
104
|
act_card.follower_stash.add_affected_card self
|
101
105
|
end
|
106
|
+
|
102
107
|
event :notify_followers_after_delete, :integrate,
|
103
108
|
on: :delete, when: proc { |ca| ca.notable_change? } do
|
104
109
|
notify_followers
|
data/mod/email/set/right/bcc.rb
CHANGED
@@ -10,15 +10,15 @@ format do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
format :html do
|
13
|
-
|
13
|
+
def pointer_items args
|
14
14
|
card.item_names(context: :raw).map do |iname|
|
15
15
|
wrap_item iname, args
|
16
|
-
end
|
16
|
+
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
format :email_text do
|
21
|
-
view :email_addresses do |args|
|
21
|
+
view :email_addresses, cache: :never do |args|
|
22
22
|
context = args[:context] || self
|
23
23
|
card.item_names(context: context.cardname).map do |item_name|
|
24
24
|
# note that context is processed twice here because pointers absolutize
|
@@ -17,7 +17,7 @@ format :html do
|
|
17
17
|
args[:condition] ||= Env.params[:condition] || "*always"
|
18
18
|
end
|
19
19
|
|
20
|
-
view :follow_item, tags: :unknown_ok do |args|
|
20
|
+
view :follow_item, tags: :unknown_ok, cache: :never do |args|
|
21
21
|
if card.new_card? || !card.include_item?(args[:condition])
|
22
22
|
button_view = :add_follow_rule_button
|
23
23
|
form_opts = { add_item: args[:condition] }
|
@@ -65,10 +65,10 @@ format :html do
|
|
65
65
|
class: "btn update-follow-link", "data-card_key" => key
|
66
66
|
end
|
67
67
|
|
68
|
-
view :follow_status_delete_options do
|
68
|
+
view :follow_status_delete_options, cache: :never do
|
69
69
|
wrap_with(:ul, class: "delete-list list-group") do
|
70
70
|
card.item_names.map do |option|
|
71
|
-
|
71
|
+
wrap_with :li, class: "list-group-item" do
|
72
72
|
condition = option == "*never" ? "*always" : option
|
73
73
|
subformat(card).render_follow_item condition: condition
|
74
74
|
end
|
@@ -76,7 +76,7 @@ format :html do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
view :delete_follow_rule_button do
|
79
|
+
view :delete_follow_rule_button do
|
80
80
|
button_tag(
|
81
81
|
type: :submit,
|
82
82
|
class: "btn-xs btn-item-delete btn-primary", "aria-label" => "Left Align"
|
@@ -85,7 +85,7 @@ format :html do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
view :add_follow_rule_button do
|
88
|
+
view :add_follow_rule_button do
|
89
89
|
button_tag(
|
90
90
|
type: :submit,
|
91
91
|
class: "btn-xs btn-item-add", "aria-label" => "Left Align"
|
@@ -30,18 +30,37 @@ event :update_follow_rules, :finalize,
|
|
30
30
|
end
|
31
31
|
|
32
32
|
format :html do
|
33
|
-
view :edit, perms: :update, tags: :unknown_ok do
|
34
|
-
frame_and_form :update
|
33
|
+
view :edit, perms: :update, tags: :unknown_ok do
|
34
|
+
frame_and_form :update do
|
35
35
|
[
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
_optional_render_content_formgroup,
|
37
|
+
_optional_render_confirm_update_all,
|
38
|
+
_optional_render_edit_buttons
|
39
39
|
]
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
view :edit_buttons do
|
44
|
+
button_formgroup do
|
45
|
+
[submit_and_update_button, simple_submit_button, cancel_to_edit_button]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def submit_and_update_button
|
50
|
+
submit_button text: "Submit and update all users",
|
51
|
+
disable_with: "Updating", class: "follow-updater"
|
52
|
+
end
|
53
|
+
|
54
|
+
def simple_submit_button
|
55
|
+
button_tag "Submit", class: "follow"
|
56
|
+
end
|
57
|
+
|
58
|
+
def cancel_to_edit_button
|
59
|
+
cancel_button href: path(view: :edit, id: card.id)
|
60
|
+
end
|
61
|
+
|
43
62
|
view :confirm_update_all do |args|
|
44
|
-
wrap
|
63
|
+
wrap do
|
45
64
|
alert "info" do
|
46
65
|
%(
|
47
66
|
<h1>Are you sure you want to change the default follow rules?</h1>
|
@@ -54,15 +73,7 @@ format :html do
|
|
54
73
|
|
55
74
|
def default_edit_args args
|
56
75
|
args[:hidden] ||= {}
|
57
|
-
args[:hidden].reverse_merge!(
|
58
|
-
|
59
|
-
card: { update_all_users: false }
|
60
|
-
)
|
61
|
-
args[:buttons] = %(
|
62
|
-
#{submit_button text: 'Submit and update all users',
|
63
|
-
disable_with: 'Updating', class: 'follow-updater'}
|
64
|
-
#{button_tag 'Submit', class: 'follow'}
|
65
|
-
#{cancel_button href: path(view: :edit, id: card.id)}
|
66
|
-
)
|
76
|
+
args[:hidden].reverse_merge!(success: "_self",
|
77
|
+
card: { update_all_users: false })
|
67
78
|
end
|
68
79
|
end
|
@@ -79,7 +79,7 @@ def email_config args={}
|
|
79
79
|
end
|
80
80
|
|
81
81
|
format do
|
82
|
-
view :mail, perms: :none do |args|
|
82
|
+
view :mail, perms: :none, cache: :never do |args|
|
83
83
|
args = card.email_config(args)
|
84
84
|
text_message = args.delete(:text_message)
|
85
85
|
html_message = args.delete(:html_message)
|
@@ -105,7 +105,7 @@ format :html do
|
|
105
105
|
res
|
106
106
|
end
|
107
107
|
|
108
|
-
view :following_list do |_args|
|
108
|
+
view :following_list, cache: :never do |_args|
|
109
109
|
if !Auth.signed_in? || Auth.current_id != card.left.id
|
110
110
|
hide_buttons = [:delete_follow_rule_button, :add_follow_rule_button]
|
111
111
|
end
|
@@ -116,7 +116,7 @@ format :html do
|
|
116
116
|
Card.set_patterns.select { |p| sets[p] }.reverse.map do |set_pattern|
|
117
117
|
sets[set_pattern].map do |rule|
|
118
118
|
rule[:options].map do |option|
|
119
|
-
|
119
|
+
wrap_with :li, class: "list-group-item" do
|
120
120
|
subformat(rule[:card]).render_follow_item condition: option,
|
121
121
|
hide: hide_buttons
|
122
122
|
end
|
@@ -127,7 +127,7 @@ format :html do
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
view :ignoring_list do |_args|
|
130
|
+
view :ignoring_list, cache: :never do |_args|
|
131
131
|
ignore_list = []
|
132
132
|
card.known_item_cards.each do |follow_rule|
|
133
133
|
follow_rule.item_cards.each do |follow_option|
|
@@ -141,7 +141,7 @@ format :html do
|
|
141
141
|
wrap_with :div, class: "pointer-list-editor" do
|
142
142
|
wrap_with :ul, class: "delete-list list-group" do
|
143
143
|
ignore_list.map do |rule_card|
|
144
|
-
|
144
|
+
wrap_with :li, class: "list-group-item" do
|
145
145
|
subformat(rule_card).render_follow_item condition: never,
|
146
146
|
hide: hide_buttons
|
147
147
|
end
|
@@ -150,17 +150,18 @@ format :html do
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
|
154
|
-
|
153
|
+
def pointer_items args
|
154
|
+
voo.items[:view] ||= :link
|
155
|
+
super(args)
|
155
156
|
end
|
156
157
|
|
157
158
|
view :errors, perms: :none do |args|
|
158
159
|
if card.errors.any?
|
159
160
|
if card.errors.find { |attrib, _msg| attrib == :permission_denied }
|
160
161
|
Env.save_interrupted_action(request.env["REQUEST_URI"])
|
161
|
-
title = "Problems with #{card.name}"
|
162
|
-
frame
|
163
|
-
|
162
|
+
voo.title = "Problems with #{card.name}"
|
163
|
+
class_up "card-frame", "panel panel-warning"
|
164
|
+
frame do
|
164
165
|
"Please #{link_to_card :signin, 'sign in'}" # " #{to_task}"
|
165
166
|
end
|
166
167
|
else
|
data/mod/history/lib/card/act.rb
CHANGED
@@ -0,0 +1,194 @@
|
|
1
|
+
#require_dependency File.expand_path("../../action/action_renderer", __FILE__)
|
2
|
+
|
3
|
+
class Card
|
4
|
+
class Act
|
5
|
+
class ActRenderer
|
6
|
+
def initialize format, act, args
|
7
|
+
@format = format
|
8
|
+
@act = act
|
9
|
+
@args = args
|
10
|
+
@card = @format.card
|
11
|
+
@context = @args[:act_context]
|
12
|
+
end
|
13
|
+
|
14
|
+
include ::Bootstrapper
|
15
|
+
|
16
|
+
def method_missing(method_name, *args, &block)
|
17
|
+
if block_given?
|
18
|
+
@format.send(method_name, *args, &block)
|
19
|
+
else
|
20
|
+
@format.send(method_name, *args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def respond_to_missing? method_name, _include_private=false
|
25
|
+
@format.respond_to? method_name
|
26
|
+
end
|
27
|
+
|
28
|
+
def render
|
29
|
+
act_accordion
|
30
|
+
end
|
31
|
+
|
32
|
+
def header
|
33
|
+
#::Bootstrap.new(self).render do
|
34
|
+
#::Boo.bs do
|
35
|
+
bs_layout do
|
36
|
+
row 10, 2 do
|
37
|
+
column do
|
38
|
+
html title
|
39
|
+
tag(:span, "text-muted") { summary }
|
40
|
+
end
|
41
|
+
column act_links, class: "text-right"
|
42
|
+
end
|
43
|
+
row 12 do
|
44
|
+
column subtitle
|
45
|
+
end
|
46
|
+
end
|
47
|
+
#end
|
48
|
+
end
|
49
|
+
|
50
|
+
def absolute_title
|
51
|
+
accordion_expand_link(@act.card.name)
|
52
|
+
end
|
53
|
+
|
54
|
+
def details
|
55
|
+
approved_actions[0..20].map do |action|
|
56
|
+
Action::ActionRenderer.new(@format, action, action_header?,
|
57
|
+
:summary).render
|
58
|
+
end.join
|
59
|
+
end
|
60
|
+
|
61
|
+
def summary
|
62
|
+
[:create, :update, :delete, :draft].map do |type|
|
63
|
+
next unless count_types[type] > 0
|
64
|
+
"#{@format.action_icon type} #{count_types[type]}"
|
65
|
+
end.compact.join " | "
|
66
|
+
end
|
67
|
+
|
68
|
+
def act_links
|
69
|
+
[
|
70
|
+
link_to_history,
|
71
|
+
(link_to_act_card unless @act.card.trash)
|
72
|
+
].compact.join " "
|
73
|
+
end
|
74
|
+
|
75
|
+
def link_to_act_card
|
76
|
+
link_to_card @act.card, glyphicon("new-window")
|
77
|
+
end
|
78
|
+
|
79
|
+
def link_to_history
|
80
|
+
link_to_card @act.card, glyphicon("time"), path: { view: :history,
|
81
|
+
look_in_trash: true }
|
82
|
+
end
|
83
|
+
|
84
|
+
def approved_actions
|
85
|
+
@approved_actions ||= actions.select { |a| a.card && a.card.ok?(:read) }
|
86
|
+
# FIXME: should not need to test for presence of card here.
|
87
|
+
end
|
88
|
+
|
89
|
+
def action_header?
|
90
|
+
true
|
91
|
+
# @action_header ||= approved_actions.size != 1 ||
|
92
|
+
# approved_actions[0].card_id != @format.card.id
|
93
|
+
end
|
94
|
+
|
95
|
+
def count_types
|
96
|
+
@count_types ||=
|
97
|
+
approved_actions.each_with_object(
|
98
|
+
Hash.new { |h, k| h[k] = 0 }
|
99
|
+
) do |action, type_cnt|
|
100
|
+
type_cnt[action.action_type] += 1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def edited_ago
|
105
|
+
"#{time_ago_in_words(@act.acted_at)} ago"
|
106
|
+
end
|
107
|
+
|
108
|
+
def collapse_id
|
109
|
+
"act-id-#{@act.id}"
|
110
|
+
end
|
111
|
+
|
112
|
+
def accordion_expand_link text
|
113
|
+
<<-HTML
|
114
|
+
<a>
|
115
|
+
#{text}
|
116
|
+
</a>
|
117
|
+
HTML
|
118
|
+
end
|
119
|
+
|
120
|
+
# TODO: change accordion API in bootstrap/helper.rb so that it can be used
|
121
|
+
# here. The problem is that here we have extra links in the title
|
122
|
+
# that are not supposed to expand the accordion
|
123
|
+
def act_accordion
|
124
|
+
context = @act.main_action.draft ? :warning : :default
|
125
|
+
<<-HTML
|
126
|
+
<div class="panel panel-#{context}">
|
127
|
+
#{act_accordion_panel}
|
128
|
+
</div>
|
129
|
+
HTML
|
130
|
+
end
|
131
|
+
|
132
|
+
def accordion_expand_options
|
133
|
+
{
|
134
|
+
"data-toggle" => "collapse",
|
135
|
+
"data-parent" => "#accordion-#{collapse_id}",
|
136
|
+
"data-target" => ".#{collapse_id}",
|
137
|
+
"aria-expanded" => true,
|
138
|
+
"aria-controls" => collapse_id
|
139
|
+
}
|
140
|
+
end
|
141
|
+
|
142
|
+
def act_panel_options
|
143
|
+
{ class: "panel-heading", role: "tab", id: "heading-#{collapse_id}" }
|
144
|
+
end
|
145
|
+
|
146
|
+
def act_accordion_panel
|
147
|
+
act_accordion_heading + act_accordion_body
|
148
|
+
end
|
149
|
+
|
150
|
+
def act_accordion_heading
|
151
|
+
wrap_with :div, act_panel_options.merge(accordion_expand_options) do
|
152
|
+
wrap_with :h4, header, class: "panel-title"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def act_accordion_body
|
157
|
+
wrap_with :div, id: collapse_id,
|
158
|
+
class: "panel-collapse collapse #{collapse_id}" do
|
159
|
+
wrap_with :div, details, class: "panel-body"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def rollback_link
|
164
|
+
return unless card.ok? :update
|
165
|
+
return unless (prior = previous_action)
|
166
|
+
wrap_with :div, class: "act-link collapse #{collapse_id}" do
|
167
|
+
link_to "Save as current",
|
168
|
+
class: "slotter", remote: true,
|
169
|
+
method: :post, rel: "nofollow",
|
170
|
+
"data-slot-selector" => ".card-slot.history-view",
|
171
|
+
path: { action: :update, action_ids: prior,
|
172
|
+
view: :open, look_in_trash: true }
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def previous_action
|
177
|
+
# TODO: optimize
|
178
|
+
actions.select { |action| action.card.last_action_id != action.id }
|
179
|
+
end
|
180
|
+
|
181
|
+
def show_or_hide_changes_link
|
182
|
+
wrap_with :div, class: "act-link" do
|
183
|
+
@format.link_to_view(
|
184
|
+
:act, "#{@args[:hide_diff] ? 'Show' : 'Hide'} changes",
|
185
|
+
class: "slotter",
|
186
|
+
path: { act_id: @args[:act].id, act_seq: @args[:act_seq],
|
187
|
+
hide_diff: !@args[:hide_diff], action_view: :expanded,
|
188
|
+
act_context: @args[:act_context], look_in_trash: true }
|
189
|
+
)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|