qbrick 2.5.0.pre → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +69 -379
- data/Rakefile +4 -4
- data/app/assets/images/logo.png +0 -0
- data/app/assets/javascripts/{kuhsaft → qbrick}/application.js.coffee +1 -1
- data/app/assets/javascripts/{kuhsaft → qbrick}/cms/application.js.coffee.erb +40 -17
- data/app/assets/javascripts/{kuhsaft → qbrick}/views/read_more_view.js.coffee +0 -0
- data/app/assets/stylesheets/{kuhsaft → qbrick}/application.css.sass +0 -0
- data/app/assets/stylesheets/{kuhsaft → qbrick}/cms/application.css.sass +38 -1
- data/app/assets/stylesheets/{kuhsaft → qbrick}/modules/_text_brick.css.sass +1 -1
- data/app/controllers/{kuhsaft → qbrick}/api/pages_controller.rb +2 -2
- data/app/controllers/qbrick/cms/accounts_controller.rb +28 -0
- data/app/controllers/qbrick/cms/admins_controller.rb +79 -0
- data/app/controllers/{kuhsaft → qbrick}/cms/assets_controller.rb +9 -9
- data/app/controllers/qbrick/cms/backend_controller.rb +25 -0
- data/app/controllers/{kuhsaft → qbrick}/cms/bricks_controller.rb +16 -13
- data/app/controllers/{kuhsaft → qbrick}/cms/ckimages_controller.rb +6 -6
- data/app/controllers/qbrick/cms/pages_controller.rb +87 -0
- data/app/controllers/qbrick/cms/settings_collections_controller.rb +26 -0
- data/app/controllers/{kuhsaft → qbrick}/pages_controller.rb +10 -5
- data/app/controllers/{kuhsaft → qbrick}/sitemaps_controller.rb +3 -3
- data/app/helpers/cms_helper.rb +4 -4
- data/app/helpers/pages_helper.rb +18 -10
- data/app/helpers/{kuhsaft → qbrick}/admin_helper.rb +2 -2
- data/app/helpers/qbrick/cms/admin_helper.rb +73 -0
- data/app/helpers/{kuhsaft → qbrick}/cms/pages_helper.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/accordion_brick.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/accordion_item_brick.rb +1 -1
- data/app/models/qbrick/admin.rb +8 -0
- data/app/models/{kuhsaft → qbrick}/anchor_brick.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/asset.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/asset_brick.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/brick.rb +11 -8
- data/app/models/{kuhsaft → qbrick}/brick_type.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/brick_type_filter.rb +4 -4
- data/app/models/{kuhsaft → qbrick}/ckimage.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/cms.rb +2 -2
- data/app/models/qbrick/cms_model.rb +25 -0
- data/app/models/{kuhsaft → qbrick}/column_brick.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/image_brick.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/image_size.rb +3 -3
- data/app/models/{kuhsaft → qbrick}/link_brick.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/page.rb +78 -17
- data/app/models/{kuhsaft → qbrick}/page_type.rb +3 -2
- data/app/models/{kuhsaft → qbrick}/partition.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/placeholder_brick.rb +4 -4
- data/app/models/{kuhsaft → qbrick}/publish_state.rb +1 -1
- data/app/models/qbrick/setting.rb +13 -0
- data/app/models/qbrick/settings_collection.rb +10 -0
- data/app/models/{kuhsaft → qbrick}/slider_brick.rb +3 -3
- data/app/models/{kuhsaft → qbrick}/text_brick.rb +1 -1
- data/app/models/{kuhsaft → qbrick}/two_column_brick.rb +2 -2
- data/app/models/{kuhsaft → qbrick}/video_brick.rb +1 -1
- data/app/uploaders/qbrick/asset_brick_asset_uploader.rb +26 -0
- data/app/uploaders/{kuhsaft → qbrick}/asset_uploader.rb +3 -2
- data/app/uploaders/{kuhsaft → qbrick}/ckimage_uploader.rb +1 -1
- data/app/uploaders/{kuhsaft → qbrick}/image_brick_image_uploader.rb +4 -4
- data/app/views/devise/confirmations/new.html.haml +10 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/mailer/unlock_instructions.html.haml +5 -0
- data/app/views/devise/passwords/edit.html.haml +10 -0
- data/app/views/devise/passwords/new.html.haml +8 -0
- data/app/views/devise/registrations/edit.html.haml +9 -0
- data/app/views/devise/registrations/new.html.haml +21 -0
- data/app/views/devise/sessions/new.html.haml +12 -0
- data/app/views/devise/shared/_links.html.haml +19 -0
- data/app/views/devise/unlocks/new.html.haml +10 -0
- data/app/views/layouts/devise.html.haml +16 -0
- data/app/views/layouts/{kuhsaft → qbrick}/cms/application.html.haml +4 -5
- data/app/views/layouts/qbrick/cms/ckimages.html.haml +18 -0
- data/app/views/{kuhsaft → qbrick}/accordion_bricks/_accordion_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/accordion_bricks/accordion_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/accordion_item_bricks/_accordion_item_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/accordion_item_bricks/accordion_item_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/anchor_bricks/_anchor_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/anchor_bricks/anchor_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/asset_bricks/_asset_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/asset_bricks/asset_brick/_edit.html.haml +1 -1
- data/app/views/qbrick/cms/accounts/edit.html.haml +12 -0
- data/app/views/qbrick/cms/admins/_form.html.haml +10 -0
- data/app/views/qbrick/cms/admins/edit.html.haml +5 -0
- data/app/views/qbrick/cms/admins/index.html.haml +26 -0
- data/app/views/qbrick/cms/admins/new.html.haml +5 -0
- data/app/views/{kuhsaft → qbrick}/cms/assets/_form.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/assets/_list.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/assets/edit.html.haml +0 -0
- data/app/views/qbrick/cms/assets/index.html.haml +3 -0
- data/app/views/{kuhsaft → qbrick}/cms/assets/new.html.haml +0 -0
- data/app/views/qbrick/cms/backend/_brick_clone_menu.html.haml +16 -0
- data/app/views/qbrick/cms/backend/_brick_type_dropdown.html.haml +15 -0
- data/app/views/{kuhsaft/cms/admin → qbrick/cms/backend}/_empty_state.html.haml +0 -0
- data/app/views/{kuhsaft/cms/admin → qbrick/cms/backend}/_flash.html.haml +0 -0
- data/app/views/qbrick/cms/backend/_main_navigation.html.haml +20 -0
- data/app/views/{kuhsaft → qbrick}/cms/bricks/_brick_header.html.haml +4 -4
- data/app/views/{kuhsaft → qbrick}/cms/bricks/_brick_item.html.haml +6 -5
- data/app/views/{kuhsaft → qbrick}/cms/bricks/_brick_list.html.haml +1 -1
- data/app/views/{kuhsaft → qbrick}/cms/bricks/_new.html.haml +3 -3
- data/app/views/{kuhsaft → qbrick}/cms/bricks/_sort_form.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/bricks/create.js.erb +1 -1
- data/app/views/{kuhsaft → qbrick}/cms/bricks/destroy.js.erb +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/bricks/new.js.erb +1 -1
- data/app/views/{kuhsaft → qbrick}/cms/bricks/update.js.erb +1 -1
- data/app/views/{kuhsaft → qbrick}/cms/ckimages/create.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/ckimages/destroy.js.erb +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/ckimages/index.html.haml +1 -1
- data/app/views/{kuhsaft → qbrick}/cms/pages/_branch.html.haml +4 -4
- data/app/views/{kuhsaft → qbrick}/cms/pages/_form.html.haml +15 -6
- data/app/views/qbrick/cms/pages/_mirror_modal.html.haml +52 -0
- data/app/views/qbrick/cms/pages/edit.html.haml +16 -0
- data/app/views/{kuhsaft → qbrick}/cms/pages/index.html.haml +1 -1
- data/app/views/qbrick/cms/pages/mirror.js.haml +5 -0
- data/app/views/qbrick/cms/pages/new.html.haml +1 -0
- data/app/views/{kuhsaft → qbrick}/cms/pages/show.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/cms/pages/sort.js.erb +0 -0
- data/app/views/qbrick/cms/settings_collections/_form.html.haml +8 -0
- data/app/views/qbrick/cms/settings_collections/index.html.haml +6 -0
- data/app/views/{kuhsaft → qbrick}/column_bricks/_column_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/column_bricks/column_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/image_bricks/_image_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/image_bricks/image_brick/_edit.html.haml +1 -1
- data/app/views/{kuhsaft → qbrick}/link_bricks/_link_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/link_bricks/link_brick/_edit.html.haml +1 -1
- data/app/views/{kuhsaft → qbrick}/pages/index.html.haml +2 -2
- data/app/views/{kuhsaft → qbrick}/pages/show.html.haml +2 -0
- data/app/views/{kuhsaft → qbrick}/placeholder_bricks/_placeholder_brick.html.haml +0 -0
- data/app/views/qbrick/placeholder_bricks/placeholder_brick/_edit.html.haml +1 -0
- data/app/views/{kuhsaft → qbrick}/search/_form.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/search/_results.html.haml +2 -2
- data/app/views/{kuhsaft → qbrick}/search/_results_entry.html.haml +1 -1
- data/app/views/{kuhsaft → qbrick}/sitemaps/index.xml.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/slider_bricks/_slider_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/slider_bricks/slider_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/text_bricks/_text_brick.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/text_bricks/text_brick/_edit.html.haml +0 -0
- data/app/views/{kuhsaft → qbrick}/two_column_bricks/_two_column_brick.html.haml +1 -1
- data/app/views/qbrick/two_column_bricks/two_column_brick/_childs.html.haml +5 -0
- data/app/views/qbrick/two_column_bricks/two_column_brick/_edit.html.haml +1 -0
- data/app/views/{kuhsaft → qbrick}/video_bricks/_video_brick.html.haml +2 -2
- data/app/views/{kuhsaft → qbrick}/video_bricks/video_brick/_edit.html.haml +1 -1
- data/config/initializers/devise.rb +259 -0
- data/config/locales/cms.de.yml +11 -0
- data/config/locales/cms.en.yml +11 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/locales/models/qbrick/accordion_brick/de.yml +4 -0
- data/config/locales/models/qbrick/accordion_brick/en.yml +4 -0
- data/config/locales/models/qbrick/accordion_item_brick/de.yml +7 -0
- data/config/locales/models/qbrick/accordion_item_brick/en.yml +7 -0
- data/config/locales/models/qbrick/admin/de.yml +13 -0
- data/config/locales/models/qbrick/admin/en.yml +13 -0
- data/config/locales/models/{kuhsaft → qbrick}/anchor_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/anchor_brick/en.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/asset_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/asset_brick/en.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/brick/de.yml +1 -1
- data/config/locales/models/{kuhsaft → qbrick}/brick/en.yml +1 -1
- data/config/locales/models/qbrick/column_brick/de.yml +4 -0
- data/config/locales/models/qbrick/column_brick/en.yml +4 -0
- data/config/locales/models/{kuhsaft → qbrick}/image_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/image_brick/en.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/image_size/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/image_size/en.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/link_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/link_brick/en.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/page/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/page/en.yml +3 -2
- data/config/locales/models/{kuhsaft → qbrick}/placeholder_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/placeholder_brick/en.yml +2 -2
- data/config/locales/models/qbrick/slider_brick/de.yml +4 -0
- data/config/locales/models/qbrick/slider_brick/en.yml +4 -0
- data/config/locales/models/{kuhsaft → qbrick}/text_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/text_brick/en.yml +2 -2
- data/config/locales/models/qbrick/two_column_brick/de.yml +7 -0
- data/config/locales/models/qbrick/two_column_brick/en.yml +7 -0
- data/config/locales/models/{kuhsaft → qbrick}/video_brick/de.yml +2 -2
- data/config/locales/models/{kuhsaft → qbrick}/video_brick/en.yml +2 -2
- data/config/locales/views/qbrick/cms/admin/de.yml +36 -0
- data/config/locales/views/{kuhsaft → qbrick}/cms/admin/en.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/cms/bricks/de.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/cms/bricks/en.yml +1 -1
- data/config/locales/views/qbrick/cms/navigation.yml +8 -0
- data/config/locales/views/{kuhsaft → qbrick}/cms/pages/de.yml +14 -1
- data/config/locales/views/{kuhsaft → qbrick}/cms/pages/en.yml +1 -1
- data/config/locales/views/qbrick/cms/settings_collection/de.yml +14 -0
- data/config/locales/views/qbrick/cms/settings_collection/en.yml +14 -0
- data/config/locales/views/{kuhsaft → qbrick}/image_brick/de.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/image_brick/en.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/search/de.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/search/en.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/text_brick/de.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/text_brick/en.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/video_brick/de.yml +1 -1
- data/config/locales/views/{kuhsaft → qbrick}/video_brick/en.yml +1 -1
- data/config/routes.rb +14 -2
- data/db/migrate/{01_create_kuhsaft_pages.rb → 01_create_qbrick_pages.rb} +5 -5
- data/db/migrate/{02_create_kuhsaft_bricks.rb → 02_create_qbrick_bricks.rb} +3 -3
- data/db/migrate/03_create_qbrick_brick_types.rb +12 -0
- data/db/migrate/04_create_qbrick_assets.rb +10 -0
- data/db/migrate/05_remove_cms_admin.rb +3 -3
- data/db/migrate/06_add_template_name_to_qbrick_bricks.rb +7 -0
- data/db/migrate/07_add_default_value_to_brick_type_enabled.rb +2 -2
- data/db/migrate/08_add_display_styles_to_bricks.rb +1 -1
- data/db/migrate/09_add_additional_fields_to_qbrick_bricks.rb +6 -0
- data/db/migrate/10_add_redirect_url_to_qbrick_pages.rb +7 -0
- data/db/migrate/11_update_url_and_redirect_url_value.rb +2 -2
- data/db/migrate/12_regenerate_fulltext.rb +1 -1
- data/db/migrate/13_add_page_title_to_pages.rb +1 -1
- data/db/migrate/14_move_qbrick_assets.rb +22 -0
- data/db/migrate/15_add_alt_text_to_bricks.rb +1 -1
- data/db/migrate/16_update_default_value_for_page_type.rb +2 -2
- data/db/migrate/17_set_page_type_to_content_for_empty_fields.rb +2 -2
- data/db/migrate/18_add_identifier_to_qbrick_pages.rb +6 -0
- data/db/migrate/19_add_col_count_to_bricks.rb +1 -1
- data/db/migrate/20_create_qbrick_ckimages.rb +9 -0
- data/db/migrate/21_add_google_verification_key_to_qbrick_pages.rb +5 -0
- data/db/migrate/22_create_settings.rb +15 -0
- data/db/migrate/22_create_settings_collections.rb +11 -0
- data/db/migrate/23_add_metadata_to_asset.rb +6 -0
- data/db/migrate/23_devise_create_qbrick_admins.rb +42 -0
- data/db/seeds.rb +36 -13
- data/lib/generators/{kuhsaft → qbrick}/assets/install_generator.rb +5 -5
- data/lib/generators/qbrick/custom_model_generator.rb +117 -0
- data/lib/generators/{kuhsaft → qbrick}/translations/add_generator.rb +4 -4
- data/lib/qbrick.rb +24 -0
- data/lib/{kuhsaft → qbrick}/brick_list.rb +3 -3
- data/lib/{kuhsaft → qbrick}/engine.rb +5 -5
- data/lib/{kuhsaft → qbrick}/gridded.rb +1 -1
- data/lib/{kuhsaft → qbrick}/image_uploader_mounting.rb +2 -2
- data/lib/{kuhsaft → qbrick}/orderable.rb +1 -1
- data/lib/{kuhsaft → qbrick}/page_tree.rb +1 -1
- data/lib/{kuhsaft → qbrick}/partial_extractor.rb +1 -1
- data/lib/{kuhsaft → qbrick}/searchable.rb +5 -3
- data/lib/{kuhsaft → qbrick}/touch_placeholders.rb +4 -4
- data/lib/{kuhsaft → qbrick}/translatable.rb +1 -1
- data/lib/qbrick/version.rb +3 -0
- data/lib/tasks/{kuhsaft_tasks.rake → qbrick_tasks.rake} +5 -5
- data/lib/templates/{kuhsaft → qbrick}/assets/ck-config.js.coffee +0 -0
- data/lib/templates/{kuhsaft → qbrick}/assets/customizations.css.sass +0 -0
- data/lib/templates/{kuhsaft → qbrick}/assets/customizations.js.coffee +0 -0
- data/lib/templates/qbrick/custom_model_generator/base_controller.rb +17 -0
- data/lib/templates/qbrick/custom_model_generator/inherited_views/base/_form.html.haml +12 -0
- data/lib/templates/qbrick/custom_model_generator/inherited_views/base/edit.html.haml +5 -0
- data/lib/templates/qbrick/custom_model_generator/inherited_views/base/index.html.haml +28 -0
- data/lib/templates/qbrick/custom_model_generator/inherited_views/base/new.html.haml +5 -0
- data/lib/templates/qbrick/custom_model_generator/translations/qbrick_base.yml +11 -0
- data/lib/templates/qbrick/custom_model_generator/translations/resource.yml.erb +14 -0
- data/lib/templates/qbrick/translations/add_translation.erb +8 -0
- data/spec/command_wrapper_helper.rb +21 -0
- data/spec/controllers/{kuhsaft → qbrick}/api/pages_controller_spec.rb +5 -5
- data/spec/controllers/qbrick/cms/pages_controller_spec.rb +61 -0
- data/spec/controllers/{kuhsaft → qbrick}/pages_controller_spec.rb +11 -13
- data/spec/controllers/{kuhsaft → qbrick}/sitemaps_controller_spec.rb +2 -2
- data/spec/dummy/app/assets/javascripts/{kuhsaft → qbrick}/cms/ck-config.js.coffee +0 -0
- data/spec/dummy/app/assets/javascripts/{kuhsaft → qbrick}/cms/customizations.js.coffee +0 -0
- data/spec/dummy/app/assets/stylesheets/{kuhsaft → qbrick}/cms/customizations.css.sass +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/config/application.rb +3 -2
- data/spec/dummy/config/database.yml +2 -2
- data/spec/dummy/config/environments/production.rb +2 -2
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/{kuhsaft.rb → qbrick.rb} +1 -1
- data/spec/dummy/config/routes.rb +4 -1
- data/spec/factories.rb +24 -9
- data/spec/features/administrator_management_spec.rb +70 -0
- data/spec/features/cms_pages_spec.rb +15 -11
- data/spec/features/search_spec.rb +15 -15
- data/spec/features_helper.rb +36 -0
- data/spec/generators/custom_model_generator_spec.rb +83 -0
- data/spec/helpers/{kuhsaft → qbrick}/cms/admin_helper_spec.rb +5 -5
- data/spec/helpers/{kuhsaft → qbrick}/cms/pages_helper_spec.rb +6 -6
- data/spec/helpers/{kuhsaft → qbrick}/pages_helper_spec.rb +4 -5
- data/spec/lib/brick_list_spec.rb +12 -11
- data/spec/lib/engine_spec.rb +5 -9
- data/spec/lib/gridded_spec.rb +4 -5
- data/spec/lib/image_uploader_mounting_spec.rb +3 -4
- data/spec/lib/page_tree_spec.rb +5 -5
- data/spec/lib/searchable_spec.rb +7 -8
- data/spec/lib/touch_placeholders_spec.rb +4 -5
- data/spec/lib/translatable_spec.rb +20 -20
- data/spec/models/accordion_brick_spec.rb +7 -8
- data/spec/models/accordion_item_brick_spec.rb +8 -9
- data/spec/models/anchor_brick_spec.rb +5 -6
- data/spec/models/asset_brick_spec.rb +8 -9
- data/spec/models/asset_spec.rb +9 -11
- data/spec/models/brick_spec.rb +34 -34
- data/spec/models/brick_type_filter_spec.rb +14 -14
- data/spec/models/column_brick_spec.rb +6 -7
- data/spec/models/image_brick_spec.rb +9 -10
- data/spec/models/image_size_spec.rb +8 -8
- data/spec/models/link_brick_spec.rb +9 -10
- data/spec/models/page_spec.rb +113 -73
- data/spec/models/placeholder_brick_spec.rb +12 -13
- data/spec/models/publish_state_spec.rb +7 -7
- data/spec/models/setting_spec.rb +28 -0
- data/spec/models/slider_brick_spec.rb +5 -6
- data/spec/models/text_brick_spec.rb +5 -5
- data/spec/models/two_column_brick_spec.rb +14 -15
- data/spec/models/video_brick_spec.rb +5 -6
- data/spec/postgres_helper.rb +66 -0
- data/spec/{kuhsaft_spec.rb → qbrick_spec.rb} +2 -2
- data/spec/spec_helper.rb +23 -10
- data/spec/support/{kuhsaft_spec_helper.rb → qbrick_spec_helper.rb} +1 -1
- data/spec/support/write_expectation.rb +2 -2
- data/spec/views/{kuhsaft → qbrick}/sitemaps/index.xml.haml_spec.rb +3 -3
- metadata +451 -330
- data/app/controllers/kuhsaft/cms/admin_controller.rb +0 -18
- data/app/controllers/kuhsaft/cms/pages_controller.rb +0 -71
- data/app/helpers/kuhsaft/cms/admin_helper.rb +0 -21
- data/app/uploaders/kuhsaft/asset_brick_asset_uploader.rb +0 -43
- data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +0 -14
- data/app/views/kuhsaft/cms/admin/_content_language_switch.html.haml +0 -7
- data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +0 -6
- data/app/views/kuhsaft/cms/assets/index.html.haml +0 -3
- data/app/views/kuhsaft/cms/pages/edit.html.haml +0 -16
- data/app/views/kuhsaft/cms/pages/new.html.haml +0 -1
- data/app/views/kuhsaft/placeholder_bricks/placeholder_brick/_edit.html.haml +0 -1
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_childs.html.haml +0 -5
- data/app/views/kuhsaft/two_column_bricks/two_column_brick/_edit.html.haml +0 -1
- data/app/views/layouts/kuhsaft/cms/ckimages.html.haml +0 -18
- data/config/locales/models/kuhsaft/accordion_brick/de.yml +0 -4
- data/config/locales/models/kuhsaft/accordion_brick/en.yml +0 -4
- data/config/locales/models/kuhsaft/accordion_item_brick/de.yml +0 -7
- data/config/locales/models/kuhsaft/accordion_item_brick/en.yml +0 -7
- data/config/locales/models/kuhsaft/column_brick/de.yml +0 -4
- data/config/locales/models/kuhsaft/column_brick/en.yml +0 -4
- data/config/locales/models/kuhsaft/slider_brick/de.yml +0 -4
- data/config/locales/models/kuhsaft/slider_brick/en.yml +0 -4
- data/config/locales/models/kuhsaft/two_column_brick/de.yml +0 -7
- data/config/locales/models/kuhsaft/two_column_brick/en.yml +0 -7
- data/config/locales/views/kuhsaft/cms/admin/de.yml +0 -13
- data/db/migrate/03_create_kuhsaft_brick_types.rb +0 -12
- data/db/migrate/04_create_kuhsaft_assets.rb +0 -10
- data/db/migrate/06_add_template_name_to_kuhsaft_bricks.rb +0 -7
- data/db/migrate/09_add_additional_fields_to_kuhsaft_bricks.rb +0 -6
- data/db/migrate/10_add_redirect_url_to_kuhsaft_pages.rb +0 -7
- data/db/migrate/14_move_kuhsaft_assets.rb +0 -22
- data/db/migrate/18_add_identifier_to_kuhsaft_pages.rb +0 -6
- data/db/migrate/20_create_kuhsaft_ckimages.rb +0 -9
- data/lib/kuhsaft.rb +0 -22
- data/lib/kuhsaft/version.rb +0 -3
- data/lib/templates/kuhsaft/translations/add_translation.erb +0 -8
data/spec/models/brick_spec.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Qbrick::Brick, type: :model do
|
|
4
4
|
let :brick do
|
|
5
|
-
|
|
5
|
+
Qbrick::Brick.new
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
describe '#valid?' do
|
|
9
9
|
it 'sets a default position' do
|
|
10
|
-
brick.
|
|
10
|
+
expect(brick).to receive(:set_position)
|
|
11
11
|
brick.valid?
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -16,7 +16,7 @@ describe Kuhsaft::Brick do
|
|
|
16
16
|
context 'witout a position' do
|
|
17
17
|
it 'sets a default' do
|
|
18
18
|
brick.set_position
|
|
19
|
-
brick.position.
|
|
19
|
+
expect(brick.position).to be(1)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -29,90 +29,90 @@ describe Kuhsaft::Brick do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe '#brick_list_type' do
|
|
32
|
-
it 'returns
|
|
33
|
-
brick.brick_list_type.
|
|
32
|
+
it 'returns Qbrick::Brick' do
|
|
33
|
+
expect(brick.brick_list_type).to eq('Qbrick::Brick')
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
describe '#parents' do
|
|
38
38
|
it 'returns the chain of parents' do
|
|
39
|
-
item1, item2, item3 = double, double,
|
|
40
|
-
item2.
|
|
41
|
-
item3.
|
|
42
|
-
item3.parents.
|
|
39
|
+
item1, item2, item3 = double, double, Qbrick::Brick.new
|
|
40
|
+
allow(item2).to receive(:brick_list).and_return(item1)
|
|
41
|
+
allow(item3).to receive(:brick_list).and_return(item2)
|
|
42
|
+
expect(item3.parents).to eq([item1, item2])
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
describe '#to_edit_partial_path' do
|
|
47
47
|
it 'returns the path to the form partial' do
|
|
48
|
-
|
|
48
|
+
expect(Qbrick::TextBrick.new.to_edit_partial_path).to eq('qbrick/text_bricks/text_brick/edit')
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
describe '#has_siblings?' do
|
|
53
53
|
it 'returns false if the brick has no siblings' do
|
|
54
|
-
brick =
|
|
55
|
-
brick.has_siblings
|
|
54
|
+
brick = Qbrick::Brick.new
|
|
55
|
+
expect(brick.has_siblings?).to be_falsey
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it 'returns true if the brick has siblings' do
|
|
59
|
-
item1, item2, item3 = double, double,
|
|
60
|
-
item1.
|
|
61
|
-
item2.
|
|
62
|
-
item3.
|
|
63
|
-
item3.has_siblings
|
|
59
|
+
item1, item2, item3 = double, double, Qbrick::Brick.new
|
|
60
|
+
allow(item1).to receive(:bricks).and_return([item2, item3])
|
|
61
|
+
allow(item2).to receive(:brick_list).and_return(item1)
|
|
62
|
+
allow(item3).to receive(:brick_list).and_return(item1)
|
|
63
|
+
expect(item3.has_siblings?).to be_truthy
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
describe '#to_edit_childs_partial_path' do
|
|
68
68
|
it 'returns the path to the form partial' do
|
|
69
|
-
|
|
69
|
+
expect(Qbrick::TextBrick.new.to_edit_childs_partial_path).to eq('qbrick/text_bricks/text_brick/childs')
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
describe '#bricks' do
|
|
74
74
|
it 'can not have childs by default' do
|
|
75
|
-
brick.
|
|
75
|
+
expect(brick).not_to respond_to(:bricks)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
describe '#to_style_class' do
|
|
80
80
|
it 'returns a css classname' do
|
|
81
|
-
|
|
81
|
+
expect(Qbrick::TextBrick.new.to_style_class).to eq('qbrick-text-brick')
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
describe '#to_style_id' do
|
|
86
86
|
it 'returns a unique DOM id' do
|
|
87
|
-
brick =
|
|
88
|
-
brick.
|
|
89
|
-
brick.to_style_id.
|
|
87
|
+
brick = Qbrick::TextBrick.new
|
|
88
|
+
allow(brick).to receive(:id).and_return(104)
|
|
89
|
+
expect(brick.to_style_id).to eq('qbrick-text-brick-104')
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
describe '#backend_label' do
|
|
94
94
|
it 'returns the name of the brick' do
|
|
95
|
-
brick =
|
|
96
|
-
brick.backend_label.
|
|
95
|
+
brick = Qbrick::TextBrick.new
|
|
96
|
+
expect(brick.backend_label).to eq('Text')
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
brick =
|
|
101
|
-
brick.backend_label(parenthesis: true).
|
|
99
|
+
it 'with the parenthesis option given' do
|
|
100
|
+
brick = Qbrick::TextBrick.new
|
|
101
|
+
expect(brick.backend_label(parenthesis: true)).to eq '(Text)'
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
describe '#uploader?' do
|
|
106
106
|
it 'returns false' do
|
|
107
|
-
brick.uploader
|
|
107
|
+
expect(brick.uploader?).to be_falsey
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
describe '#after_save' do
|
|
112
112
|
describe 'update_fulltext' do
|
|
113
113
|
let! :brick do
|
|
114
|
-
|
|
115
|
-
b.type =
|
|
114
|
+
Qbrick::Brick.new.tap do |b|
|
|
115
|
+
b.type = 'Qbrick::TextBrick'
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -124,8 +124,8 @@ describe Kuhsaft::Brick do
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it 'updates fulltext on bricklist after saving a single brick' do
|
|
127
|
-
brick.brick_list.
|
|
128
|
-
brick.brick_list.
|
|
127
|
+
expect(brick.brick_list).to receive(:update_fulltext)
|
|
128
|
+
expect(brick.brick_list).to receive(:save!)
|
|
129
129
|
brick.text = 'foobar'
|
|
130
130
|
brick.save
|
|
131
131
|
end
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Qbrick::BrickTypeFilter, type: :model do
|
|
4
4
|
let :brick_list do
|
|
5
|
-
|
|
5
|
+
Qbrick::Page.new
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
let :brick_type_filter do
|
|
9
|
-
|
|
9
|
+
Qbrick::BrickTypeFilter.new(brick_list)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe '#empty?' do
|
|
13
13
|
context 'when the user cant add childs' do
|
|
14
14
|
before do
|
|
15
|
-
brick_list.
|
|
15
|
+
allow(brick_list).to receive(:user_can_add_childs?).and_return(false)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it 'returns true' do
|
|
19
|
-
brick_type_filter.empty
|
|
19
|
+
expect(brick_type_filter.empty?).to be_truthy
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
context 'when there are no bricks to be added' do
|
|
24
24
|
before do
|
|
25
|
-
brick_type_filter.
|
|
25
|
+
allow(brick_type_filter).to receive(:allowed).and_return([])
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'returns true' do
|
|
29
|
-
brick_type_filter.empty
|
|
29
|
+
expect(brick_type_filter.empty?).to be_truthy
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -34,28 +34,28 @@ describe Kuhsaft::BrickTypeFilter do
|
|
|
34
34
|
describe '#allowed' do
|
|
35
35
|
context 'when no brick types are registered' do
|
|
36
36
|
it 'returns an empty array' do
|
|
37
|
-
|
|
38
|
-
brick_type_filter.allowed.
|
|
37
|
+
allow(Qbrick::BrickType).to receive_message_chain(:count, :zero?).and_return(true)
|
|
38
|
+
expect(brick_type_filter.allowed).to be_empty
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
context 'when brick types are registered' do
|
|
43
43
|
before do
|
|
44
|
-
|
|
44
|
+
allow(Qbrick::BrickType).to receive_message_chain(:enabled, :count, :zero?).and_return(false)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
context 'when there are no constraints' do
|
|
48
48
|
it 'returns all enabled brick types' do
|
|
49
|
-
brick_list.
|
|
50
|
-
|
|
49
|
+
allow(brick_list).to receive(:allowed_brick_types).and_return([])
|
|
50
|
+
expect(Qbrick::BrickType).to receive(:enabled)
|
|
51
51
|
brick_type_filter.allowed
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
context 'when there are constraints' do
|
|
56
56
|
it 'constrains the enabled types' do
|
|
57
|
-
brick_list.
|
|
58
|
-
|
|
57
|
+
allow(brick_list).to receive(:allowed_brick_types).and_return(['Qbrick::TextBrick'])
|
|
58
|
+
expect(Qbrick::BrickType.enabled).to receive(:constrained).with(['Qbrick::TextBrick'])
|
|
59
59
|
brick_type_filter.allowed
|
|
60
60
|
end
|
|
61
61
|
end
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
4
|
-
|
|
3
|
+
describe Qbrick::ColumnBrick, type: :model do
|
|
5
4
|
let :column_brick do
|
|
6
|
-
|
|
5
|
+
Qbrick::ColumnBrick.new
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
describe '#user_can_delete?' do
|
|
10
9
|
it 'returns false' do
|
|
11
|
-
column_brick.user_can_delete
|
|
10
|
+
expect(column_brick.user_can_delete?).to be_falsey
|
|
12
11
|
end
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
describe '#user_can_save' do
|
|
16
15
|
it 'returns false' do
|
|
17
|
-
column_brick.user_can_save
|
|
16
|
+
expect(column_brick.user_can_save?).to be_falsey
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
describe '#renders_own_childs?' do
|
|
22
21
|
it 'returns false' do
|
|
23
|
-
column_brick.renders_own_childs
|
|
22
|
+
expect(column_brick.renders_own_childs?).to be_falsey
|
|
24
23
|
end
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
describe '#bricks' do
|
|
28
27
|
it 'can have childs' do
|
|
29
|
-
column_brick.
|
|
28
|
+
expect(column_brick).to respond_to(:bricks)
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
end
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
4
|
-
|
|
3
|
+
describe Qbrick::ImageBrick, type: :model do
|
|
5
4
|
let :image_brick do
|
|
6
|
-
|
|
5
|
+
Qbrick::ImageBrick.new
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
describe '#valid' do
|
|
@@ -13,7 +12,7 @@ describe Kuhsaft::ImageBrick do
|
|
|
13
12
|
|
|
14
13
|
context 'without an #image' do
|
|
15
14
|
it 'has en error' do
|
|
16
|
-
image_brick.
|
|
15
|
+
expect(image_brick.errors[:image].size).to eq(1)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
end
|
|
@@ -21,9 +20,9 @@ describe Kuhsaft::ImageBrick do
|
|
|
21
20
|
describe '#save' do
|
|
22
21
|
context 'when changing the image size' do
|
|
23
22
|
it 'regenerates the image version' do
|
|
24
|
-
image_brick.
|
|
25
|
-
image_brick.
|
|
26
|
-
image_brick.image.
|
|
23
|
+
allow(image_brick).to receive(:image_size_changed?).and_return(true)
|
|
24
|
+
allow(image_brick).to receive(:image_present?).and_return(true)
|
|
25
|
+
expect(image_brick.image).to receive(:recreate_versions!)
|
|
27
26
|
image_brick.resize_image_if_size_changed
|
|
28
27
|
end
|
|
29
28
|
end
|
|
@@ -31,19 +30,19 @@ describe Kuhsaft::ImageBrick do
|
|
|
31
30
|
|
|
32
31
|
describe '#bricks' do
|
|
33
32
|
it 'can not have childs' do
|
|
34
|
-
image_brick.
|
|
33
|
+
expect(image_brick).not_to respond_to(:bricks)
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
describe '#user_can_add_childs?' do
|
|
39
38
|
it 'returns false' do
|
|
40
|
-
image_brick.user_can_add_childs
|
|
39
|
+
expect(image_brick.user_can_add_childs?).to be_falsey
|
|
41
40
|
end
|
|
42
41
|
end
|
|
43
42
|
|
|
44
43
|
describe '#uploader?' do
|
|
45
44
|
it 'returns true' do
|
|
46
|
-
image_brick.uploader
|
|
45
|
+
expect(image_brick.uploader?).to be_truthy
|
|
47
46
|
end
|
|
48
47
|
end
|
|
49
48
|
end
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Qbrick::ImageSize, type: :model do
|
|
4
4
|
before do
|
|
5
|
-
|
|
5
|
+
Qbrick::ImageSize.build_defaults!
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
describe '.build_defaults!' do
|
|
9
9
|
it 'sets the default sizes' do
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
expect(Qbrick::ImageSize.all).to eq([Qbrick::ImageSize.gallery_size,
|
|
11
|
+
Qbrick::ImageSize.teaser_size])
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
describe '.clear!' do
|
|
16
16
|
before do
|
|
17
|
-
|
|
17
|
+
Qbrick::ImageSize.clear!
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'empties the list' do
|
|
21
|
-
|
|
21
|
+
expect(Qbrick::ImageSize.all).to be_empty
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
describe '.add' do
|
|
26
26
|
it 'adds a new image size' do
|
|
27
|
-
expect {
|
|
27
|
+
expect { Qbrick::ImageSize.add(:stuff, 200, 100) }.to change(Qbrick::ImageSize.all, :count).by(1)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
describe '.find_by_name' do
|
|
32
32
|
it 'returns the size' do
|
|
33
|
-
|
|
33
|
+
expect(Qbrick::ImageSize.find_by_name('gallery')).to eq(Qbrick::ImageSize.gallery_size)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
4
|
-
|
|
3
|
+
describe Qbrick::LinkBrick, type: :model do
|
|
5
4
|
let :link_brick do
|
|
6
|
-
|
|
5
|
+
Qbrick::LinkBrick.new
|
|
7
6
|
end
|
|
8
7
|
|
|
9
8
|
describe '#valid' do
|
|
@@ -13,39 +12,39 @@ describe Kuhsaft::LinkBrick do
|
|
|
13
12
|
|
|
14
13
|
context 'without a #href' do
|
|
15
14
|
it 'has en error' do
|
|
16
|
-
link_brick.
|
|
15
|
+
expect(link_brick.errors[:href].count).to eq(1)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
context 'without a #caption' do
|
|
21
20
|
it 'has an error' do
|
|
22
|
-
link_brick.
|
|
21
|
+
expect(link_brick.errors[:caption].count).to eq(1)
|
|
23
22
|
end
|
|
24
23
|
end
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
describe '#bricks' do
|
|
28
27
|
it 'can not have childs' do
|
|
29
|
-
link_brick.
|
|
28
|
+
expect(link_brick).not_to respond_to(:bricks)
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
describe '.styles' do
|
|
34
33
|
it 'returns the available link styles' do
|
|
35
|
-
|
|
34
|
+
expect(Qbrick::LinkBrick.styles).to eq(%w(pdf word excel button external))
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
describe '#to_style_class' do
|
|
40
39
|
it 'includes the link style' do
|
|
41
|
-
link_brick.
|
|
42
|
-
link_brick.to_style_class.
|
|
40
|
+
allow(link_brick).to receive(:link_style).and_return('pdf')
|
|
41
|
+
expect(link_brick.to_style_class).to eq('qbrick-link-brick pdf')
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
describe '#user_can_add_childs?' do
|
|
47
46
|
it 'returns false' do
|
|
48
|
-
link_brick.user_can_add_childs
|
|
47
|
+
expect(link_brick.user_can_add_childs?).to be_falsey
|
|
49
48
|
end
|
|
50
49
|
end
|
|
51
50
|
end
|
data/spec/models/page_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Qbrick::Page, type: :model do
|
|
4
4
|
# subject { described_class }
|
|
5
5
|
|
|
6
6
|
describe '.search' do
|
|
@@ -9,47 +9,47 @@ describe Kuhsaft::Page do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it 'should find any containing the search term' do
|
|
12
|
-
|
|
12
|
+
expect(Qbrick::Page.search('lorem').size).to be >= 0
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it 'should find with "English Title"' do
|
|
16
|
-
|
|
16
|
+
expect(Qbrick::Page.search('English Title').size).to be >= 1
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'should only find published results' do
|
|
20
|
-
|
|
20
|
+
expect(Qbrick::Page.search('English Title')).to be_all { |p| p.published? == true }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'should find by using the old api' do
|
|
24
|
-
|
|
24
|
+
expect(Qbrick::Page.search('English')).to eq(Qbrick::Page.search('English'))
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
describe '.position_of' do
|
|
29
29
|
it 'should find the position of a page' do
|
|
30
30
|
page = create(:page)
|
|
31
|
-
|
|
31
|
+
expect(Qbrick::Page.position_of(page.id)).to eq(page.position)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
describe '.find_by_url' do
|
|
36
36
|
it 'should find its translated content by url' do
|
|
37
37
|
page = create(:page)
|
|
38
|
-
|
|
38
|
+
expect(Qbrick::Page.find_by_url(page.url)).to eq(page)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
describe '.flat_tree' do
|
|
43
43
|
it 'should create an ordered, flat list of the page tree' do
|
|
44
44
|
tree = create_page_tree
|
|
45
|
-
|
|
45
|
+
expect(Qbrick::Page.flat_tree).to eq(tree)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
describe '#initialize' do
|
|
50
50
|
context 'without values' do
|
|
51
51
|
let :page do
|
|
52
|
-
|
|
52
|
+
Qbrick::Page.new
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
before do
|
|
@@ -57,11 +57,11 @@ describe Kuhsaft::Page do
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it 'has a mandatory title' do
|
|
60
|
-
page.
|
|
60
|
+
expect(page.errors[:title].count).to eq(1)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
it 'has a mandatory slug' do
|
|
64
|
-
page.
|
|
64
|
+
expect(page.errors[:slug].count).to eq(1)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -69,30 +69,29 @@ describe Kuhsaft::Page do
|
|
|
69
69
|
describe '#published' do
|
|
70
70
|
it 'returns only published pages' do
|
|
71
71
|
_p1, p2, _p3 = 3.times.map { create(:page) }
|
|
72
|
-
p2.update_attribute :published,
|
|
73
|
-
|
|
72
|
+
p2.update_attribute :published, Qbrick::PublishState::UNPUBLISHED
|
|
73
|
+
expect(Qbrick::Page.published).to be_all { |p| expect(p.published?).to be_truthy }
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
describe '#content_page' do
|
|
78
78
|
it 'returns only content pages' do
|
|
79
79
|
p1, p2, p3 = 3.times.map { create(:page) }
|
|
80
|
-
p2.update_attribute :page_type,
|
|
81
|
-
|
|
80
|
+
p2.update_attribute :page_type, Qbrick::PageType::REDIRECT
|
|
81
|
+
expect(Qbrick::Page.content_page).to eq([p1, p3])
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
describe '#state_class' do
|
|
86
|
-
|
|
87
|
-
let(:page) { Kuhsaft::Page.new }
|
|
86
|
+
let(:page) { Qbrick::Page.new }
|
|
88
87
|
|
|
89
88
|
it 'returns publsihed as string when page is published' do
|
|
90
|
-
page.published =
|
|
89
|
+
page.published = Qbrick::PublishState::PUBLISHED
|
|
91
90
|
expect(page.state_class).to eq 'published'
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
it 'returns unpublsihed as string when page is unpublished' do
|
|
95
|
-
page.published =
|
|
94
|
+
page.published = Qbrick::PublishState::UNPUBLISHED
|
|
96
95
|
expect(page.state_class).to eq 'unpublished'
|
|
97
96
|
end
|
|
98
97
|
end
|
|
@@ -100,8 +99,8 @@ describe Kuhsaft::Page do
|
|
|
100
99
|
describe '#without_self' do
|
|
101
100
|
it 'returns pages but not itself' do
|
|
102
101
|
2.times { create(:page) }
|
|
103
|
-
page =
|
|
104
|
-
page.without_self.
|
|
102
|
+
page = Qbrick::Page.first
|
|
103
|
+
expect(page.without_self).not_to include(page)
|
|
105
104
|
end
|
|
106
105
|
end
|
|
107
106
|
|
|
@@ -120,19 +119,19 @@ describe Kuhsaft::Page do
|
|
|
120
119
|
|
|
121
120
|
context 'on the topmost level' do
|
|
122
121
|
it 'has a label representing it\'s nesting depth without a leading dash' do
|
|
123
|
-
page.nesting_name.
|
|
122
|
+
expect(page.nesting_name).to eq(page.title)
|
|
124
123
|
end
|
|
125
124
|
end
|
|
126
125
|
|
|
127
126
|
context 'on the first level' do
|
|
128
127
|
it 'should have a label with one dash' do
|
|
129
|
-
child_page.nesting_name.
|
|
128
|
+
expect(child_page.nesting_name).to eq("- #{child_page.title}")
|
|
130
129
|
end
|
|
131
130
|
end
|
|
132
131
|
|
|
133
132
|
context 'on the second level' do
|
|
134
133
|
it 'should have a label with two dashes' do
|
|
135
|
-
child_child_page.nesting_name.
|
|
134
|
+
expect(child_child_page.nesting_name).to eq("-- #{child_child_page.title}")
|
|
136
135
|
end
|
|
137
136
|
end
|
|
138
137
|
end
|
|
@@ -147,11 +146,11 @@ describe Kuhsaft::Page do
|
|
|
147
146
|
end
|
|
148
147
|
|
|
149
148
|
it 'has a list of parent pages' do
|
|
150
|
-
child_page.parent_pages.
|
|
149
|
+
expect(child_page.parent_pages).to eq([page])
|
|
151
150
|
end
|
|
152
151
|
|
|
153
152
|
it 'is ordered from top to bottom' do
|
|
154
|
-
child_page.parent_pages.last.
|
|
153
|
+
expect(child_page.parent_pages.last).to eq(page)
|
|
155
154
|
end
|
|
156
155
|
end
|
|
157
156
|
|
|
@@ -162,7 +161,7 @@ describe Kuhsaft::Page do
|
|
|
162
161
|
child = create(:page, parent: page)
|
|
163
162
|
page.body = nil
|
|
164
163
|
page.save
|
|
165
|
-
page.link.
|
|
164
|
+
expect(page.link).to eq(child.link)
|
|
166
165
|
end
|
|
167
166
|
end
|
|
168
167
|
end
|
|
@@ -172,7 +171,7 @@ describe Kuhsaft::Page do
|
|
|
172
171
|
page = create :page
|
|
173
172
|
position = page.position
|
|
174
173
|
page.increment_position
|
|
175
|
-
page.position.
|
|
174
|
+
expect(page.position).to eq(position + 1)
|
|
176
175
|
end
|
|
177
176
|
end
|
|
178
177
|
|
|
@@ -181,7 +180,7 @@ describe Kuhsaft::Page do
|
|
|
181
180
|
page = create :page
|
|
182
181
|
position = page.position
|
|
183
182
|
page.decrement_position
|
|
184
|
-
page.position.
|
|
183
|
+
expect(page.position).to eq(position - 1)
|
|
185
184
|
end
|
|
186
185
|
end
|
|
187
186
|
|
|
@@ -190,7 +189,7 @@ describe Kuhsaft::Page do
|
|
|
190
189
|
_page1 = create :page
|
|
191
190
|
page2 = create :page
|
|
192
191
|
page3 = create :page
|
|
193
|
-
page3.preceding_sibling.id.
|
|
192
|
+
expect(page3.preceding_sibling.id).to eq(page2.id)
|
|
194
193
|
end
|
|
195
194
|
end
|
|
196
195
|
|
|
@@ -199,7 +198,7 @@ describe Kuhsaft::Page do
|
|
|
199
198
|
_page1 = create :page
|
|
200
199
|
page2 = create :page
|
|
201
200
|
page3 = create :page
|
|
202
|
-
page2.succeeding_sibling.id.
|
|
201
|
+
expect(page2.succeeding_sibling.id).to eq(page3.id)
|
|
203
202
|
end
|
|
204
203
|
end
|
|
205
204
|
|
|
@@ -209,14 +208,14 @@ describe Kuhsaft::Page do
|
|
|
209
208
|
_page2 = create :page
|
|
210
209
|
page3 = create :page
|
|
211
210
|
page3.reposition page1.id
|
|
212
|
-
page3.preceding_sibling.id.
|
|
211
|
+
expect(page3.preceding_sibling.id).to eq(page1.id)
|
|
213
212
|
end
|
|
214
213
|
|
|
215
214
|
it 'repositions before all siblings, specified by nil' do
|
|
216
215
|
_page1 = create :page
|
|
217
216
|
page2 = create :page
|
|
218
217
|
page2.reposition nil
|
|
219
|
-
page2.position.
|
|
218
|
+
expect(page2.position).to eq(1)
|
|
220
219
|
end
|
|
221
220
|
end
|
|
222
221
|
|
|
@@ -227,12 +226,12 @@ describe Kuhsaft::Page do
|
|
|
227
226
|
|
|
228
227
|
it 'has a slug by default' do
|
|
229
228
|
page.save
|
|
230
|
-
page.slug.
|
|
229
|
+
expect(page.slug).to eq(page.title.parameterize)
|
|
231
230
|
end
|
|
232
231
|
|
|
233
232
|
context 'when it is empty' do
|
|
234
233
|
it 'generates the slug' do
|
|
235
|
-
page.
|
|
234
|
+
expect(page).to receive(:create_slug)
|
|
236
235
|
page.save
|
|
237
236
|
end
|
|
238
237
|
end
|
|
@@ -241,7 +240,7 @@ describe Kuhsaft::Page do
|
|
|
241
240
|
it 'takes the slug provided by the user' do
|
|
242
241
|
page.slug = 'my-slug'
|
|
243
242
|
page.save
|
|
244
|
-
page.slug.
|
|
243
|
+
expect(page.slug).to eq('my-slug')
|
|
245
244
|
end
|
|
246
245
|
end
|
|
247
246
|
end
|
|
@@ -251,29 +250,29 @@ describe Kuhsaft::Page do
|
|
|
251
250
|
it 'returns the concatenated slug of the whole child/parent tree' do
|
|
252
251
|
page = create(:page, slug: 'parent-slug')
|
|
253
252
|
child = create(:page, slug: 'child-slug', parent: page)
|
|
254
|
-
child.url.
|
|
253
|
+
expect(child.url).to eq('en/parent-slug/child-slug')
|
|
255
254
|
end
|
|
256
255
|
end
|
|
257
256
|
|
|
258
257
|
context 'when it is a navigation? page' do
|
|
259
258
|
it 'returns without the parent page slug' do
|
|
260
|
-
page = create(:page, slug: 'parent-slug', page_type:
|
|
259
|
+
page = create(:page, slug: 'parent-slug', page_type: Qbrick::PageType::NAVIGATION)
|
|
261
260
|
child = create(:page, slug: 'child-slug', parent: page)
|
|
262
|
-
child.url.
|
|
261
|
+
expect(child.url).to eq('en/child-slug')
|
|
263
262
|
end
|
|
264
263
|
end
|
|
265
264
|
|
|
266
265
|
context 'when it is a redirect? page' do
|
|
267
266
|
it 'returns the absolute url' do
|
|
268
|
-
page = create(:page, page_type:
|
|
269
|
-
page.link.
|
|
267
|
+
page = create(:page, page_type: Qbrick::PageType::REDIRECT, redirect_url: 'en/references', slug: 'news')
|
|
268
|
+
expect(page.link).to eq('/en/news')
|
|
270
269
|
end
|
|
271
270
|
end
|
|
272
271
|
|
|
273
272
|
context 'when url part is empty' do
|
|
274
273
|
it 'strips the trailing slash' do
|
|
275
|
-
page = create(:page, page_type:
|
|
276
|
-
page.link.
|
|
274
|
+
page = create(:page, page_type: Qbrick::PageType::NAVIGATION)
|
|
275
|
+
expect(page.link).to eq('/en')
|
|
277
276
|
end
|
|
278
277
|
end
|
|
279
278
|
end
|
|
@@ -281,13 +280,13 @@ describe Kuhsaft::Page do
|
|
|
281
280
|
describe '#navigation?' do
|
|
282
281
|
context 'when the page_type is navigation' do
|
|
283
282
|
it 'returns true if the page_type is PageType::NAVIGATION' do
|
|
284
|
-
|
|
283
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::NAVIGATION).navigation?).to be_truthy
|
|
285
284
|
end
|
|
286
285
|
end
|
|
287
286
|
|
|
288
287
|
context 'when the page_type is anything else' do
|
|
289
288
|
it 'returns false' do
|
|
290
|
-
|
|
289
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::REDIRECT).navigation?).to be_falsey
|
|
291
290
|
end
|
|
292
291
|
end
|
|
293
292
|
end
|
|
@@ -295,41 +294,41 @@ describe Kuhsaft::Page do
|
|
|
295
294
|
describe '#redirect?' do
|
|
296
295
|
context 'when the page_type is a redirect' do
|
|
297
296
|
it 'returns true' do
|
|
298
|
-
|
|
297
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::REDIRECT).redirect?).to be_truthy
|
|
299
298
|
end
|
|
300
299
|
end
|
|
301
300
|
|
|
302
301
|
context 'when the page type is anything else' do
|
|
303
302
|
it 'returns false' do
|
|
304
|
-
|
|
303
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::NAVIGATION).redirect?).to be_falsey
|
|
305
304
|
end
|
|
306
305
|
end
|
|
307
306
|
end
|
|
308
307
|
|
|
309
308
|
describe 'page types' do
|
|
310
309
|
it 'returns content by default' do
|
|
311
|
-
expect(
|
|
310
|
+
expect(Qbrick::Page.new.page_type).to eq('content')
|
|
312
311
|
end
|
|
313
312
|
|
|
314
313
|
it 'returns navigation if set' do
|
|
315
|
-
expect(
|
|
314
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::NAVIGATION).page_type).to eq('navigation')
|
|
316
315
|
end
|
|
317
316
|
|
|
318
317
|
it 'returns redirect if set' do
|
|
319
|
-
expect(
|
|
318
|
+
expect(Qbrick::Page.new(page_type: Qbrick::PageType::REDIRECT).page_type).to eq('redirect')
|
|
320
319
|
end
|
|
321
320
|
end
|
|
322
321
|
|
|
323
322
|
describe '#translated?' do
|
|
324
323
|
it 'returns true when page is translated' do
|
|
325
324
|
@page = create(:page, title: 'Page 1', slug: 'page1')
|
|
326
|
-
expect(@page.translated?).to
|
|
325
|
+
expect(@page.translated?).to be_truthy
|
|
327
326
|
end
|
|
328
327
|
|
|
329
328
|
it 'returns false when page has no translation' do
|
|
330
329
|
@page = create(:page, title: 'Page 1', slug: 'page1')
|
|
331
330
|
I18n.with_locale :de do
|
|
332
|
-
expect(@page.translated?).to
|
|
331
|
+
expect(@page.translated?).to be_falsey
|
|
333
332
|
end
|
|
334
333
|
end
|
|
335
334
|
end
|
|
@@ -337,19 +336,19 @@ describe Kuhsaft::Page do
|
|
|
337
336
|
describe '#fulltext' do
|
|
338
337
|
let :page do
|
|
339
338
|
create(:page, keywords: 'key words', description: 'descrip tion', title: 'my title').tap do |p|
|
|
340
|
-
p.bricks <<
|
|
339
|
+
p.bricks << Qbrick::TextBrick.new(locale: I18n.locale, text: 'oh la la')
|
|
341
340
|
p.save
|
|
342
341
|
end
|
|
343
342
|
end
|
|
344
343
|
|
|
345
344
|
context 'when saved' do
|
|
346
345
|
it 'it collects and assigns the fulltext' do
|
|
347
|
-
page.
|
|
346
|
+
expect(page).to receive(:collect_fulltext)
|
|
348
347
|
page.save
|
|
349
348
|
end
|
|
350
349
|
|
|
351
350
|
it 'contains the page part content' do
|
|
352
|
-
page.fulltext.
|
|
351
|
+
expect(page.fulltext).to include('oh la la')
|
|
353
352
|
end
|
|
354
353
|
|
|
355
354
|
it 'converts all data to strings' do
|
|
@@ -360,10 +359,10 @@ describe Kuhsaft::Page do
|
|
|
360
359
|
|
|
361
360
|
describe '#before_validation' do
|
|
362
361
|
it 'generates url automatically' do
|
|
363
|
-
page =
|
|
364
|
-
page.url.
|
|
362
|
+
page = Qbrick::Page.new slug: 'slug'
|
|
363
|
+
expect(page.url).to be_nil
|
|
365
364
|
page.valid?
|
|
366
|
-
page.url.
|
|
365
|
+
expect(page.url).to be_present
|
|
367
366
|
end
|
|
368
367
|
end
|
|
369
368
|
|
|
@@ -373,16 +372,16 @@ describe Kuhsaft::Page do
|
|
|
373
372
|
@parent_page = FactoryGirl.create(:page, slug: 'le_parent')
|
|
374
373
|
@child_page = FactoryGirl.create(:page, slug: 'le_child', parent: @parent_page)
|
|
375
374
|
|
|
376
|
-
@parent_page.update_attributes(page_type:
|
|
377
|
-
@child_page.reload.url.
|
|
375
|
+
@parent_page.update_attributes(page_type: Qbrick::PageType::NAVIGATION)
|
|
376
|
+
expect(@child_page.reload.url).to eq("#{I18n.locale}/le_child")
|
|
378
377
|
end
|
|
379
378
|
|
|
380
379
|
it 'updates the child pages url if parent is changed to content' do
|
|
381
|
-
@parent_page = FactoryGirl.create(:page, slug: 'le_parent', page_type:
|
|
380
|
+
@parent_page = FactoryGirl.create(:page, slug: 'le_parent', page_type: Qbrick::PageType::NAVIGATION)
|
|
382
381
|
@child_page = FactoryGirl.create(:page, slug: 'le_child', parent: @parent_page)
|
|
383
382
|
|
|
384
|
-
@parent_page.update_attributes(page_type:
|
|
385
|
-
@child_page.reload.url.
|
|
383
|
+
@parent_page.update_attributes(page_type: Qbrick::PageType::CONTENT)
|
|
384
|
+
expect(@child_page.reload.url).to eq("#{I18n.locale}/le_parent/le_child")
|
|
386
385
|
end
|
|
387
386
|
end
|
|
388
387
|
end
|
|
@@ -394,17 +393,17 @@ describe Kuhsaft::Page do
|
|
|
394
393
|
|
|
395
394
|
context 'without parent' do
|
|
396
395
|
it 'returns url without leading /' do
|
|
397
|
-
page.url_without_locale.
|
|
396
|
+
expect(page.url_without_locale).not_to start_with '/'
|
|
398
397
|
end
|
|
399
398
|
|
|
400
399
|
it 'returns a single slug' do
|
|
401
|
-
page.url_without_locale.
|
|
400
|
+
expect(page.url_without_locale).to eq('page')
|
|
402
401
|
end
|
|
403
402
|
end
|
|
404
403
|
|
|
405
404
|
context 'when parent is navigation' do
|
|
406
405
|
let :parent do
|
|
407
|
-
create(:page, page_type:
|
|
406
|
+
create(:page, page_type: Qbrick::PageType::NAVIGATION)
|
|
408
407
|
end
|
|
409
408
|
|
|
410
409
|
let :child do
|
|
@@ -412,11 +411,11 @@ describe Kuhsaft::Page do
|
|
|
412
411
|
end
|
|
413
412
|
|
|
414
413
|
it 'returns url without leading /' do
|
|
415
|
-
child.url_without_locale.
|
|
414
|
+
expect(child.url_without_locale).not_to start_with '/'
|
|
416
415
|
end
|
|
417
416
|
|
|
418
417
|
it 'does not concatenate the parent slug' do
|
|
419
|
-
child.url_without_locale.
|
|
418
|
+
expect(child.url_without_locale).to eq('child')
|
|
420
419
|
end
|
|
421
420
|
end
|
|
422
421
|
|
|
@@ -430,11 +429,11 @@ describe Kuhsaft::Page do
|
|
|
430
429
|
end
|
|
431
430
|
|
|
432
431
|
it 'returns url without leading /' do
|
|
433
|
-
child.url_without_locale.
|
|
432
|
+
expect(child.url_without_locale).not_to start_with '/'
|
|
434
433
|
end
|
|
435
434
|
|
|
436
435
|
it 'does not concatenate the parent slug' do
|
|
437
|
-
child.url_without_locale.
|
|
436
|
+
expect(child.url_without_locale).to eq('parent/child')
|
|
438
437
|
end
|
|
439
438
|
end
|
|
440
439
|
end
|
|
@@ -447,13 +446,13 @@ describe Kuhsaft::Page do
|
|
|
447
446
|
end
|
|
448
447
|
|
|
449
448
|
it 'returns all pages that have a translation' do
|
|
450
|
-
expect(
|
|
449
|
+
expect(Qbrick::Page.translated).to eq [@page_1, @page_2, @page_3]
|
|
451
450
|
end
|
|
452
451
|
|
|
453
452
|
it 'does not return untranslated pages' do
|
|
454
453
|
I18n.with_locale :de do
|
|
455
454
|
@page_1.update(title: 'Page 1 fr', slug: 'page_1_fr')
|
|
456
|
-
expect(
|
|
455
|
+
expect(Qbrick::Page.translated).to eq [@page_1]
|
|
457
456
|
end
|
|
458
457
|
end
|
|
459
458
|
end
|
|
@@ -466,7 +465,48 @@ describe Kuhsaft::Page do
|
|
|
466
465
|
end
|
|
467
466
|
|
|
468
467
|
it 'should be findable via scope' do
|
|
469
|
-
expect(
|
|
468
|
+
expect(Qbrick::Page.by_identifier(cat_page.identifier)).to eq(cat_page)
|
|
469
|
+
end
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
describe '#cloning' do
|
|
473
|
+
around(:each) do |example|
|
|
474
|
+
I18n.with_locale :de do
|
|
475
|
+
example.run
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
before do
|
|
480
|
+
@page = create(:page)
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
context 'clearing bricks in target locale' do
|
|
484
|
+
it 'does not affect pages other than the target page' do
|
|
485
|
+
another_page = create(:page)
|
|
486
|
+
FactoryGirl.create(:image_brick, brick_list_type: 'Qbrick::Page', brick_list_id: another_page.id)
|
|
487
|
+
expect { @page.clear_bricks_for_locale(:de) }.to_not change { another_page.bricks.count }
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
it 'should copy the asset to the cloned brick' do
|
|
492
|
+
FactoryGirl.create(:image_brick, brick_list_type: 'Qbrick::Page', brick_list_id: @page.id)
|
|
493
|
+
|
|
494
|
+
@page.clone_bricks_to(:en)
|
|
495
|
+
expect(@page.bricks.unscoped.where(locale: :en).first).to be_valid
|
|
496
|
+
end
|
|
497
|
+
|
|
498
|
+
it 'should copy all child bricks' do
|
|
499
|
+
accordion = Qbrick::Brick.create(type: 'Qbrick::AccordionBrick',
|
|
500
|
+
brick_list_type: 'Qbrick::Page',
|
|
501
|
+
brick_list_id: @page.id)
|
|
502
|
+
section = Qbrick::Brick.create(type: 'Qbrick::AccordionItemBrick',
|
|
503
|
+
caption: 'section',
|
|
504
|
+
brick_list_type: 'Qbrick::Brick',
|
|
505
|
+
brick_list_id: accordion.id)
|
|
506
|
+
FactoryGirl.create(:text_brick, brick_list_type: 'Qbrick::Brick', brick_list_id: section.id)
|
|
507
|
+
|
|
508
|
+
@page.clone_bricks_to(:en)
|
|
509
|
+
expect(@page.bricks.unscoped.where(locale: :en).count).to eq(3)
|
|
470
510
|
end
|
|
471
511
|
end
|
|
472
512
|
end
|