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
@@ -12,7 +12,7 @@ format :rss do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# FIXME: integrate this with common XML features when it is added
|
15
|
-
view :feed do
|
15
|
+
view :feed, cache: :never do
|
16
16
|
begin
|
17
17
|
@xml.instruct! :xml, version: "1.0"
|
18
18
|
@xml.rss version: "2.0" do
|
@@ -28,16 +28,16 @@ format :rss do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def raw_feed_items
|
31
|
+
def raw_feed_items
|
32
32
|
[card]
|
33
33
|
end
|
34
34
|
|
35
|
-
view :feed_body do
|
35
|
+
view :feed_body, cache: :never do
|
36
36
|
render_feed_item_list
|
37
37
|
end
|
38
38
|
|
39
|
-
view :feed_item_list do
|
40
|
-
raw_feed_items
|
39
|
+
view :feed_item_list, cache: :never do
|
40
|
+
raw_feed_items.each do |item|
|
41
41
|
@xml.item do
|
42
42
|
# FIXME: yuck.
|
43
43
|
subformat(item).render_feed_item view_changes: (card.id == RecentID)
|
@@ -49,7 +49,7 @@ format :rss do
|
|
49
49
|
Card.global_setting(:title) + " : " + card.name.gsub(/^\*/, "")
|
50
50
|
end
|
51
51
|
|
52
|
-
view :feed_item do |args|
|
52
|
+
view :feed_item, cache: :never do |args|
|
53
53
|
@xml.title card.name
|
54
54
|
add_name_context
|
55
55
|
@xml.description render((args[:view_changes] ? :change : :open_content))
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
format :text do
|
3
|
-
view :core do
|
4
|
-
HTMLEntities.new.decode strip_tags(super
|
3
|
+
view :core do
|
4
|
+
HTMLEntities.new.decode strip_tags(super()).to_s
|
5
|
+
# need this string method to get out of html_safe mode
|
5
6
|
end
|
6
7
|
end
|
@@ -11,7 +11,7 @@ format :html do
|
|
11
11
|
|
12
12
|
@js_tag =
|
13
13
|
if params[:debug] == "script"
|
14
|
-
script_card.format(:js).render_core
|
14
|
+
script_card.format(:js).render_core items: { view: :include_tag }
|
15
15
|
elsif script_card
|
16
16
|
javascript_include_tag script_card.machine_output_url
|
17
17
|
end
|
@@ -70,4 +70,4 @@ format :html do
|
|
70
70
|
javascript_tag { "wagn.#{js_wagn_function}('#{config_json}')" }
|
71
71
|
end
|
72
72
|
end
|
73
|
-
end
|
73
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
format :html do
|
2
|
-
view :raw do
|
2
|
+
view :raw, cache: :never do
|
3
3
|
output [
|
4
4
|
head_meta,
|
5
5
|
head_title,
|
@@ -9,14 +9,8 @@ format :html do
|
|
9
9
|
]
|
10
10
|
end
|
11
11
|
|
12
|
-
view :core do
|
13
|
-
|
14
|
-
CGI.escapeHTML _render_raw(args)
|
15
|
-
elsif @mainline
|
16
|
-
"(*head)"
|
17
|
-
else
|
18
|
-
_render_raw(args)
|
19
|
-
end
|
12
|
+
view :core, cache: :never do
|
13
|
+
root.first_head? ? _render_raw : CGI.escapeHTML(_render_raw)
|
20
14
|
end
|
21
15
|
|
22
16
|
def head_meta
|
@@ -86,7 +80,9 @@ format :html do
|
|
86
80
|
|
87
81
|
def rss_link
|
88
82
|
opts = { format: :rss }
|
89
|
-
root.search_params[:vars]
|
83
|
+
if root.search_params[:vars]
|
84
|
+
root.search_params[:vars].each { |key, val| opts["_#{key}"] = val }
|
85
|
+
end
|
90
86
|
href = page_path root.card.cardname, opts
|
91
87
|
tag "link", rel: "alternate", type: "application/rss+xml",
|
92
88
|
title: "RSS", href: href
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::All::AllCss do
|
4
|
-
it "
|
4
|
+
it "renders content view" do
|
5
5
|
content = "#box { display: block }"
|
6
6
|
rendered = render_card :content, { content: content }, format: :css
|
7
7
|
# rendered.should =~ /Style Card\:/
|
@@ -72,17 +72,20 @@ describe Card::Set::All::Base do
|
|
72
72
|
|
73
73
|
it "renders template rule of embed cards based on set" do
|
74
74
|
Card::Auth.as_bot
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
structure_card = Card.create!(
|
76
|
+
name: "test_card+*right+*structure",
|
77
|
+
type_id: Card::HTMLID,
|
78
|
+
content: "{{_left+test_another_card|content|content;"\
|
79
|
+
"structure:test_another_card_structure}}"
|
80
|
+
)
|
79
81
|
Card.create! name: "test_another_card+*right+*structure",
|
80
82
|
type_id: Card::SearchTypeID,
|
81
83
|
content: ' {"type":"basic","left":"_1"}'
|
82
|
-
html = card.format.render_open
|
83
84
|
href = "/test_another_card+*right?view=template_editor"
|
84
85
|
text = "_left+test_another_card|content|content;"\
|
85
86
|
"structure:test_another_card_structure"
|
87
|
+
|
88
|
+
html = structure_card.format.render_open
|
86
89
|
expect(html).to have_tag("a", with: { class: "slotter", href: href },
|
87
90
|
text: text)
|
88
91
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
describe Card::Set::All::Json, "JSON mod" do
|
4
4
|
context "status view" do
|
5
|
-
it "
|
5
|
+
it "handles real and virtual cards" do
|
6
6
|
jf = Card::Format::JsonFormat
|
7
7
|
real_json = jf.new(Card["T"]).show :status, {}
|
8
8
|
expect(JSON[real_json]).to eq(
|
@@ -14,7 +14,7 @@ describe Card::Set::All::Json, "JSON mod" do
|
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "treats both unknown and unreadable cards as unknown" do
|
18
18
|
Card::Auth.as Card::AnonymousID do
|
19
19
|
jf = Card::Format::JsonFormat
|
20
20
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::All::Rss do
|
4
|
-
it "
|
4
|
+
it "renders recent.rss" do
|
5
5
|
rendered = Card[:recent].format(:rss).show(nil, {})
|
6
6
|
expect(rendered).to match(/xml/)
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "handles faulty search queries" do
|
10
10
|
bad_search = Card.create! name: "Bad Search",
|
11
11
|
type: "Search", content: "not no search"
|
12
12
|
rendered = bad_search.format(:rss).render_feed_body
|
13
|
-
expect(rendered).to have_tag("item", text: /
|
13
|
+
expect(rendered).to have_tag("item", text: /Card::Error::BadQuery/)
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "handles bad queries" do
|
17
17
|
bad_search = Card.create! name: "Bad Search",
|
18
18
|
type: "Search", content: '{"found_by":"home"}'
|
19
19
|
rendered = bad_search.format(:rss).render_feed_body
|
@@ -1,12 +1,10 @@
|
|
1
1
|
format :html do
|
2
|
-
view :editor do
|
3
|
-
text_area :content,
|
4
|
-
rows: 5,
|
5
|
-
class: "card-content",
|
2
|
+
view :editor do
|
3
|
+
text_area :content, rows: 5, class: "card-content",
|
6
4
|
"data-card-type-code" => card.type_code
|
7
5
|
end
|
8
6
|
|
9
|
-
view :core do
|
7
|
+
view :core do
|
10
8
|
process_content CGI.escapeHTML(_render_raw)
|
11
9
|
end
|
12
10
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
describe Card::Set::Type::PlainText do
|
4
|
-
it "
|
4
|
+
it "has special editor" do
|
5
5
|
assert_view_select render_editor("Plain Text"), 'textarea[rows="5"]'
|
6
6
|
end
|
7
7
|
|
8
|
-
it "
|
8
|
+
it "has special content that escapes HTML" do
|
9
9
|
expect(render_card(:core, type: "Plain Text", content: "<b></b>"))
|
10
10
|
.to eq "<b></b>"
|
11
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bootstrap/component_loader'
|
2
|
+
require 'bootstrap/component'
|
3
|
+
|
4
|
+
class Bootstrap
|
5
|
+
include Delegate
|
6
|
+
extend ComponentLoader
|
7
|
+
load_components
|
8
|
+
|
9
|
+
def initialize context=nil
|
10
|
+
@context = context
|
11
|
+
end
|
12
|
+
|
13
|
+
def render *args, &block
|
14
|
+
instance_exec *args, &block
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#require 'component'
|
2
|
+
|
3
|
+
class Bootstrap
|
4
|
+
module BasicTags
|
5
|
+
def html content
|
6
|
+
add_content String(content).html_safe
|
7
|
+
""
|
8
|
+
end
|
9
|
+
|
10
|
+
Component.add_div_method :div, nil do |opts, extra_args|
|
11
|
+
prepend_class opts, extra_args.first if extra_args.present?
|
12
|
+
opts
|
13
|
+
end
|
14
|
+
|
15
|
+
Component.add_div_method :span, nil do |opts, extra_args|
|
16
|
+
prepend_class opts, extra_args.first if extra_args.present?
|
17
|
+
opts
|
18
|
+
end
|
19
|
+
|
20
|
+
Component.add_tag_method :tag, nil, tag: :yield do |opts, extra_args|
|
21
|
+
prepend_class opts, extra_args[1] if extra_args[1].present?
|
22
|
+
opts[:tag] = extra_args[0]
|
23
|
+
opts
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#! no set module
|
2
|
+
class Bootstrap
|
3
|
+
class Component
|
4
|
+
def initialize context, *args, &block
|
5
|
+
@context = context
|
6
|
+
@content = ["".html_safe]
|
7
|
+
@args = args
|
8
|
+
@child_args = []
|
9
|
+
@append = []
|
10
|
+
@build_block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def render format, *args, &block
|
15
|
+
new(format, *args, &block).render
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_div_method name, html_class, opts={}, &tag_block
|
19
|
+
add_tag_method name, html_class, opts.merge(tag: :div), &tag_block
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_tag_method name, html_class, tag_opts={}, &tag_block
|
23
|
+
define_method name do |*args, &block|
|
24
|
+
process_tag tag_opts[:tag] || name do
|
25
|
+
content, opts, new_child_args = standardize_args args, &tag_block
|
26
|
+
add_classes opts, html_class, tag_opts.delete(:optional_classes)
|
27
|
+
if (attributes = tag_opts.delete(:attributes))
|
28
|
+
opts.merge! attributes
|
29
|
+
end
|
30
|
+
|
31
|
+
content = with_child_args new_child_args do
|
32
|
+
generate_content content,
|
33
|
+
tag_opts[:content_processor],
|
34
|
+
&block
|
35
|
+
end
|
36
|
+
|
37
|
+
[content, opts]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def render
|
44
|
+
@rendered = begin
|
45
|
+
render_content
|
46
|
+
@content[-1]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def prepend &block
|
51
|
+
tmp = @content.pop
|
52
|
+
instance_exec &block
|
53
|
+
@content << tmp
|
54
|
+
end
|
55
|
+
|
56
|
+
def insert &block
|
57
|
+
instance_exec &block
|
58
|
+
end
|
59
|
+
|
60
|
+
def append &block
|
61
|
+
@append[-1] << block
|
62
|
+
end
|
63
|
+
|
64
|
+
# def wrap
|
65
|
+
# tmp = @content.pop
|
66
|
+
# @content << yield(tmp)
|
67
|
+
# end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def render_content
|
72
|
+
#if @build_block.arity > 0
|
73
|
+
instance_exec *@args, &@build_block
|
74
|
+
end
|
75
|
+
|
76
|
+
def generate_content content, processor, &block
|
77
|
+
content = instance_exec &block if block.present?
|
78
|
+
return content if !processor || !content.is_a?(Array)
|
79
|
+
content.each { |item| send processor, item }
|
80
|
+
""
|
81
|
+
end
|
82
|
+
|
83
|
+
def with_child_args args
|
84
|
+
@child_args << args if args.present?
|
85
|
+
res = yield
|
86
|
+
@child_args.pop if args.present?
|
87
|
+
res
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def add_content content
|
92
|
+
@content[-1] << "\n#{content}".html_safe if content.present?
|
93
|
+
end
|
94
|
+
|
95
|
+
def process_tag tag_name
|
96
|
+
@content.push "".html_safe
|
97
|
+
@append << []
|
98
|
+
content, opts = yield
|
99
|
+
add_content content
|
100
|
+
collected_content = @content.pop
|
101
|
+
tag_name = opts.delete(:tag) if tag_name == :yield
|
102
|
+
add_content content_tag(tag_name, collected_content, opts, false)
|
103
|
+
@append.pop.each do |block|
|
104
|
+
add_content instance_exec(&block)
|
105
|
+
end
|
106
|
+
""
|
107
|
+
end
|
108
|
+
|
109
|
+
def standardize_args args, &block
|
110
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
111
|
+
items = ((args.one? && args.last.is_a?(String)) || args.last.is_a?(Array)) &&
|
112
|
+
args.pop
|
113
|
+
if block.present?
|
114
|
+
opts, args = instance_exec opts, args, &block
|
115
|
+
unless opts.is_a?(Hash)
|
116
|
+
raise Card::Error, "first return value of a tag block has to be a hash"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
[items, opts, args]
|
121
|
+
end
|
122
|
+
|
123
|
+
def add_classes opts, html_class, optional_classes
|
124
|
+
prepend_class opts, html_class if html_class
|
125
|
+
Array.wrap(optional_classes).each do |k, v|
|
126
|
+
prepend_class opts, v if opts.delete k
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
include BasicTags
|
131
|
+
include Delegate
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Bootstrap
|
2
|
+
class Component
|
3
|
+
class Form < Component
|
4
|
+
def render_content *args
|
5
|
+
form *args, &@build_block
|
6
|
+
end
|
7
|
+
|
8
|
+
add_tag_method :form, nil, optional_classes: {
|
9
|
+
horizontal: "form-horizontal",
|
10
|
+
inline: "form-inline" }
|
11
|
+
add_div_method :group, "form-group"
|
12
|
+
add_tag_method :label, nil
|
13
|
+
add_tag_method :input, "form-control" do |opts, extra_args|
|
14
|
+
type, label = extra_args
|
15
|
+
prepend { label label, for: opts[:id] } if label
|
16
|
+
opts[:type] = type
|
17
|
+
opts
|
18
|
+
end
|
19
|
+
|
20
|
+
[:text, :password, :datetime, :"datetime-local", :date, :month, :time,
|
21
|
+
:week, :number, :email, :url, :search, :tel, :color].each do |tag|
|
22
|
+
add_tag_method tag, "form-control", attributes: { type: tag },
|
23
|
+
tag: :input do |opts, extra_args|
|
24
|
+
label, = extra_args
|
25
|
+
prepend { label label, for: opts[:id] } if label
|
26
|
+
opts
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Bootstrap
|
2
|
+
class Component
|
3
|
+
class HorizontalForm < Form
|
4
|
+
def left_col_width
|
5
|
+
@child_args.last && @child_args.last[0] || 2
|
6
|
+
end
|
7
|
+
|
8
|
+
def right_col_width
|
9
|
+
@child_args.last && @child_args.last[1] || 10
|
10
|
+
end
|
11
|
+
|
12
|
+
add_tag_method :form, "form-horizontal"
|
13
|
+
|
14
|
+
add_tag_method :label, "control-label" do |opts, extra_args|
|
15
|
+
prepend_class opts, "col-sm-#{left_col_width}"
|
16
|
+
opts
|
17
|
+
end
|
18
|
+
|
19
|
+
add_div_method :input, nil do |opts, extra_args|
|
20
|
+
type, label = extra_args
|
21
|
+
prepend { tag :label, nil, for: opts[:id] } if label
|
22
|
+
insert { inner_input opts.merge(type: type) }
|
23
|
+
{ class: "col-sm-#{right_col_width}" }
|
24
|
+
end
|
25
|
+
add_tag_method :inner_input, "form-control", tag: :input
|
26
|
+
add_div_method :inner_checkbox, "checkbox"
|
27
|
+
|
28
|
+
add_div_method :checkbox, nil do |opts, extra_args|
|
29
|
+
inner_checkbox do
|
30
|
+
label do
|
31
|
+
inner_input "checkbox", extra_args.first, opts
|
32
|
+
end
|
33
|
+
end
|
34
|
+
{ class: "col-sm-offset-#{left_col_width} col-sm-#{right_col_width}" }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|