locomotive_cms 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -3
- data/README.textile +7 -7
- data/app/assets/images/locomotive/icons/flags/ja.png +0 -0
- data/app/assets/javascripts/locomotive/aloha.js.coffee +3 -0
- data/app/assets/javascripts/locomotive/models/page.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/models/site.js.coffee +16 -6
- data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +5 -0
- data/app/assets/javascripts/locomotive/views/my_account/edit_view.js.coffee +14 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +2 -1
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/de.js +1 -0
- data/app/assets/stylesheets/locomotive.css +1 -0
- data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +18 -3
- data/app/assets/stylesheets/locomotive/backoffice/layout.css.scss +1 -1
- data/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss +7 -3
- data/app/assets/stylesheets/locomotive/backoffice/pagination.css.scss +37 -0
- data/app/assets/stylesheets/locomotive/backoffice/tagit_changes.css.scss +49 -0
- data/app/cells/locomotive/content_locale_picker/show.html.haml +1 -1
- data/app/cells/locomotive/global_actions_cell.rb +8 -8
- data/app/cells/locomotive/main_menu/show.html.haml +2 -2
- data/app/cells/locomotive/main_menu_cell.rb +2 -2
- data/app/cells/locomotive/menu_cell.rb +6 -6
- data/app/cells/locomotive/partials_cell.rb +21 -0
- data/app/cells/locomotive/settings_menu_cell.rb +4 -4
- data/app/cells/locomotive/sub_menu/show.html.haml +2 -2
- data/app/cells/locomotive/sub_menu_cell.rb +1 -1
- data/app/controllers/locomotive/accounts_controller.rb +4 -4
- data/app/controllers/locomotive/api/accounts_controller.rb +1 -0
- data/app/controllers/locomotive/api/content_assets_controller.rb +1 -1
- data/app/controllers/locomotive/api/content_entries_controller.rb +1 -1
- data/app/controllers/locomotive/api/content_types_controller.rb +2 -2
- data/app/controllers/locomotive/api/pages_controller.rb +1 -1
- data/app/controllers/locomotive/api/snippets_controller.rb +1 -1
- data/app/controllers/locomotive/api/theme_assets_controller.rb +47 -0
- data/app/controllers/locomotive/api/tokens_controller.rb +2 -2
- data/app/controllers/locomotive/base_controller.rb +5 -2
- data/app/controllers/locomotive/content_assets_controller.rb +1 -1
- data/app/controllers/locomotive/content_entries_controller.rb +22 -9
- data/app/controllers/locomotive/content_types_controller.rb +6 -6
- data/app/controllers/locomotive/current_site_controller.rb +6 -6
- data/app/controllers/locomotive/installation_controller.rb +11 -3
- data/app/controllers/locomotive/memberships_controller.rb +6 -6
- data/app/controllers/locomotive/my_account_controller.rb +9 -3
- data/app/controllers/locomotive/pages_controller.rb +10 -6
- data/app/controllers/locomotive/passwords_controller.rb +1 -1
- data/app/controllers/locomotive/public/content_entries_controller.rb +1 -1
- data/app/controllers/locomotive/public/pages_controller.rb +5 -5
- data/app/controllers/locomotive/public/robots_controller.rb +1 -1
- data/app/controllers/locomotive/public/sitemaps_controller.rb +1 -1
- data/app/controllers/locomotive/sessions_controller.rb +1 -1
- data/app/controllers/locomotive/sites_controller.rb +5 -5
- data/app/controllers/locomotive/snippets_controller.rb +6 -6
- data/app/controllers/locomotive/theme_assets_controller.rb +6 -6
- data/app/controllers/locomotive/translations_controller.rb +1 -1
- data/app/helpers/locomotive/accounts_helper.rb +1 -1
- data/app/helpers/locomotive/base_helper.rb +13 -21
- data/app/helpers/locomotive/content_types_helper.rb +3 -3
- data/app/helpers/locomotive/custom_fields_helper.rb +5 -5
- data/app/helpers/locomotive/installation_helper.rb +1 -1
- data/app/helpers/locomotive/pages_helper.rb +5 -5
- data/app/helpers/locomotive/snippets_helper.rb +1 -1
- data/app/helpers/locomotive/theme_assets_helper.rb +1 -1
- data/app/helpers/locomotive/translations_helper.rb +2 -2
- data/app/inputs/locomotive/api_key_input.rb +40 -0
- data/app/inputs/locomotive/code_input.rb +5 -5
- data/app/inputs/locomotive/file_input.rb +6 -6
- data/app/inputs/locomotive/locale_input.rb +5 -5
- data/app/inputs/locomotive/locales_input.rb +4 -4
- data/app/inputs/locomotive/rte_input.rb +1 -1
- data/app/inputs/locomotive/small_code_input.rb +1 -1
- data/app/inputs/locomotive/subdomain_input.rb +1 -1
- data/app/mailers/locomotive/devise_mailer.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +3 -3
- data/app/models/locomotive/ability.rb +10 -11
- data/app/models/locomotive/account.rb +61 -26
- data/app/models/locomotive/content_asset.rb +8 -8
- data/app/models/locomotive/content_entry.rb +8 -7
- data/app/models/locomotive/content_type.rb +12 -7
- data/app/models/locomotive/editable_control.rb +2 -2
- data/app/models/locomotive/editable_element.rb +13 -8
- data/app/models/locomotive/editable_file.rb +5 -3
- data/app/models/locomotive/editable_short_text.rb +3 -3
- data/app/models/locomotive/extensions/asset/types.rb +2 -2
- data/app/models/locomotive/extensions/content_entry/csv.rb +78 -0
- data/app/models/locomotive/extensions/content_type/item_template.rb +3 -3
- data/app/models/locomotive/extensions/content_type/sync.rb +4 -4
- data/app/models/locomotive/extensions/page/editable_elements.rb +1 -1
- data/app/models/locomotive/extensions/page/parse.rb +2 -2
- data/app/models/locomotive/extensions/page/render.rb +7 -1
- data/app/models/locomotive/extensions/page/templatized.rb +20 -15
- data/app/models/locomotive/extensions/page/tree.rb +4 -4
- data/app/models/locomotive/extensions/shared/seo.rb +3 -3
- data/app/models/locomotive/extensions/site/first_installation.rb +5 -2
- data/app/models/locomotive/extensions/site/locales.rb +9 -6
- data/app/models/locomotive/extensions/site/subdomain_domains.rb +8 -8
- data/app/models/locomotive/membership.rb +6 -6
- data/app/models/locomotive/page.rb +30 -23
- data/app/models/locomotive/site.rb +19 -15
- data/app/models/locomotive/snippet.rb +5 -5
- data/app/models/locomotive/theme_asset.rb +17 -6
- data/app/models/locomotive/translation.rb +21 -16
- data/app/presenters/locomotive/account_presenter.rb +1 -1
- data/app/presenters/locomotive/content_entry_presenter.rb +2 -2
- data/app/presenters/locomotive/content_field_presenter.rb +2 -2
- data/app/presenters/locomotive/content_type_presenter.rb +6 -1
- data/app/presenters/locomotive/theme_asset_presenter.rb +2 -2
- data/app/uploaders/locomotive/editable_file_uploader.rb +1 -1
- data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
- data/app/views/locomotive/accounts/new.html.haml +6 -6
- data/app/views/locomotive/content_assets/_asset.html.haml +3 -3
- data/app/views/locomotive/content_assets/_picker.html.haml +12 -12
- data/app/views/locomotive/content_entries/_form.html.haml +9 -8
- data/app/views/locomotive/content_entries/_list.html.haml +8 -5
- data/app/views/locomotive/content_entries/edit.html.haml +6 -6
- data/app/views/locomotive/content_entries/index.html.haml +8 -6
- data/app/views/locomotive/content_entries/new.html.haml +5 -5
- data/app/views/locomotive/content_types/_form.html.haml +16 -16
- data/app/views/locomotive/content_types/edit.html.haml +5 -5
- data/app/views/locomotive/content_types/new.html.haml +3 -3
- data/app/views/locomotive/current_site/_form.html.haml +12 -12
- data/app/views/locomotive/current_site/edit.html.haml +5 -5
- data/app/views/locomotive/custom_fields/_form.html.haml +23 -19
- data/app/views/locomotive/custom_fields/_select_templates.html.haml +5 -5
- data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +4 -4
- data/app/views/locomotive/custom_fields/types/_boolean.html.haml +3 -3
- data/app/views/locomotive/custom_fields/types/_date.html.haml +4 -4
- data/app/views/locomotive/custom_fields/types/_email.html.haml +4 -0
- data/app/views/locomotive/custom_fields/types/_file.html.haml +3 -3
- data/app/views/locomotive/custom_fields/types/_float.html.haml +6 -0
- data/app/views/locomotive/custom_fields/types/_has_many.html.haml +10 -10
- data/app/views/locomotive/custom_fields/types/_integer.html.haml +5 -0
- data/app/views/locomotive/custom_fields/types/_many_to_many.html.haml +10 -10
- data/app/views/locomotive/custom_fields/types/_select.html.haml +10 -10
- data/app/views/locomotive/custom_fields/types/_string.html.haml +3 -3
- data/app/views/locomotive/custom_fields/types/_tags.html.haml +4 -0
- data/app/views/locomotive/custom_fields/types/_text.html.haml +4 -4
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.haml +1 -1
- data/app/views/locomotive/installation/step_1.html.haml +5 -5
- data/app/views/locomotive/installation/step_2.html.haml +6 -6
- data/app/views/locomotive/kaminari/_first_page.html.haml +2 -0
- data/app/views/locomotive/kaminari/_gap.html.haml +2 -0
- data/app/views/locomotive/kaminari/_last_page.html.haml +2 -0
- data/app/views/locomotive/kaminari/_next_page.html.haml +2 -0
- data/app/views/locomotive/kaminari/_page.html.haml +2 -0
- data/app/views/locomotive/kaminari/_paginator.html.haml +11 -0
- data/app/views/locomotive/kaminari/_prev_page.html.haml +2 -0
- data/app/views/locomotive/layouts/application.html.haml +2 -2
- data/app/views/locomotive/layouts/not_logged_in.html.haml +3 -3
- data/app/views/locomotive/memberships/new.html.haml +4 -4
- data/app/views/locomotive/my_account/edit.html.haml +14 -13
- data/app/views/locomotive/notifications/new_content_entry.html.haml +2 -2
- data/app/views/locomotive/pages/_editable_elements.html.haml +20 -20
- data/app/views/locomotive/pages/_form.html.haml +23 -27
- data/app/views/locomotive/pages/_page.html.haml +6 -6
- data/app/views/locomotive/pages/edit.html.haml +5 -5
- data/app/views/locomotive/pages/index.html.haml +2 -2
- data/app/views/locomotive/pages/new.html.haml +4 -4
- data/app/views/locomotive/passwords/edit.html.haml +3 -3
- data/app/views/locomotive/passwords/new.html.haml +2 -2
- data/app/views/locomotive/public/pages/show_toolbar.html.haml +15 -15
- data/app/views/locomotive/sessions/new.html.haml +4 -4
- data/app/views/locomotive/shared/_footer.html.haml +1 -1
- data/app/views/locomotive/shared/_head.html.haml +7 -7
- data/app/views/locomotive/shared/_header.html.haml +2 -2
- data/app/views/locomotive/shared/_locale_picker_link.html.haml +1 -1
- data/app/views/locomotive/shared/_site_picker.html.haml +2 -2
- data/app/views/locomotive/shared/actions/_contents.html.haml +1 -1
- data/app/views/locomotive/shared/menu/_contents.html.haml +5 -5
- data/app/views/locomotive/sites/_domains.html.haml +7 -7
- data/app/views/locomotive/sites/_form.html.haml +6 -1
- data/app/views/locomotive/sites/_memberships.html.haml +3 -3
- data/app/views/locomotive/sites/new.html.haml +3 -3
- data/app/views/locomotive/snippets/_form.html.haml +6 -6
- data/app/views/locomotive/snippets/_snippet.html.haml +2 -2
- data/app/views/locomotive/snippets/edit.html.haml +5 -5
- data/app/views/locomotive/snippets/new.html.haml +3 -3
- data/app/views/locomotive/theme_assets/_asset.html.haml +2 -2
- data/app/views/locomotive/theme_assets/_form.html.haml +10 -10
- data/app/views/locomotive/theme_assets/_list.html.haml +3 -3
- data/app/views/locomotive/theme_assets/_picker.html.haml +8 -8
- data/app/views/locomotive/theme_assets/edit.html.haml +7 -7
- data/app/views/locomotive/theme_assets/index.html.haml +6 -6
- data/app/views/locomotive/theme_assets/new.html.haml +3 -3
- data/app/views/locomotive/translations/_form.html.haml +3 -3
- data/app/views/locomotive/translations/edit.html.haml +6 -6
- data/app/views/locomotive/translations/index.html.haml +2 -0
- data/app/views/locomotive/translations/new.html.haml +2 -2
- data/config/initializers/csv_renderer.rb +10 -0
- data/config/locales/admin_ui.de.yml +1 -0
- data/config/locales/admin_ui.en.yml +12 -0
- data/config/locales/admin_ui.es.yml +1 -0
- data/config/locales/admin_ui.et.yml +1 -0
- data/config/locales/admin_ui.fr.yml +12 -0
- data/config/locales/admin_ui.it.yml +1 -0
- data/config/locales/admin_ui.ja.yml +335 -0
- data/config/locales/admin_ui.nb.yml +1 -0
- data/config/locales/admin_ui.nl.yml +1 -0
- data/config/locales/admin_ui.pl.yml +1 -0
- data/config/locales/admin_ui.pt-BR.yml +8 -0
- data/config/locales/admin_ui.ru.yml +1 -0
- data/config/locales/carrierwave.ja.yml +4 -0
- data/config/locales/default.de.yml +1 -1
- data/config/locales/default.en.yml +1 -1
- data/config/locales/default.es.yml +3 -0
- data/config/locales/default.et.yml +2 -2
- data/config/locales/default.fr.yml +1 -1
- data/config/locales/default.it.yml +3 -0
- data/config/locales/default.ja.yml +94 -0
- data/config/locales/default.nb.yml +1 -1
- data/config/locales/default.nl.yml +5 -0
- data/config/locales/default.pl.yml +2 -2
- data/config/locales/default.pt-BR.yml +3 -2
- data/config/locales/default.ru.yml +19 -16
- data/config/locales/devise.ja.yml +63 -0
- data/config/locales/flash.ja.yml +115 -0
- data/config/locales/formtastic.en.yml +7 -0
- data/config/locales/formtastic.fr.yml +9 -0
- data/config/locales/formtastic.ja.yml +103 -0
- data/config/locales/formtastic.pt-BR.yml +1 -1
- data/config/routes.rb +5 -2
- data/features/api/authentication.feature +24 -2
- data/features/api/authorization/pages.feature +3 -1
- data/features/api/entries_custom_fields.feature +2 -2
- data/features/backoffice/authorization/pages.feature +7 -7
- data/features/backoffice/content_types/email.feature +26 -0
- data/features/backoffice/content_types/has_many.feature +20 -0
- data/features/backoffice/content_types/integer.feature +26 -0
- data/features/backoffice/content_types/many_to_many.feature +29 -1
- data/features/backoffice/content_types/tags.feature +22 -0
- data/features/backoffice/content_types/uniqueness.feature +29 -0
- data/features/backoffice/contents.feature +16 -0
- data/features/backoffice/installation.feature +33 -0
- data/features/backoffice/my_account.feature +21 -0
- data/features/backoffice/pages.feature +21 -1
- data/features/backoffice/site.feature +59 -40
- data/features/backoffice/snippets.feature +1 -1
- data/features/backoffice/translations.feature +7 -1
- data/features/public/basic.feature +1 -1
- data/features/public/pages.feature +92 -0
- data/features/public/session.feature +40 -0
- data/features/public/tags.feature +45 -0
- data/features/step_definitions/backoffice_steps.rb +4 -0
- data/features/step_definitions/content_types_steps.rb +16 -3
- data/features/step_definitions/more_web_steps.rb +35 -4
- data/features/step_definitions/page_steps.rb +52 -35
- data/features/step_definitions/pagination_steps.rb +4 -4
- data/features/step_definitions/site_steps.rb +22 -10
- data/features/step_definitions/snippet_steps.rb +1 -1
- data/features/step_definitions/theme_asset_steps.rb +2 -2
- data/features/step_definitions/translation_steps.rb +1 -1
- data/features/step_definitions/web_steps.rb +1 -1
- data/features/support/http.rb +1 -1
- data/features/support/locales.rb +5 -0
- data/lib/generators/locomotive/install/install_generator.rb +1 -6
- data/lib/generators/locomotive/install/templates/carrierwave.rb +4 -4
- data/lib/generators/locomotive/install/templates/locomotive.rb +12 -7
- data/lib/locomotive.rb +4 -4
- data/lib/locomotive/action_controller.rb +1 -0
- data/lib/locomotive/action_controller/responder.rb +9 -10
- data/lib/locomotive/action_controller/section_helpers.rb +1 -1
- data/lib/locomotive/action_controller/ssl.rb +11 -0
- data/lib/locomotive/action_controller/url_helpers.rb +9 -5
- data/lib/locomotive/carrierwave/asset.rb +6 -6
- data/lib/locomotive/configuration.rb +28 -26
- data/lib/locomotive/core_ext.rb +1 -2
- data/lib/locomotive/custom_fields.rb +12 -6
- data/lib/locomotive/dependencies.rb +1 -0
- data/lib/locomotive/dragonfly.rb +1 -1
- data/lib/locomotive/engine.rb +3 -3
- data/lib/locomotive/formtastic.rb +1 -1
- data/lib/locomotive/httparty/webservice.rb +1 -1
- data/lib/locomotive/kaminari.rb +28 -13
- data/lib/locomotive/liquid.rb +1 -0
- data/lib/locomotive/liquid/drops/content_entry.rb +1 -1
- data/lib/locomotive/liquid/drops/content_types.rb +27 -2
- data/lib/locomotive/liquid/drops/page.rb +14 -2
- data/lib/locomotive/liquid/drops/proxy_collection.rb +4 -0
- data/lib/locomotive/liquid/drops/session_proxy.rb +16 -0
- data/lib/locomotive/liquid/drops/site.rb +11 -3
- data/lib/locomotive/liquid/drops/uploader.rb +1 -1
- data/lib/locomotive/liquid/filters/base.rb +1 -1
- data/lib/locomotive/liquid/filters/date.rb +2 -2
- data/lib/locomotive/liquid/filters/html.rb +12 -12
- data/lib/locomotive/liquid/filters/translate.rb +21 -3
- data/lib/locomotive/liquid/tags/consume.rb +50 -19
- data/lib/locomotive/liquid/tags/editable/base.rb +9 -9
- data/lib/locomotive/liquid/tags/editable/control.rb +1 -1
- data/lib/locomotive/liquid/tags/editable/file.rb +1 -1
- data/lib/locomotive/liquid/tags/editable/short_text.rb +1 -1
- data/lib/locomotive/liquid/tags/fetch_page.rb +28 -0
- data/lib/locomotive/liquid/tags/hybrid.rb +25 -0
- data/lib/locomotive/liquid/tags/inherited_block.rb +2 -2
- data/lib/locomotive/liquid/tags/inline_editor.rb +4 -4
- data/lib/locomotive/liquid/tags/javascript.rb +16 -0
- data/lib/locomotive/liquid/tags/link_to.rb +42 -0
- data/lib/locomotive/liquid/tags/locale_switcher.rb +1 -1
- data/lib/locomotive/liquid/tags/nav.rb +2 -2
- data/lib/locomotive/liquid/tags/paginate.rb +2 -2
- data/lib/locomotive/liquid/tags/session_assign.rb +39 -0
- data/lib/locomotive/liquid/tags/snippet.rb +1 -1
- data/lib/locomotive/liquid/tags/with_scope.rb +6 -2
- data/lib/locomotive/logger.rb +1 -1
- data/lib/locomotive/middlewares/cache.rb +1 -1
- data/lib/locomotive/middlewares/fonts.rb +1 -1
- data/lib/locomotive/middlewares/inline_editor.rb +1 -1
- data/lib/locomotive/middlewares/permalink.rb +1 -1
- data/lib/locomotive/middlewares/seo_trailing_slash.rb +1 -1
- data/lib/locomotive/mongoid/patches.rb +21 -21
- data/lib/locomotive/rails/action_view.rb +20 -4
- data/lib/locomotive/regexps.rb +1 -1
- data/lib/locomotive/render.rb +4 -2
- data/lib/locomotive/routing/default_constraint.rb +1 -1
- data/lib/locomotive/routing/site_dispatcher.rb +1 -1
- data/lib/locomotive/session_store.rb +7 -7
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development.rake +11 -9
- data/lib/tasks/locomotive.rake +11 -11
- data/mongodb/migrate/20130204072721_make_editable_elements_consistent.rb +3 -1
- data/mongodb/migrate/20130326201349_rename_entry_to_content_entry.rb +6 -6
- data/mongodb/migrate/20130511121956_generate_checksum_for_theme_assets.rb +14 -0
- data/mongodb/migrate/20130530162559_api_key_for_all_accounts.rb +10 -0
- data/spec/cells/locomotive/global_actions_spec.rb +11 -11
- data/spec/cells/locomotive/main_menu_cell_spec.rb +9 -9
- data/spec/cells/locomotive/settings_menu_cell_spec.rb +11 -11
- data/spec/dummy/config/environments/development.rb +1 -1
- data/spec/dummy/config/initializers/locomotive.rb +16 -11
- data/spec/dummy/config/mongoid.yml +99 -18
- data/spec/lib/action_view_spec.rb +19 -0
- data/spec/lib/core_ext_spec.rb +2 -2
- data/spec/lib/locomotive/configuration_spec.rb +1 -1
- data/spec/lib/locomotive/httparty/webservice_spec.rb +6 -6
- data/spec/lib/locomotive/liquid/drops/content_entry_spec.rb +1 -1
- data/spec/lib/locomotive/liquid/drops/current_user.rb +3 -3
- data/spec/lib/locomotive/liquid/drops/page_spec.rb +63 -14
- data/spec/lib/locomotive/liquid/drops/site_spec.rb +3 -3
- data/spec/lib/locomotive/liquid/filters/html_spec.rb +22 -7
- data/spec/lib/locomotive/liquid/filters/resize_spec.rb +3 -3
- data/spec/lib/locomotive/liquid/filters/translate_spec.rb +26 -12
- data/spec/lib/locomotive/liquid/tags/consume_spec.rb +26 -2
- data/spec/lib/locomotive/liquid/tags/csrf_spec.rb +3 -3
- data/spec/lib/locomotive/liquid/tags/editable/short_text_spec.rb +1 -1
- data/spec/lib/locomotive/liquid/tags/extends_spec.rb +5 -5
- data/spec/lib/locomotive/liquid/tags/javascript_spec.rb +18 -0
- data/spec/lib/locomotive/liquid/tags/locale_switcher_spec.rb +23 -13
- data/spec/lib/locomotive/liquid/tags/nav_spec.rb +11 -11
- data/spec/lib/locomotive/liquid/tags/paginate_spec.rb +13 -13
- data/spec/lib/locomotive/liquid/tags/seo_spec.rb +8 -8
- data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +8 -2
- data/spec/lib/locomotive/presentable_spec.rb +10 -10
- data/spec/lib/locomotive/render_spec.rb +14 -14
- data/spec/mailers/locomotive/notifications_spec.rb +3 -3
- data/spec/models/locomotive/ability_spec.rb +23 -9
- data/spec/models/locomotive/account_spec.rb +30 -8
- data/spec/models/locomotive/content_asset_spec.rb +1 -1
- data/spec/models/locomotive/content_entry_spec.rb +57 -2
- data/spec/models/locomotive/content_type_spec.rb +42 -41
- data/spec/models/locomotive/editable_control_spec.rb +5 -5
- data/spec/models/locomotive/editable_file_spec.rb +21 -5
- data/spec/models/locomotive/editable_long_text_spec.rb +3 -3
- data/spec/models/locomotive/editable_short_text_spec.rb +8 -8
- data/spec/models/locomotive/extensions/page/editable_elements_spec.rb +9 -9
- data/spec/models/locomotive/extensions/page/redirect_spec.rb +1 -1
- data/spec/models/locomotive/extensions/page/render_spec.rb +4 -8
- data/spec/models/locomotive/extensions/site/locales_spec.rb +2 -2
- data/spec/models/locomotive/membership_spec.rb +5 -5
- data/spec/models/locomotive/page_spec.rb +10 -1
- data/spec/models/locomotive/site_spec.rb +19 -19
- data/spec/models/locomotive/snippet_spec.rb +9 -9
- data/spec/models/locomotive/theme_asset_spec.rb +91 -57
- data/spec/requests/admin_ssl_spec.rb +25 -0
- data/spec/support/factories.rb +32 -27
- data/spec/support/locomotive.rb +2 -0
- data/vendor/assets/javascripts/locomotive/backbone.sync.js +1 -1
- data/vendor/assets/javascripts/locomotive/tag-it.min.js +16 -0
- data/vendor/assets/stylesheets/locomotive/jquery.tagit.css +67 -0
- metadata +108 -138
@@ -10,7 +10,7 @@ describe Locomotive::ContentType do
|
|
10
10
|
|
11
11
|
it 'should have a valid factory' do
|
12
12
|
content_type = FactoryGirl.build(:content_type)
|
13
|
-
content_type.entries_custom_fields.build :
|
13
|
+
content_type.entries_custom_fields.build label: 'anything', type: 'string'
|
14
14
|
content_type.should be_valid
|
15
15
|
end
|
16
16
|
|
@@ -25,29 +25,29 @@ describe Locomotive::ContentType do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'requires the presence of slug' do
|
28
|
-
content_type = FactoryGirl.build(:content_type, :
|
28
|
+
content_type = FactoryGirl.build(:content_type, name: nil, slug: nil)
|
29
29
|
content_type.should_not be_valid
|
30
30
|
content_type.errors[:slug].should == ["can't be blank"]
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'is not valid if slug is not unique' do
|
34
34
|
content_type = FactoryGirl.build(:content_type)
|
35
|
-
content_type.entries_custom_fields.build :
|
35
|
+
content_type.entries_custom_fields.build label: 'anything', type: 'string'
|
36
36
|
content_type.save
|
37
|
-
(content_type = FactoryGirl.build(:content_type, :
|
37
|
+
(content_type = FactoryGirl.build(:content_type, site: content_type.site)).should_not be_valid
|
38
38
|
content_type.errors[:slug].should == ["is already taken"]
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'is not valid if there is not at least one field' do
|
42
42
|
content_type = FactoryGirl.build(:content_type)
|
43
43
|
content_type.should_not be_valid
|
44
|
-
content_type.errors[:entries_custom_fields].should == { :
|
44
|
+
content_type.errors[:entries_custom_fields].should == { base: ['At least, one custom field is required'] }
|
45
45
|
end
|
46
46
|
|
47
47
|
%w(created_at updated_at).each do |name|
|
48
48
|
it "does not allow #{name} as name" do
|
49
49
|
content_type = FactoryGirl.build(:content_type)
|
50
|
-
field = content_type.entries_custom_fields.build :
|
50
|
+
field = content_type.entries_custom_fields.build label: 'anything', type: 'string', name: name
|
51
51
|
field.valid?.should be_false
|
52
52
|
field.errors[:name].should == ['is reserved']
|
53
53
|
end
|
@@ -70,9 +70,9 @@ describe Locomotive::ContentType do
|
|
70
70
|
context '#ordered_entries' do
|
71
71
|
|
72
72
|
before(:each) do
|
73
|
-
(@content_type = build_content_type(:
|
74
|
-
@content_2 = @content_type.entries.create :
|
75
|
-
@content_1 = @content_type.entries.create :
|
73
|
+
(@content_type = build_content_type(order_by: 'created_at')).save
|
74
|
+
@content_2 = @content_type.entries.create name: 'Sacha'
|
75
|
+
@content_1 = @content_type.entries.create name: 'Did'
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'orders with the ASC direction by default' do
|
@@ -91,26 +91,26 @@ describe Locomotive::ContentType do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'returns a list of entries ordered by a column specified by order_by (ASC)' do
|
94
|
-
@content_type.order_by = @content_type.entries_custom_fields.where(:
|
94
|
+
@content_type.order_by = @content_type.entries_custom_fields.where(name: 'name').first._id
|
95
95
|
@content_type.ordered_entries.collect(&:name).should == %w(Did Sacha)
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'returns a list of entries ordered by a column specified by order_by (DESC)' do
|
99
|
-
@content_type.order_by = @content_type.entries_custom_fields.where(:
|
99
|
+
@content_type.order_by = @content_type.entries_custom_fields.where(name: 'name').first._id
|
100
100
|
@content_type.order_direction = 'desc'
|
101
101
|
@content_type.ordered_entries.collect(&:name).should == %w(Sacha Did)
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'returns a list of contents ordered through condition {order_by: "name asc"}' do
|
105
|
-
@content_type.order_by = @content_type.entries_custom_fields.where(:
|
105
|
+
@content_type.order_by = @content_type.entries_custom_fields.where(name: 'name').first._id
|
106
106
|
@content_type.order_direction = 'desc'
|
107
|
-
@content_type.ordered_entries(:
|
107
|
+
@content_type.ordered_entries(order_by: 'name asc').collect(&:name).should == %w(Did Sacha)
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'returns a list of entries ordered by a Date column when first instance is missing the value' do
|
111
|
-
@content_type.order_by = @content_type.entries_custom_fields.where(:
|
111
|
+
@content_type.order_by = @content_type.entries_custom_fields.where(name: 'active_at').first._id
|
112
112
|
@content_2.update_attribute :active_at, Date.parse('01/01/2001')
|
113
|
-
content_3 = @content_type.entries.create :
|
113
|
+
content_3 = @content_type.entries.create name: 'Mario', active_at: Date.parse('02/02/2001')
|
114
114
|
|
115
115
|
@content_type.ordered_entries.map(&:active_at).should == [nil, Date.parse('01/01/2001'), Date.parse('02/02/2001')]
|
116
116
|
|
@@ -125,12 +125,12 @@ describe Locomotive::ContentType do
|
|
125
125
|
before(:each) do
|
126
126
|
build_belongs_to_has_many_relationship
|
127
127
|
|
128
|
-
@category_1 = @category_content_type.entries.create :
|
129
|
-
@category_2 = @category_content_type.entries.create :
|
128
|
+
@category_1 = @category_content_type.entries.create name: 'Gems'
|
129
|
+
@category_2 = @category_content_type.entries.create name: 'Service'
|
130
130
|
|
131
|
-
@content_1 = @content_type.entries.create :
|
132
|
-
@content_2 = @content_type.entries.create :
|
133
|
-
@content_3 = @content_type.entries.create :
|
131
|
+
@content_1 = @content_type.entries.create name: 'Github', category: @category_2
|
132
|
+
@content_2 = @content_type.entries.create name: 'LocomotiveCMS', category: @category_1, description: 'Lorem ipsum', _position_in_category: 1
|
133
|
+
@content_3 = @content_type.entries.create name: 'RubyOnRails', category: @category_1, description: 'Zzzzzz', _position_in_category: 2
|
134
134
|
end
|
135
135
|
|
136
136
|
context '#ordering in a belongs_to/has_many relationship' do
|
@@ -150,7 +150,7 @@ describe Locomotive::ContentType do
|
|
150
150
|
end
|
151
151
|
|
152
152
|
it 'uses the order by position if the UI option is enabled' do
|
153
|
-
field = @category_content_type.entries_custom_fields.where(:
|
153
|
+
field = @category_content_type.entries_custom_fields.where(name: 'projects').first
|
154
154
|
field.ui_enabled = true;
|
155
155
|
|
156
156
|
@category_content_type.save!; @category_1 = safe_find(@category_1.class, @category_1._id)
|
@@ -173,14 +173,14 @@ describe Locomotive::ContentType do
|
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'groups entries with a different columns order' do
|
176
|
-
@category_content_type.update_attributes :
|
176
|
+
@category_content_type.update_attributes order_by: @category_content_type.entries_custom_fields.first._id, order_direction: 'desc'
|
177
177
|
groups = @content_type.send(:group_by_belongs_to_field, @content_type.group_by_field)
|
178
178
|
|
179
179
|
groups.map { |h| h[:name] }.should == %w(Service Gems)
|
180
180
|
end
|
181
181
|
|
182
182
|
it 'deals with entries without a value for the group_by field (orphans)' do
|
183
|
-
@content_type.entries.create :
|
183
|
+
@content_type.entries.create name: 'MacOsX'
|
184
184
|
groups = @content_type.send(:group_by_belongs_to_field, @content_type.group_by_field)
|
185
185
|
|
186
186
|
groups.map { |h| h[:name] }.should == ['Gems', 'Service', nil]
|
@@ -198,7 +198,7 @@ describe Locomotive::ContentType do
|
|
198
198
|
site = FactoryGirl.build(:site)
|
199
199
|
Locomotive::Site.stubs(:find).returns(site)
|
200
200
|
|
201
|
-
@content_type = build_content_type(:
|
201
|
+
@content_type = build_content_type(site: site)
|
202
202
|
# Locomotive::ContentType.logger = Logger.new($stdout)
|
203
203
|
# Locomotive::ContentType.db.connection.instance_variable_set(:@logger, Logger.new($stdout))
|
204
204
|
end
|
@@ -207,14 +207,14 @@ describe Locomotive::ContentType do
|
|
207
207
|
|
208
208
|
%w{label type}.each do |key|
|
209
209
|
it "should validate presence of #{key}" do
|
210
|
-
field = @content_type.entries_custom_fields.build({ :
|
210
|
+
field = @content_type.entries_custom_fields.build({ label: 'Shortcut', type: 'string' }.merge(key.to_sym => nil))
|
211
211
|
field.should_not be_valid
|
212
212
|
field.errors[key.to_sym].should == ["can't be blank"]
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
it 'should not have unique label' do
|
217
|
-
field = @content_type.entries_custom_fields.build :
|
217
|
+
field = @content_type.entries_custom_fields.build label: 'Active', type: 'boolean'
|
218
218
|
field.should_not be_valid
|
219
219
|
field.errors[:label].should == ["is already taken"]
|
220
220
|
end
|
@@ -283,14 +283,14 @@ describe Locomotive::ContentType do
|
|
283
283
|
end
|
284
284
|
|
285
285
|
it 'adds new field' do
|
286
|
-
@content_type.entries_custom_fields.build :
|
286
|
+
@content_type.entries_custom_fields.build label: 'Author', name: 'author', type: 'string'
|
287
287
|
@content_type.save && @content_type.reload
|
288
288
|
asset = @content_type.entries.first
|
289
289
|
lambda { asset.author }.should_not raise_error
|
290
290
|
end
|
291
291
|
|
292
292
|
it 'removes a field' do
|
293
|
-
@content_type.entries_custom_fields.destroy_all
|
293
|
+
@content_type.entries_custom_fields.destroy_all(name: 'active_at')
|
294
294
|
@content_type.save && @content_type.reload
|
295
295
|
asset = @content_type.entries.first
|
296
296
|
lambda { asset.active_at }.should raise_error
|
@@ -298,7 +298,7 @@ describe Locomotive::ContentType do
|
|
298
298
|
|
299
299
|
it 'removes the field used as the label when setting the original label_field_name value before' do
|
300
300
|
@content_type.label_field_name = 'name'
|
301
|
-
@content_type.entries_custom_fields.destroy_all
|
301
|
+
@content_type.entries_custom_fields.destroy_all(name: @content_type.label_field_name)
|
302
302
|
@content_type.save
|
303
303
|
@content_type.label_field_name.should == 'description'
|
304
304
|
end
|
@@ -317,8 +317,8 @@ describe Locomotive::ContentType do
|
|
317
317
|
|
318
318
|
it 'adds new field' do
|
319
319
|
@content_type.entries_custom_fields.clear
|
320
|
-
field = @content_type.entries_custom_fields.build :
|
321
|
-
@content_type.entries_custom_fields_attributes = { 0 => { :
|
320
|
+
field = @content_type.entries_custom_fields.build label: 'Title'
|
321
|
+
@content_type.entries_custom_fields_attributes = { 0 => { id: field.id.to_s, 'label' => 'A title', 'type' => 'string' }, 1 => { 'label' => 'Tagline', 'type' => 'sring' } }
|
322
322
|
@content_type.entries_custom_fields.size.should == 2
|
323
323
|
@content_type.entries_custom_fields.first.label.should == 'A title'
|
324
324
|
@content_type.entries_custom_fields.last.label.should == 'Tagline'
|
@@ -327,10 +327,10 @@ describe Locomotive::ContentType do
|
|
327
327
|
it 'updates/removes fields' do
|
328
328
|
@content_type.save
|
329
329
|
|
330
|
-
field = @content_type.entries_custom_fields.build :
|
330
|
+
field = @content_type.entries_custom_fields.build label: 'Title', type: 'string'
|
331
331
|
@content_type.save
|
332
332
|
|
333
|
-
@content_type.update_attributes(:
|
333
|
+
@content_type.update_attributes(entries_custom_fields_attributes: {
|
334
334
|
'0' => { '_id' => lookup_field_id(1), 'label' => 'My Description', 'type' => 'text', '_destroy' => '1' },
|
335
335
|
'1' => { '_id' => lookup_field_id(2), 'label' => 'Active', 'type' => 'boolean', '_destroy' => '1' },
|
336
336
|
'2' => { '_id' => field._id, 'label' => 'My Title !' },
|
@@ -350,29 +350,30 @@ describe Locomotive::ContentType do
|
|
350
350
|
|
351
351
|
def build_content_type(options = {}, &block)
|
352
352
|
FactoryGirl.build(:content_type, options).tap do |content_type|
|
353
|
-
content_type.entries_custom_fields.build :
|
354
|
-
content_type.entries_custom_fields.build :
|
355
|
-
content_type.entries_custom_fields.build :
|
356
|
-
content_type.entries_custom_fields.build :
|
353
|
+
content_type.entries_custom_fields.build label: 'Name', type: 'string'
|
354
|
+
content_type.entries_custom_fields.build label: 'Description', type: 'text'
|
355
|
+
content_type.entries_custom_fields.build label: 'Active', type: 'boolean'
|
356
|
+
content_type.entries_custom_fields.build label: 'Active at', type: 'date'
|
357
357
|
block.call(content_type) if block_given?
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
361
361
|
def safe_find(klass, id)
|
362
362
|
Mongoid::IdentityMap.clear
|
363
|
+
# Rails.logger.debug "---> reload #{klass}, #{id}!!!!!"
|
363
364
|
klass.find(id)
|
364
365
|
end
|
365
366
|
|
366
367
|
def build_content_entry(content_type)
|
367
|
-
content_type.entries.build(:
|
368
|
+
content_type.entries.build(name: 'Asset on steroids', description: 'Lorem ipsum', active: true)
|
368
369
|
end
|
369
370
|
|
370
371
|
def build_belongs_to_has_many_relationship
|
371
|
-
(@category_content_type = build_content_type(:
|
372
|
+
(@category_content_type = build_content_type(name: 'Categories')).save!
|
372
373
|
category_klass = @category_content_type.klass_with_custom_fields(:entries).name
|
373
374
|
|
374
375
|
@content_type = build_content_type.tap do |content_type|
|
375
|
-
field = content_type.entries_custom_fields.build :
|
376
|
+
field = content_type.entries_custom_fields.build label: 'Category', type: 'belongs_to', class_name: category_klass
|
376
377
|
content_type.order_by = 'name'
|
377
378
|
content_type.order_direction = 'desc'
|
378
379
|
content_type.group_by_field_id = field._id
|
@@ -380,7 +381,7 @@ describe Locomotive::ContentType do
|
|
380
381
|
end
|
381
382
|
project_klass = @content_type.klass_with_custom_fields(:entries).name
|
382
383
|
|
383
|
-
field = @category_content_type.entries_custom_fields.build :
|
384
|
+
field = @category_content_type.entries_custom_fields.build label: 'Projects', type: 'has_many', class_name: project_klass, inverse_of: :category, ui_enabled: false
|
384
385
|
@category_content_type.save!
|
385
386
|
end
|
386
387
|
|
@@ -10,9 +10,9 @@ describe Locomotive::EditableControl do
|
|
10
10
|
describe '#simple' do
|
11
11
|
|
12
12
|
before(:each) do
|
13
|
-
@home.update_attributes :
|
13
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_control 'menu', options: 'true=Yes,false=No' %}false{% endeditable_control %}{% endblock %}"
|
14
14
|
|
15
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
15
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'exists' do
|
@@ -36,11 +36,11 @@ describe Locomotive::EditableControl do
|
|
36
36
|
describe '"sticky" elements' do
|
37
37
|
|
38
38
|
before(:each) do
|
39
|
-
@home.update_attributes :
|
39
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_control 'menu', options: 'true=Yes,false=No', fixed: true %}false{% endeditable_control %}{% endblock %}"
|
40
40
|
@home_el = @home.editable_elements.first
|
41
41
|
|
42
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
43
|
-
@sub_page_2 = FactoryGirl.create(:page, :
|
42
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
43
|
+
@sub_page_2 = FactoryGirl.create(:page, slug: 'sub_page_2', parent: @home, raw_template: "{% extends 'parent' %}")
|
44
44
|
|
45
45
|
@sub_page_1_el = @sub_page_1.editable_elements.first
|
46
46
|
@sub_page_2_el = @sub_page_2.editable_elements.first
|
@@ -6,7 +6,7 @@ describe Locomotive::EditableFile do
|
|
6
6
|
@site = FactoryGirl.create(:site)
|
7
7
|
@home = @site.pages.root.first
|
8
8
|
|
9
|
-
@home.update_attributes :
|
9
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_file 'image' %}Lorem ipsum{% endeditable_file %}{% endblock %}"
|
10
10
|
|
11
11
|
@home = @site.pages.root.first
|
12
12
|
end
|
@@ -39,15 +39,31 @@ describe Locomotive::EditableFile do
|
|
39
39
|
before(:each) do
|
40
40
|
@editable_file = @home.editable_elements.first
|
41
41
|
@editable_file.source = FixturedAsset.open('5k.png')
|
42
|
+
# @editable_file.save
|
43
|
+
# Rails.logger.debug "------------- START --------"
|
44
|
+
# puts "changed"
|
45
|
+
# puts @editable_file.changed.inspect
|
46
|
+
# puts "changes"
|
47
|
+
# puts @editable_file.changes.inspect
|
48
|
+
# puts @home.changes.inspect
|
42
49
|
@home.save
|
50
|
+
@home.reload
|
51
|
+
# puts @editable_file.inspect
|
52
|
+
# puts @home.errors.inspect
|
53
|
+
# Rails.logger.debug "------------- DONE --------"
|
54
|
+
# @home = Locomotive::Page.find(@home._id)
|
43
55
|
end
|
44
56
|
|
45
57
|
it 'has a valid source' do
|
46
58
|
@editable_file.source?.should be_true
|
59
|
+
# puts @editable_file.source.inspect
|
47
60
|
end
|
48
61
|
|
49
62
|
it 'returns the right path even if the page has been retrieved with the minimum_attributes scope' do
|
50
|
-
@home = @site.pages.minimal_attributes(%w(editable_elements)).root.first
|
63
|
+
# @home = @site.pages.minimal_attributes(%w(editable_elements)).root.first
|
64
|
+
@home = @site.pages.root.first
|
65
|
+
# puts @home.inspect
|
66
|
+
# puts @home.editable_elements.inspect
|
51
67
|
@home.editable_elements.first.source?.should be_true
|
52
68
|
end
|
53
69
|
|
@@ -56,10 +72,10 @@ describe Locomotive::EditableFile do
|
|
56
72
|
describe '"sticky" files' do
|
57
73
|
|
58
74
|
before(:each) do
|
59
|
-
@home.update_attributes :
|
75
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_file 'image', fixed: true %}/foo.png{% endeditable_file %}{% endblock %}"
|
60
76
|
|
61
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
62
|
-
@sub_page_2 = FactoryGirl.create(:page, :
|
77
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'index' %}")
|
78
|
+
@sub_page_2 = FactoryGirl.create(:page, slug: 'sub_page_2', parent: @home, raw_template: "{% extends 'index' %}")
|
63
79
|
|
64
80
|
@sub_page_1_el = @sub_page_1.editable_elements.first
|
65
81
|
@sub_page_2_el = @sub_page_2.editable_elements.first
|
@@ -6,9 +6,9 @@ describe Locomotive::EditableLongText do
|
|
6
6
|
@site = FactoryGirl.create(:site)
|
7
7
|
@home = @site.pages.root.first
|
8
8
|
|
9
|
-
@home.update_attributes :
|
9
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_long_text 'body' %}Lorem ipsum{% endeditable_long_text %}{% endblock %}"
|
10
10
|
|
11
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
11
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'exists' do
|
@@ -32,7 +32,7 @@ describe Locomotive::EditableLongText do
|
|
32
32
|
describe 'when modifying the raw template' do
|
33
33
|
|
34
34
|
it 'can update its content from the raw template if the user has not modified it' do
|
35
|
-
@home.update_attributes :
|
35
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_long_text 'body' %}Lorem ipsum v2{% endeditable_long_text %}{% endblock %}"
|
36
36
|
@home.editable_elements.first.default_content.should be_true
|
37
37
|
@home.editable_elements.first.content.should == 'Lorem ipsum v2'
|
38
38
|
end
|
@@ -8,14 +8,14 @@ describe Locomotive::EditableShortText do
|
|
8
8
|
@site = FactoryGirl.create(:site)
|
9
9
|
@home = @site.pages.root.first
|
10
10
|
|
11
|
-
@home.update_attributes :
|
11
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_short_text 'body' %}Lorem ipsum{% endeditable_short_text %}{% endblock %}"
|
12
12
|
|
13
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
14
|
-
@sub_page_2 = FactoryGirl.create(:page, :
|
13
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
14
|
+
@sub_page_2 = FactoryGirl.create(:page, slug: 'sub_page_2', parent: @home, raw_template: "{% extends 'parent' %}")
|
15
15
|
|
16
16
|
@sub_page_1_el = @sub_page_1.editable_elements.first
|
17
17
|
|
18
|
-
@sub_page_1_1 = FactoryGirl.create(:page, :
|
18
|
+
@sub_page_1_1 = FactoryGirl.create(:page, slug: 'sub_page_1_1', parent: @sub_page_1, raw_template: "{% extends 'parent' %}")
|
19
19
|
end
|
20
20
|
|
21
21
|
context '#locales' do
|
@@ -35,7 +35,7 @@ describe Locomotive::EditableShortText do
|
|
35
35
|
|
36
36
|
it 'adds new locale within sub page elements' do
|
37
37
|
::Mongoid::Fields::I18n.with_locale 'fr' do
|
38
|
-
@home.update_attributes :
|
38
|
+
@home.update_attributes title: 'Accueil', raw_template: "{% block body %}{% editable_short_text 'body' %}Lorem ipsum{% endeditable_short_text %}{% endblock %}"
|
39
39
|
page = Locomotive::Page.find(@sub_page_1._id)
|
40
40
|
page.editable_elements.first.content = 'Lorem ipsum (FR)'
|
41
41
|
page.save
|
@@ -131,11 +131,11 @@ describe Locomotive::EditableShortText do
|
|
131
131
|
@site = FactoryGirl.create(:site)
|
132
132
|
@home = @site.pages.root.first
|
133
133
|
|
134
|
-
@home.update_attributes :
|
134
|
+
@home.update_attributes raw_template: "{% block body %}{% editable_short_text 'body', fixed: true %}Lorem ipsum{% endeditable_short_text %}{% endblock %}"
|
135
135
|
@home_el = @home.editable_elements.first
|
136
136
|
|
137
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
138
|
-
@sub_page_2 = FactoryGirl.create(:page, :
|
137
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
138
|
+
@sub_page_2 = FactoryGirl.create(:page, slug: 'sub_page_2', parent: @home, raw_template: "{% extends 'parent' %}")
|
139
139
|
|
140
140
|
@sub_page_1_el = @sub_page_1.editable_elements.first
|
141
141
|
@sub_page_2_el = @sub_page_2.editable_elements.first
|
@@ -6,14 +6,14 @@ describe Locomotive::Extensions::Page::EditableElements do
|
|
6
6
|
@site = FactoryGirl.create(:site)
|
7
7
|
@home = @site.pages.root.first
|
8
8
|
|
9
|
-
@home.update_attributes :
|
9
|
+
@home.update_attributes raw_template: "{% editable_short_text 'body' %}Lorem ipsum{% endeditable_short_text %}"
|
10
10
|
|
11
|
-
@sub_page_1 = FactoryGirl.create(:page, :
|
12
|
-
@sub_page_2 = FactoryGirl.create(:page, :
|
11
|
+
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
12
|
+
@sub_page_2 = FactoryGirl.create(:page, slug: 'sub_page_2', parent: @home, raw_template: "{% extends 'parent' %}")
|
13
13
|
|
14
14
|
@sub_page_1_el = @sub_page_1.editable_elements.first
|
15
15
|
|
16
|
-
@sub_page_1_1 = FactoryGirl.create(:page, :
|
16
|
+
@sub_page_1_1 = FactoryGirl.create(:page, slug: 'sub_page_1_1', parent: @sub_page_1, raw_template: "{% extends 'parent' %}")
|
17
17
|
end
|
18
18
|
|
19
19
|
describe 'modification of an element within the home page' do
|
@@ -23,7 +23,7 @@ describe Locomotive::Extensions::Page::EditableElements do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'changes the type of the element in all the children' do
|
26
|
-
@home.update_attributes :
|
26
|
+
@home.update_attributes raw_template: "{% editable_long_text 'body' %}Lorem ipsum{% endeditable_long_text %}"
|
27
27
|
@sub_page_1.reload
|
28
28
|
@sub_page_1.editable_elements.first._type.should == 'Locomotive::EditableLongText'
|
29
29
|
@sub_page_1_1.reload
|
@@ -31,7 +31,7 @@ describe Locomotive::Extensions::Page::EditableElements do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'changes the hint of the element in all the children' do
|
34
|
-
@home.update_attributes :
|
34
|
+
@home.update_attributes raw_template: "{% editable_long_text 'body', hint: 'My very useful hint' %}Lorem ipsum{% endeditable_long_text %}"
|
35
35
|
@sub_page_1.reload
|
36
36
|
@sub_page_1.editable_elements.first.hint.should == 'My very useful hint'
|
37
37
|
@sub_page_1_1.reload
|
@@ -44,7 +44,7 @@ describe Locomotive::Extensions::Page::EditableElements do
|
|
44
44
|
|
45
45
|
it 'does not remove the editable elements in other locales' do
|
46
46
|
Mongoid::Fields::I18n.with_locale(:fr) do
|
47
|
-
@home.update_attributes :
|
47
|
+
@home.update_attributes raw_template: "{% editable_short_text 'corps' %}Lorem ipsum{% endeditable_short_text %}"
|
48
48
|
end
|
49
49
|
@home.reload
|
50
50
|
@home.editable_elements.count.should == 2
|
@@ -52,12 +52,12 @@ describe Locomotive::Extensions::Page::EditableElements do
|
|
52
52
|
|
53
53
|
it 'removes the editable elements which are not present in at least one locale' do
|
54
54
|
Mongoid::Fields::I18n.with_locale(:fr) do
|
55
|
-
@home.update_attributes :
|
55
|
+
@home.update_attributes raw_template: ''
|
56
56
|
end
|
57
57
|
@home.reload
|
58
58
|
@home.editable_elements.count.should == 1
|
59
59
|
|
60
|
-
@home.update_attributes :
|
60
|
+
@home.update_attributes raw_template: ''
|
61
61
|
@home.reload
|
62
62
|
@home.editable_elements.count.should == 0
|
63
63
|
end
|