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
@@ -3,10 +3,46 @@ require "uglifier"
|
|
3
3
|
|
4
4
|
include_set Abstract::AceEditor
|
5
5
|
|
6
|
+
def self.included host_class
|
7
|
+
host_class.include_set Abstract::Machine
|
8
|
+
host_class.include_set Abstract::MachineInput
|
9
|
+
|
10
|
+
host_class.machine_input { standard_machine_input }
|
11
|
+
host_class.store_machine_output filetype: "js"
|
12
|
+
end
|
13
|
+
|
14
|
+
def standard_machine_input
|
15
|
+
js = format(:js)._render_core
|
16
|
+
js = compress_js js if compress_js?
|
17
|
+
comment_with_source js
|
18
|
+
end
|
19
|
+
|
6
20
|
def comment_with_source js
|
7
21
|
"//#{name}\n#{js}"
|
8
22
|
end
|
9
23
|
|
24
|
+
def compress_js input
|
25
|
+
Uglifier.compile input
|
26
|
+
rescue => e
|
27
|
+
# CoffeeScript is compiled in a view
|
28
|
+
# If there is a CoffeeScript syntax error we get the rescued view here
|
29
|
+
# and the error that the rescued view is no valid Javascript
|
30
|
+
# To get the original error we have to refer to Card::Error.current
|
31
|
+
raise Card::Error, compression_error_message(e)
|
32
|
+
end
|
33
|
+
|
34
|
+
def compression_error_message e
|
35
|
+
if Card::Error.current
|
36
|
+
Card::Error.current.message
|
37
|
+
else
|
38
|
+
"JavaScript::SyntaxError (#{name}): #{e.message}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def compress_js?
|
43
|
+
!Rails.env.development?
|
44
|
+
end
|
45
|
+
|
10
46
|
def clean_html?
|
11
47
|
false
|
12
48
|
end
|
@@ -23,17 +59,16 @@ format :html do
|
|
23
59
|
end
|
24
60
|
|
25
61
|
view :content_changes do |args|
|
26
|
-
|
27
|
-
<pre>#{super(args)}</pre>
|
28
|
-
)
|
62
|
+
wrap_with(:pre) { super args }
|
29
63
|
end
|
30
64
|
|
31
|
-
view :core do
|
32
|
-
|
65
|
+
view :core do
|
66
|
+
script = card.format(:js).render_core
|
67
|
+
process_content highlight(script)
|
33
68
|
end
|
34
69
|
|
35
|
-
def
|
36
|
-
::CodeRay.scan(
|
70
|
+
def highlight script
|
71
|
+
::CodeRay.scan(script, :js).div
|
37
72
|
end
|
38
73
|
end
|
39
74
|
|
@@ -2,35 +2,21 @@
|
|
2
2
|
require "coffee-script"
|
3
3
|
|
4
4
|
include_set Abstract::Script
|
5
|
-
include_set Abstract::Machine
|
6
|
-
include_set Abstract::MachineInput
|
7
|
-
|
8
|
-
store_machine_output filetype: "js"
|
9
|
-
|
10
|
-
machine_input do
|
11
|
-
js = Uglifier.compile compile_coffee(format(:js)._render_raw)
|
12
|
-
comment_with_source js
|
13
|
-
end
|
14
|
-
|
15
|
-
def compile_coffee script
|
16
|
-
::CoffeeScript.compile script
|
17
|
-
rescue => e
|
18
|
-
raise Card::Error, "CoffeeScript::Error (#{name}): #{e.message}"
|
19
|
-
end
|
20
5
|
|
21
6
|
format :html do
|
22
7
|
def default_editor_args args
|
23
8
|
args[:ace_mode] ||= "coffee"
|
24
9
|
end
|
25
|
-
|
26
|
-
def highlighted_js
|
27
|
-
js = card.compile_coffee _render_raw
|
28
|
-
::CodeRay.scan(js, :js).div
|
29
|
-
end
|
30
10
|
end
|
31
11
|
|
32
12
|
format do
|
33
|
-
view :core do
|
34
|
-
|
13
|
+
view :core do
|
14
|
+
compile_coffee _render_raw
|
15
|
+
end
|
16
|
+
|
17
|
+
def compile_coffee script
|
18
|
+
::CoffeeScript.compile script
|
19
|
+
rescue => e
|
20
|
+
raise Card::Error, "CoffeeScript::Error (#{name}): #{e.message}"
|
35
21
|
end
|
36
22
|
end
|
@@ -2,28 +2,8 @@
|
|
2
2
|
|
3
3
|
include_set Abstract::Script
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
machine_input do
|
11
|
-
js = compress_js format(:js)._render_core
|
12
|
-
comment_with_source js
|
5
|
+
format :js do
|
6
|
+
view :core do
|
7
|
+
_render_raw
|
8
|
+
end
|
13
9
|
end
|
14
|
-
|
15
|
-
def compress_js input
|
16
|
-
Uglifier.compile(input)
|
17
|
-
rescue => e
|
18
|
-
# CoffeeScript is compiled in a view
|
19
|
-
# If there is a CoffeeScript syntax error we get the rescued view here
|
20
|
-
# and the error that the rescued view is no valid Javascript
|
21
|
-
# To get the original error we have to refer to Card::Error.current
|
22
|
-
msg = if Card::Error.current
|
23
|
-
Card::Error.current.message
|
24
|
-
else
|
25
|
-
"CoffeeScript::SyntaxError (#{name}): #{e.message}"
|
26
|
-
end
|
27
|
-
raise Card::Error, msg
|
28
|
-
end
|
29
|
-
|
@@ -6,7 +6,7 @@ describe Card::Set::Type::Css do
|
|
6
6
|
let(:changed_css) { "#box { display: inline }" }
|
7
7
|
let(:compressed_changed_css) { "#box{display:inline}\n" }
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "highlights code" do
|
10
10
|
Card::Auth.as_bot do
|
11
11
|
css_card = Card.create! name: "tmp css", type_code: "css",
|
12
12
|
content: "p { border: 1px solid black; }"
|
@@ -19,12 +19,12 @@ describe Card::Set::Type::Scss do
|
|
19
19
|
@scss_card = Card[:style_cards]
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "highlights code in html" do
|
23
23
|
assert_view_select @scss_card.format(:html).render_core,
|
24
24
|
"div[class=CodeRay]"
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
27
|
+
it "does not highlight code in css" do
|
28
28
|
expect(@scss_card.format(:css).render_core).not_to match(/CodeRay/)
|
29
29
|
end
|
30
30
|
|
@@ -44,7 +44,7 @@ describe Card::Set::Type::Scss do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "processes links and nests but not urls" do
|
48
48
|
Card::Auth.as_bot do
|
49
49
|
scss = ".TYPE-X.no-citations {\n color: #BA5B5B;\n}\n"
|
50
50
|
card = Card.create! name: "minimal css", type: "scss", content: scss
|
@@ -47,9 +47,9 @@ describe Card::Set::Type::Skin do
|
|
47
47
|
it "updates output of related machine card" do
|
48
48
|
# item = Card.gimme! "skin item", type: :css, content: css
|
49
49
|
skin = Card.gimme! "test skin supplier", type: :skin, content: ""
|
50
|
+
item = Card.gimme! "skin item", type: :css, content: css
|
50
51
|
machine = Card.gimme! "style with skin machine+*style",
|
51
52
|
type: :pointer, content: "[[test skin supplier]]"
|
52
|
-
item = Card.gimme! "skin item", type: :css, content: css
|
53
53
|
skin << item
|
54
54
|
skin.putty
|
55
55
|
updated_machine = Card.gimme machine.cardname
|
@@ -61,16 +61,16 @@ describe Card::Set::Type::Skin do
|
|
61
61
|
context "when item changed" do
|
62
62
|
it "updates output of related machine card" do
|
63
63
|
skin = Card.gimme! "test skin supplier", type: :skin, content: ""
|
64
|
-
machine = Card.gimme! "style with skin machine+*style",
|
65
|
-
type: :pointer,
|
66
|
-
content: "[[test skin supplier]]"
|
67
64
|
item = Card.gimme! "skin item", type: :css, content: css
|
65
|
+
machine = Card.gimme! "style with skin machine+*style",
|
66
|
+
type: :pointer, content: "[[test skin supplier]]"
|
68
67
|
skin << item
|
69
68
|
skin.putty
|
69
|
+
|
70
70
|
Card::Auth.as_bot do
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
Card["skin_item"].update_attributes content: changed_css
|
72
|
+
machine.machine_output_url
|
73
|
+
Card["skin_item"].update_attributes content: new_css
|
74
74
|
end
|
75
75
|
updated_machine = Card.gimme machine.cardname
|
76
76
|
path = updated_machine.machine_output_path
|
@@ -12,6 +12,10 @@ stage_method :added_item_names do
|
|
12
12
|
item_names - old_items
|
13
13
|
end
|
14
14
|
|
15
|
+
stage_method :changed_item_cards do
|
16
|
+
item_cards content: changed_item_names
|
17
|
+
end
|
18
|
+
|
15
19
|
format do
|
16
20
|
def item_links args={}
|
17
21
|
card.item_cards(args).map do |item_card|
|
@@ -23,90 +27,84 @@ format do
|
|
23
27
|
item # no wrap in base
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
def nest_item_array
|
31
|
+
card.item_cards.map do |item|
|
32
|
+
nest_item item
|
33
|
+
end
|
28
34
|
end
|
29
35
|
|
30
|
-
view :
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
view :core do |_args|
|
37
|
+
pointer_items.join ", "
|
38
|
+
end
|
39
|
+
|
40
|
+
def pointer_items args={}
|
41
|
+
card.item_cards.map do |item_card|
|
42
|
+
nest_item item_card, args do |rendered, item_view|
|
43
|
+
wrap_item rendered, item_view
|
44
|
+
end
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
39
49
|
format :html do
|
40
|
-
view :core do
|
41
|
-
|
50
|
+
view :core do
|
51
|
+
wrap_with :div, pointer_items, class: "pointer-list"
|
42
52
|
end
|
43
53
|
|
44
|
-
view :closed_content do
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
args[:joint] ||= ", "
|
52
|
-
_render_core args
|
54
|
+
view :closed_content do
|
55
|
+
item_view = implicit_item_view
|
56
|
+
item_view = item_view == "name" ? "name" : "link"
|
57
|
+
wrap_with :div, class: "pointer-list" do
|
58
|
+
pointer_items(view: item_view).join ", "
|
59
|
+
end
|
53
60
|
end
|
54
61
|
|
55
|
-
def wrap_item
|
56
|
-
%(<div class="pointer-item item-#{
|
62
|
+
def wrap_item rendered, item_view
|
63
|
+
%(<div class="pointer-item item-#{item_view}">#{rendered}</div>)
|
57
64
|
end
|
58
65
|
end
|
59
66
|
|
60
67
|
format :css do
|
61
68
|
# generalize to all collections?
|
62
69
|
def default_item_view
|
63
|
-
|
70
|
+
:content
|
64
71
|
end
|
65
72
|
|
66
|
-
view :titled do
|
73
|
+
view :titled do
|
67
74
|
%(#{major_comment "STYLE GROUP: \"#{card.name}\"", '='}#{_render_core})
|
68
75
|
end
|
69
76
|
|
70
|
-
view :core do
|
71
|
-
|
72
|
-
nest item, view: item_view(args)
|
73
|
-
end.join "\n\n"
|
77
|
+
view :core do
|
78
|
+
nest_item_array.join "\n\n"
|
74
79
|
end
|
75
80
|
|
76
81
|
view :content, :core
|
77
82
|
end
|
78
83
|
|
79
84
|
format :js do
|
80
|
-
view :core do
|
81
|
-
|
82
|
-
nest item, view: (args[:item] || :core)
|
83
|
-
end.join "\n\n"
|
85
|
+
view :core do
|
86
|
+
nest_item_array.join "\n\n"
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
87
90
|
format :data do
|
88
|
-
view :core do
|
89
|
-
|
90
|
-
nest c
|
91
|
-
end
|
91
|
+
view :core, cache: :never do
|
92
|
+
nest_item_array
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
96
|
format :rss do
|
96
|
-
def raw_feed_items
|
97
|
-
@raw_feed_items ||=
|
98
|
-
card.item_cards
|
99
|
-
end
|
97
|
+
def raw_feed_items
|
98
|
+
@raw_feed_items ||= card.item_cards
|
100
99
|
end
|
101
100
|
end
|
102
101
|
|
103
102
|
format :json do
|
104
103
|
view :export_items do |args|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
result.flatten.reject(&:blank?)
|
104
|
+
item_args = args.merge view: :export
|
105
|
+
card.known_item_cards.map do |item_card|
|
106
|
+
nest_item item_card, item_args
|
107
|
+
end.flatten.reject(&:blank?)
|
110
108
|
end
|
111
109
|
end
|
112
110
|
|
@@ -118,7 +116,7 @@ end
|
|
118
116
|
event :standardize_items, :prepare_to_validate,
|
119
117
|
on: :save,
|
120
118
|
changed: :content,
|
121
|
-
when: proc { |c| c.type_id == Card::PointerID
|
119
|
+
when: proc { |c| c.type_id == Card::PointerID } do
|
122
120
|
self.content = item_names(context: :raw).map do |name|
|
123
121
|
"[[#{name}]]"
|
124
122
|
end.join "\n"
|
@@ -130,7 +128,7 @@ end
|
|
130
128
|
|
131
129
|
def item_cards args={}
|
132
130
|
if args[:complete]
|
133
|
-
query = args.reverse_merge referred_to_by: name
|
131
|
+
query = args.reverse_merge referred_to_by: name, limit: 0
|
134
132
|
Card::Query.run query
|
135
133
|
elsif args[:known_only]
|
136
134
|
known_item_cards args
|
@@ -12,9 +12,6 @@ event :insert_item_event, :prepare_to_validate,
|
|
12
12
|
end
|
13
13
|
|
14
14
|
format :html do
|
15
|
-
# view :edit do |args|
|
16
|
-
# super(args.merge(pointer_item_class: 'form-control'))
|
17
|
-
# end
|
18
15
|
|
19
16
|
view :editor do |args|
|
20
17
|
part_view = (c = card.rule(:input)) ? c.gsub(/[\[\]]/, "") : :list
|
@@ -46,7 +43,7 @@ format :html do
|
|
46
43
|
end
|
47
44
|
|
48
45
|
def add_item_button
|
49
|
-
|
46
|
+
wrap_with :span, class: "input-group" do
|
50
47
|
button_tag class: "pointer-item-add" do
|
51
48
|
glyphicon("plus") + " add another"
|
52
49
|
end
|
@@ -167,8 +164,7 @@ def add_item name
|
|
167
164
|
end
|
168
165
|
|
169
166
|
def add_item! name
|
170
|
-
add_item
|
171
|
-
save!
|
167
|
+
add_item(name) && save!
|
172
168
|
end
|
173
169
|
|
174
170
|
def drop_item name
|
@@ -196,13 +192,8 @@ def insert_item! index, name
|
|
196
192
|
end
|
197
193
|
|
198
194
|
def option_names
|
199
|
-
result_names =
|
200
|
-
|
201
|
-
oc.item_names default_limit: 50, context: name
|
202
|
-
else
|
203
|
-
Card.search({ sort: "name", limit: 50, return: :name },
|
204
|
-
"option names for pointer: #{name}")
|
205
|
-
end
|
195
|
+
result_names = configured_option_names
|
196
|
+
|
206
197
|
if (selected_options = item_names)
|
207
198
|
result_names += selected_options
|
208
199
|
result_names.uniq!
|
@@ -210,6 +201,15 @@ def option_names
|
|
210
201
|
result_names
|
211
202
|
end
|
212
203
|
|
204
|
+
def configured_option_names
|
205
|
+
if (oc = options_rule_card)
|
206
|
+
oc.item_names context: name, limit: oc.default_limit
|
207
|
+
else
|
208
|
+
Card.search({ sort: "name", limit: 50, return: :name },
|
209
|
+
"option names for pointer: #{name}")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
213
|
def option_cards
|
214
214
|
option_names.map do |name|
|
215
215
|
Card.fetch name, new: {}
|