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
@@ -1,11 +1,17 @@
|
|
1
1
|
format :html do
|
2
|
-
def frame
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
def frame
|
3
|
+
class_up "card-header", "panel-heading"
|
4
|
+
class_up "card-header-title", "panel-title"
|
5
|
+
class_up "card-body", "panel-body"
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def standard_frame
|
10
|
+
class_up "card-frame", "panel panel-#{panel_state}"
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def panel_state
|
15
|
+
"default"
|
10
16
|
end
|
11
17
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
describe 'bootstrap builder' do
|
2
|
+
class BuilderTest < Card::Format::HtmlFormat::Bootstrap::Component
|
3
|
+
add_tag_method :test_tag, "test-class" do |opts, extra_args|
|
4
|
+
prepend { tag :prepend, "prepend-class" }
|
5
|
+
append { tag :append, "append-class" }
|
6
|
+
insert { tag :insert, "insert-class" }
|
7
|
+
#wrap { |content| tag :wrap, "wrap-class" { content } }
|
8
|
+
opts
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "tag create helper methods" do
|
13
|
+
subject do
|
14
|
+
fo = Card["A"].format(:html)
|
15
|
+
tag = BuilderTest.render(fo) { test_tag }
|
16
|
+
"<buildertest>#{tag}<buildertest>"
|
17
|
+
end
|
18
|
+
it 'appends work' do
|
19
|
+
#assert_select 'prepend[class="prepend-class"]'
|
20
|
+
assert_view_select subject, "buildertest" do
|
21
|
+
#assert_select 'prepend[class="prepend-class]"'
|
22
|
+
assert_select 'prepend[class="prepend-class]"'
|
23
|
+
assert_select 'test_tag[class="test-class"]' do
|
24
|
+
assert_select 'insert[class="insert-class]"'
|
25
|
+
end
|
26
|
+
|
27
|
+
assert_select 'append[class="append-class]"'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
describe Card::Bootstrap do
|
2
|
+
subject { described_class.new(format) }
|
3
|
+
let(:format) { Card["A"].format(:html) }
|
4
|
+
|
5
|
+
def render
|
6
|
+
subject.render do
|
7
|
+
yield
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it "loads components" do
|
12
|
+
expect(subject).to respond_to(:form)
|
13
|
+
expect(subject.form).to be_instance_of ActiveSupport::SafeBuffer
|
14
|
+
end
|
15
|
+
describe "html" do
|
16
|
+
it "renderes plain text" do
|
17
|
+
#expect(render { html "test" }).to eq "test"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Bootstrap::Component::Form do
|
4
4
|
describe "input" do
|
5
5
|
it "has form-group css class" do
|
6
6
|
assert_view_select render_editor("Phrase"),
|
@@ -14,4 +14,62 @@ describe Card::Set::All::Bootstrap::Form do
|
|
14
14
|
'textarea[class~="form-control"]'
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
describe "form" do
|
19
|
+
subject { Card["A"].format(:html) }
|
20
|
+
it "creates form" do
|
21
|
+
form =
|
22
|
+
subject.bs_form do
|
23
|
+
group do
|
24
|
+
input "email", "Email Address", id: "theemail"
|
25
|
+
input "password", "Password", id: "thepassword"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
expect(form).to have_tag :form do
|
29
|
+
with_tag 'div.form-group' do
|
30
|
+
with_tag :label, with: { for: "theemail" },
|
31
|
+
text: "\nEmail Address"
|
32
|
+
with_tag 'input.form-control', with: { type: "email", id: "theemail" }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "horizontal form" do
|
39
|
+
subject { Card["A"].format(:html) }
|
40
|
+
let(:form) do
|
41
|
+
subject.bs_horizontal_form 2, 10 do
|
42
|
+
group do
|
43
|
+
input "email", "Email Address", id: "theemail"
|
44
|
+
input "password", "Password", id: "thepassword"
|
45
|
+
end
|
46
|
+
group do
|
47
|
+
checkbox "test", "checkbox label", id: "thecheckbox"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
let(:bsform) do
|
52
|
+
subject.bs do
|
53
|
+
horizontal_form 2, 10 do
|
54
|
+
group do
|
55
|
+
input "email", "Email Address", id: "theemail"
|
56
|
+
input "password", "Password", id: "thepassword"
|
57
|
+
end
|
58
|
+
group do
|
59
|
+
checkbox "test", "checkbox label", id: "thecheckbox"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
it "creates form" do
|
65
|
+
assert_view_select bsform, 'form[class="form-horizontal"]' do
|
66
|
+
assert_select 'div[class="form-group"]' do
|
67
|
+
assert_select 'label[for="theemail"', text: "Email Address"
|
68
|
+
assert_select 'div[class="col-sm-10"]' do
|
69
|
+
assert_select 'input[type="email",id="theemail",class="form-control"]'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
17
75
|
end
|
@@ -1,31 +1,120 @@
|
|
1
|
-
describe
|
1
|
+
describe Bootstrap::Component::Layout do
|
2
2
|
describe "layout dsl" do
|
3
3
|
subject { Card["A"].format(:html) }
|
4
4
|
it "creates correct layout with column array" do
|
5
|
-
layout = subject.
|
6
|
-
|
7
|
-
["
|
5
|
+
layout = subject.bs_layout container: true, fluid: true do
|
6
|
+
row 6, 4, 2, class: "six-times-six" do
|
7
|
+
["c1", "c2", "c3"]
|
8
8
|
end
|
9
9
|
end
|
10
10
|
assert_view_select layout, 'div[class="container-fluid"]' do
|
11
|
-
assert_select 'div[class="six-times-six
|
12
|
-
assert_select 'div[class="col-md-6"]', text: "
|
13
|
-
assert_select 'div[class="col-md-4"]', text: "
|
14
|
-
assert_select 'div[class="col-md-2"]', text: "
|
11
|
+
assert_select 'div[class="row six-times-six"]' do
|
12
|
+
assert_select 'div[class="col-md-6"]', text: "c1"
|
13
|
+
assert_select 'div[class="col-md-4"]', text: "c2"
|
14
|
+
assert_select 'div[class="col-md-2"]', text: "c3"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
it "creates correct layout with column calls" do
|
20
|
-
layout = subject.
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
layout = subject.bs_layout do
|
21
|
+
row 8, 4, class: "six-times-six" do
|
22
|
+
column "c1"
|
23
|
+
column "c2", class: "extra-class"
|
24
24
|
end
|
25
25
|
end
|
26
|
-
assert_view_select layout, 'div[class="six-times-six
|
27
|
-
assert_select 'div[class="col-md-8"]', text: "
|
28
|
-
assert_select 'div[class="
|
26
|
+
assert_view_select layout, 'div[class="row six-times-six"]' do
|
27
|
+
assert_select 'div[class="col-md-8"]', text: "c1"
|
28
|
+
assert_select 'div[class="col-md-4 extra-class"]',
|
29
|
+
text: "c2"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "handles different medium sizes" do
|
34
|
+
layout = subject.bs_layout do
|
35
|
+
row md: [8, 4], xs: [6, 6], class: "six-times-six" do
|
36
|
+
column "c1"
|
37
|
+
column "c2", class: "extra-class"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
assert_view_select layout, 'div[class="row six-times-six"]' do
|
41
|
+
assert_select 'div[class="col-md-8 col-xs-6"]', text: "c1"
|
42
|
+
assert_select 'div[class="col-md-4 col-xs-6 extra-class"]',
|
43
|
+
text: "c2"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "works without column" do
|
48
|
+
layout = subject.bs_layout do
|
49
|
+
row do
|
50
|
+
"test"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
assert_view_select layout, 'div[class="row"]', text: "test"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "handles layout sequence" do
|
57
|
+
# format = Card["A"].form
|
58
|
+
lay = subject.bs do
|
59
|
+
layout do
|
60
|
+
row 8, 4 do
|
61
|
+
column "c1"
|
62
|
+
column "c2"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
layout do
|
67
|
+
row 12, class: "six-times-six" do
|
68
|
+
column "new column"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
# assert_view_select lay, 'div[class="row"]' do
|
73
|
+
# assert_select 'div[class="col-md-8"]', text: "c1"
|
74
|
+
# assert_select 'div[class="col-md-4"]', text: "c2"
|
75
|
+
# end
|
76
|
+
assert_view_select lay, 'div[class="row six-times-six"]' do
|
77
|
+
assert_select 'div[class="col-md-12"]', text: "new column"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it "handles nested layouts" do
|
82
|
+
# format = Card["A"].format :html
|
83
|
+
lay = subject.bs do
|
84
|
+
layout do
|
85
|
+
row 8, 4 do
|
86
|
+
column do
|
87
|
+
layout { row 12, ["c1"] }
|
88
|
+
end
|
89
|
+
column do
|
90
|
+
row 12, ["c2"]
|
91
|
+
row 6 do
|
92
|
+
html "<span>s1</span>"
|
93
|
+
column "c3"
|
94
|
+
end
|
95
|
+
row 8 do
|
96
|
+
"some content"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
assert_view_select lay, 'div[class="row"]' do
|
103
|
+
assert_select 'div[class="col-md-8"]' do
|
104
|
+
assert_select 'div[class="row"]' do
|
105
|
+
assert_select 'div[class="col-md-12"]', text: "c1"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
assert_select 'div[class="col-md-4"]' do
|
109
|
+
assert_select 'div[class="row"]' do
|
110
|
+
assert_select 'div[class="col-md-12"]', text: "c2"
|
111
|
+
end
|
112
|
+
assert_select 'div[class="row"]' do
|
113
|
+
assert_select 'div[class="col-md-6"]', text: "c3"
|
114
|
+
assert_select 'span', text: "s1"
|
115
|
+
end
|
116
|
+
assert_select 'div[class="row"]', text: "some content"
|
117
|
+
end
|
29
118
|
end
|
30
119
|
end
|
31
120
|
end
|
@@ -88,9 +88,10 @@ def delete_files_for_action action
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
def revision action
|
92
|
+
result = super action
|
93
|
+
result[:empty_ok] = true
|
94
|
+
result
|
94
95
|
end
|
95
96
|
|
96
97
|
def attachment_format ext
|
@@ -37,28 +37,22 @@ event :validate_storage_type_update, :validate,
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
event :loose_coded_status_on_update, :initialize,
|
41
|
-
on: :update, when: proc { |c| c.coded? } do
|
40
|
+
event :loose_coded_status_on_update, :initialize, on: :update, when: :coded? do
|
42
41
|
return if @new_mod
|
43
42
|
@new_storage_type ||= storage_type_from_config
|
44
43
|
end
|
45
44
|
|
46
|
-
event :update_public_link_on_create, :integrate,
|
47
|
-
on: :create,
|
48
|
-
when: proc { |c| c.local? } do
|
45
|
+
event :update_public_link_on_create, :integrate, on: :create, when: :local? do
|
49
46
|
update_public_link
|
50
47
|
end
|
51
48
|
|
52
|
-
event :remove_public_link_on_delete, :integrate,
|
53
|
-
on: :delete,
|
54
|
-
when: proc { |c| c.local? } do
|
49
|
+
event :remove_public_link_on_delete, :integrate, on: :delete, when: :local? do
|
55
50
|
remove_public_links
|
56
51
|
end
|
57
52
|
|
58
|
-
event :update_public_link, after: :update_read_rule,
|
59
|
-
when: proc { |c| c.local? } do
|
53
|
+
event :update_public_link, after: :update_read_rule, when: :local? do
|
60
54
|
return if content.blank?
|
61
|
-
if who_can(:read).include? Card
|
55
|
+
if who_can(:read).include? Card::AnyoneID
|
62
56
|
create_public_links
|
63
57
|
else
|
64
58
|
remove_public_links
|
@@ -16,18 +16,22 @@ end
|
|
16
16
|
include SelectedAction
|
17
17
|
|
18
18
|
format do
|
19
|
-
view :source do
|
19
|
+
view :source do
|
20
|
+
source_url
|
21
|
+
end
|
22
|
+
|
23
|
+
def source_url
|
20
24
|
card.attachment.url
|
21
25
|
end
|
22
26
|
|
23
|
-
view :core do
|
24
|
-
handle_source
|
27
|
+
view :core do
|
28
|
+
handle_source do |source|
|
25
29
|
card_url source
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
29
|
-
def handle_source
|
30
|
-
source =
|
33
|
+
def handle_source
|
34
|
+
source = source_url
|
31
35
|
source ? yield(source) : ""
|
32
36
|
rescue
|
33
37
|
"File Error"
|
@@ -36,31 +40,34 @@ end
|
|
36
40
|
|
37
41
|
format :file do
|
38
42
|
# returns send_file args. not in love with this...
|
39
|
-
view :core do |_args|
|
43
|
+
view :core, cache: :never do |_args|
|
40
44
|
# this means we only support known formats. dislike.
|
41
45
|
attachment_format = card.attachment_format(params[:format])
|
42
46
|
return _render_not_found unless attachment_format
|
43
47
|
return card.format(:html).render_core(args) if card.remote_storage?
|
48
|
+
set_response_headers
|
49
|
+
args_for_send_file
|
50
|
+
end
|
44
51
|
|
45
|
-
|
46
|
-
r.headers["Expires"] = 1.year.from_now.httpdate
|
47
|
-
# currently using default "private", because proxy servers could block
|
48
|
-
# needed permission checks
|
49
|
-
# r.headers["Cache-Control"] = "public"
|
50
|
-
end
|
51
|
-
|
52
|
-
# formerly supported redirecting to correct file format
|
53
|
-
# elsif ![format, 'file'].member? params[:format]
|
54
|
-
# path = request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format )
|
55
|
-
# return redirect_to(path) #card.attachment.url(style) )
|
52
|
+
def args_for_send_file
|
56
53
|
file = selected_file_version
|
57
|
-
[
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
[
|
55
|
+
file.path,
|
56
|
+
{
|
57
|
+
type: file.content_type,
|
58
|
+
filename: "#{card.cardname.safe_key}#{file.extension}",
|
59
|
+
x_sendfile: true,
|
60
|
+
disposition: (params[:format] == "file" ? "attachment" : "inline")
|
61
|
+
}
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def set_response_headers
|
66
|
+
return unless params[:explicit_file] && (r = controller.response)
|
67
|
+
r.headers["Expires"] = 1.year.from_now.httpdate
|
68
|
+
# currently using default "private", because proxy servers could block
|
69
|
+
# needed permission checks
|
70
|
+
# r.headers["Cache-Control"] = "public"
|
64
71
|
end
|
65
72
|
|
66
73
|
def selected_file_version
|
@@ -70,19 +77,19 @@ end
|
|
70
77
|
|
71
78
|
format :html do
|
72
79
|
view :core do |args|
|
73
|
-
handle_source
|
74
|
-
"<a href=\"#{source}\">Download #{showname
|
80
|
+
handle_source do |source|
|
81
|
+
"<a href=\"#{source}\">Download #{showname voo.title}</a>"
|
75
82
|
end
|
76
83
|
end
|
77
84
|
|
78
|
-
view :editor do
|
85
|
+
view :editor do
|
79
86
|
if card.web? || card.no_upload?
|
80
87
|
return text_field(:content, class: "card-content")
|
81
88
|
end
|
82
|
-
file_chooser
|
89
|
+
file_chooser
|
83
90
|
end
|
84
91
|
|
85
|
-
def preview
|
92
|
+
def preview
|
86
93
|
""
|
87
94
|
end
|
88
95
|
|
@@ -98,7 +105,7 @@ format :html do
|
|
98
105
|
<tr class="template-download fade in">
|
99
106
|
<td>
|
100
107
|
<span class="preview">
|
101
|
-
#{preview
|
108
|
+
#{preview}
|
102
109
|
</span>
|
103
110
|
</td>
|
104
111
|
<td>
|
@@ -125,10 +132,10 @@ format :html do
|
|
125
132
|
HTML
|
126
133
|
end
|
127
134
|
|
128
|
-
def file_chooser
|
135
|
+
def file_chooser
|
129
136
|
<<-HTML
|
130
137
|
<div class="choose-file">
|
131
|
-
#{preview
|
138
|
+
#{preview}
|
132
139
|
<span class="btn btn-success fileinput-button">
|
133
140
|
<i class="glyphicon glyphicon-cloud-upload"></i>
|
134
141
|
<span>
|