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
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Locomotive::Liquid::Tags::SEO do
|
4
4
|
|
5
5
|
let(:site) do
|
6
|
-
FactoryGirl.build(:site, :
|
6
|
+
FactoryGirl.build(:site, seo_title: 'Site title (SEO)', meta_description: 'A short site description', meta_keywords: 'test only cat dog')
|
7
7
|
end
|
8
8
|
|
9
9
|
describe 'rendering' do
|
@@ -50,7 +50,7 @@ describe Locomotive::Liquid::Tags::SEO do
|
|
50
50
|
context "when page" do
|
51
51
|
|
52
52
|
context "has seo title" do
|
53
|
-
let(:page) { site.pages.build(:
|
53
|
+
let(:page) { site.pages.build(seo_title: 'Page title (SEO)', meta_keywords: 'hulk,gamma', meta_description: "Bruce Banner") }
|
54
54
|
subject { render_seo_title('page' => page) }
|
55
55
|
it { should include(%Q[<title>Page title (SEO)</title>]) }
|
56
56
|
end
|
@@ -62,7 +62,7 @@ describe Locomotive::Liquid::Tags::SEO do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context "has metadata" do
|
65
|
-
let(:page) { site.pages.build(:
|
65
|
+
let(:page) { site.pages.build(meta_keywords: 'hulk,gamma', meta_description: "Bruce Banner") }
|
66
66
|
subject { render_seo_metadata('page' => page) }
|
67
67
|
it { should include(%Q[<meta name="keywords" content="#{page.meta_keywords}">]) }
|
68
68
|
it { should include(%Q[<meta name="description" content="#{page.meta_description}">]) }
|
@@ -80,13 +80,13 @@ describe Locomotive::Liquid::Tags::SEO do
|
|
80
80
|
context "when content instance" do
|
81
81
|
|
82
82
|
let(:content_type) do
|
83
|
-
FactoryGirl.build(:content_type, :
|
84
|
-
ct.entries_custom_fields.build :
|
83
|
+
FactoryGirl.build(:content_type, site: site).tap do |ct|
|
84
|
+
ct.entries_custom_fields.build label: 'anything', type: 'string'
|
85
85
|
end.tap { |_ct| _ct.valid? }
|
86
86
|
end
|
87
87
|
|
88
88
|
context "has seo title" do
|
89
|
-
let(:content_entry) { content_type.entries.build(:
|
89
|
+
let(:content_entry) { content_type.entries.build(seo_title: 'Content title (SEO)', meta_keywords: 'Libidinous, Angsty', meta_description: "Quite the combination.") }
|
90
90
|
subject { render_seo_title('content_entry' => content_entry) }
|
91
91
|
it { should include(%Q[<title>Content title (SEO)</title>]) }
|
92
92
|
end
|
@@ -98,7 +98,7 @@ describe Locomotive::Liquid::Tags::SEO do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
context "has metadata" do
|
101
|
-
let(:content_entry) { content_type.entries.build(:
|
101
|
+
let(:content_entry) { content_type.entries.build(meta_keywords: 'Libidinous, Angsty', meta_description: "Quite the combination.") }
|
102
102
|
subject { render_seo_metadata('content_entry' => content_entry) }
|
103
103
|
it { should include(%Q[<meta name="keywords" content="#{content_entry.meta_keywords}">]) }
|
104
104
|
it { should include(%Q[<meta name="description" content="#{content_entry.meta_description}">]) }
|
@@ -128,7 +128,7 @@ describe Locomotive::Liquid::Tags::SEO do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def render_seo_tag(tag_name, assigns = {})
|
131
|
-
registers = { :
|
131
|
+
registers = { site: site }
|
132
132
|
liquid_context = ::Liquid::Context.new({}, assigns, registers)
|
133
133
|
output = Liquid::Template.parse("{% #{tag_name} %}").render(liquid_context)
|
134
134
|
end
|
@@ -26,13 +26,19 @@ describe Locomotive::Liquid::Tags::WithScope do
|
|
26
26
|
it 'stores attributes in the context' do
|
27
27
|
template = ::Liquid::Template.parse("{% with_scope active:true title:'foo' %}{{ with_scope.active }}-{{ with_scope.title }}{% endwith_scope %}")
|
28
28
|
text = template.render
|
29
|
-
text.should ==
|
29
|
+
text.should == 'true-foo'
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'allows a variable condition inside a loop' do
|
33
33
|
template = ::Liquid::Template.parse("{%for i in (1..3)%}{% with_scope number: i %}{{ with_scope.number}}{% endwith_scope %}{%endfor%}")
|
34
34
|
text = template.render
|
35
|
-
text.should ==
|
35
|
+
text.should == '123'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'replaces _permalink by _slug' do
|
39
|
+
template = ::Liquid::Template.parse("{% with_scope _permalink: 'foo' %}{{ with_scope._slug }}{% endwith_scope %}")
|
40
|
+
text = template.render
|
41
|
+
text.should == 'foo'
|
36
42
|
end
|
37
43
|
|
38
44
|
describe "advanced queries thanks to h4s" do
|
@@ -4,8 +4,8 @@ require 'ostruct'
|
|
4
4
|
describe Locomotive::Presentable do
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
@person = OpenStruct.new(:
|
8
|
-
@project = OpenStruct.new(:
|
7
|
+
@person = OpenStruct.new(id: 42, name: 'John', age: 23)
|
8
|
+
@project = OpenStruct.new(id: 1, title: 'LocomotiveCMS')
|
9
9
|
|
10
10
|
@presenter = PersonPresenter.new(@person)
|
11
11
|
@other_presenter = ProjectPresenter.new(@project)
|
@@ -48,14 +48,14 @@ describe Locomotive::Presentable do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'sets directly the attributes' do
|
51
|
-
@presenter.attributes = { :
|
51
|
+
@presenter.attributes = { name: 'henry', age: 33 }
|
52
52
|
@presenter.name.should == 'Henry'
|
53
53
|
@presenter.age.should == '33 years old'
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'does not call the setter if not registered' do
|
57
57
|
@presenter.expects(:unknown=).never
|
58
|
-
@presenter.attributes = { :
|
58
|
+
@presenter.attributes = { name: 'henry', unknown: true }
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'handles with_options' do
|
@@ -85,7 +85,7 @@ describe Locomotive::Presentable do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'does not allow to change the property' do
|
88
|
-
@presenter.attributes = { :
|
88
|
+
@presenter.attributes = { retirement_place: 'Mansion [UPDATE]' }
|
89
89
|
@person.retirement_place.should == 'Mansion'
|
90
90
|
end
|
91
91
|
|
@@ -102,7 +102,7 @@ describe Locomotive::Presentable do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'changes the property' do
|
105
|
-
@presenter.attributes = { :
|
105
|
+
@presenter.attributes = { retirement_place: 'Mansion [UPDATE]' }
|
106
106
|
@person.retirement_place.should == 'Mansion [UPDATE]'
|
107
107
|
end
|
108
108
|
|
@@ -113,7 +113,7 @@ describe Locomotive::Presentable do
|
|
113
113
|
describe '#collection' do
|
114
114
|
|
115
115
|
before(:each) do
|
116
|
-
@another_project = OpenStruct.new(:
|
116
|
+
@another_project = OpenStruct.new(id: 2, title: 'SocialTennis')
|
117
117
|
@person.projects = [@project, @another_project]
|
118
118
|
|
119
119
|
@project.to_presenter = @other_presenter
|
@@ -145,15 +145,15 @@ describe Locomotive::Presentable do
|
|
145
145
|
class PersonPresenter < BasePresenter
|
146
146
|
|
147
147
|
properties :name, :age
|
148
|
-
property :address, :
|
148
|
+
property :address, only_setter: true, alias: :full_address
|
149
149
|
|
150
150
|
collection :projects
|
151
151
|
|
152
|
-
with_options :
|
152
|
+
with_options only_getter: true, allow_nil: false do |presenter|
|
153
153
|
presenter.property :notes
|
154
154
|
end
|
155
155
|
|
156
|
-
property :retirement_place, :
|
156
|
+
property :retirement_place, if: Proc.new { __source.age > 60 }
|
157
157
|
|
158
158
|
set_callback :set_attributes, :after, :hello_world
|
159
159
|
|
@@ -9,7 +9,7 @@ describe 'Locomotive rendering system' do
|
|
9
9
|
@site = FactoryGirl.build(:site)
|
10
10
|
Locomotive::Site.stubs(:find).returns(@site)
|
11
11
|
@controller.current_site = @site
|
12
|
-
@page = FactoryGirl.build(:page, :
|
12
|
+
@page = FactoryGirl.build(:page, site: nil, published: true)
|
13
13
|
end
|
14
14
|
|
15
15
|
context '#liquid_context' do
|
@@ -18,7 +18,7 @@ describe 'Locomotive rendering system' do
|
|
18
18
|
@controller.instance_variable_set(:@page, @page)
|
19
19
|
@controller.stubs(:flash).returns({})
|
20
20
|
@controller.stubs(:params).returns({})
|
21
|
-
@controller.stubs(:request).returns(OpenStruct.new(:
|
21
|
+
@controller.stubs(:request).returns(OpenStruct.new(url: '/'))
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'includes the current date and time' do
|
@@ -91,25 +91,25 @@ describe 'Locomotive rendering system' do
|
|
91
91
|
|
92
92
|
it 'should retrieve the index page /' do
|
93
93
|
@controller.request.fullpath = '/'
|
94
|
-
@controller.current_site.pages.expects(:where).with(:
|
94
|
+
@controller.current_site.pages.expects(:where).with(depth: 0, :fullpath.in => %w{index}).returns([@page])
|
95
95
|
@controller.send(:locomotive_page).should_not be_nil
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'should also retrieve the index page (index.html)' do
|
99
99
|
@controller.request.fullpath = '/index.html'
|
100
|
-
@controller.current_site.pages.expects(:where).with(:
|
100
|
+
@controller.current_site.pages.expects(:where).with(depth: 0, :fullpath.in => %w{index}).returns([@page])
|
101
101
|
@controller.send(:locomotive_page).should_not be_nil
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'should retrieve it based on the full path' do
|
105
105
|
@controller.request.fullpath = '/about_us/team.html'
|
106
|
-
@controller.current_site.pages.expects(:where).with(:
|
106
|
+
@controller.current_site.pages.expects(:where).with(depth: 2, :fullpath.in => %w{about_us/team about_us/content_type_template content_type_template/team}).returns([@page])
|
107
107
|
@controller.send(:locomotive_page).should_not be_nil
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'does not include the query string' do
|
111
111
|
@controller.request.fullpath = '/about_us/team.html?some=params&we=use'
|
112
|
-
@controller.current_site.pages.expects(:where).with(:
|
112
|
+
@controller.current_site.pages.expects(:where).with(depth: 2, :fullpath.in => %w{about_us/team about_us/content_type_template content_type_template/team}).returns([@page])
|
113
113
|
@controller.send(:locomotive_page).should_not be_nil
|
114
114
|
end
|
115
115
|
|
@@ -126,13 +126,13 @@ describe 'Locomotive rendering system' do
|
|
126
126
|
@page.redirect = true
|
127
127
|
@page.redirect_url = 'http://www.example.com/'
|
128
128
|
@controller.request.fullpath = '/contact'
|
129
|
-
@controller.current_site.pages.expects(:where).with(:
|
129
|
+
@controller.current_site.pages.expects(:where).with(depth: 1, :fullpath.in => %w{contact content_type_template}).returns([@page])
|
130
130
|
end
|
131
131
|
|
132
132
|
(301..302).each do |status|
|
133
133
|
it "redirects to the redirect_url with a #{status} status" do
|
134
134
|
@page.redirect_type = status
|
135
|
-
@controller.expects(:redirect_to).with('http://www.example.com/', { :
|
135
|
+
@controller.expects(:redirect_to).with('http://www.example.com/', { status: status }).returns(true)
|
136
136
|
@controller.send(:render_locomotive_page)
|
137
137
|
end
|
138
138
|
end
|
@@ -140,7 +140,7 @@ describe 'Locomotive rendering system' do
|
|
140
140
|
it 'redirects to the redirect_url in the editing version if specified' do
|
141
141
|
@page.redirect_url = '/another_page'
|
142
142
|
@controller.stubs(:editing_page?).returns(true)
|
143
|
-
@controller.expects(:redirect_to).with('/another_page/_edit', { :
|
143
|
+
@controller.expects(:redirect_to).with('/another_page/_edit', { status: 301 }).returns(true)
|
144
144
|
@controller.send(:render_locomotive_page)
|
145
145
|
end
|
146
146
|
|
@@ -149,13 +149,13 @@ describe 'Locomotive rendering system' do
|
|
149
149
|
context 'templatized page' do
|
150
150
|
|
151
151
|
before(:each) do
|
152
|
-
@content_type = FactoryGirl.build(:content_type, :
|
153
|
-
@content_entry = @content_type.entries.build(:
|
152
|
+
@content_type = FactoryGirl.build(:content_type, site: nil)
|
153
|
+
@content_entry = @content_type.entries.build(_visible: true)
|
154
154
|
@page.templatized = true
|
155
155
|
@page.stubs(:fetch_target_entry).returns(@content_entry)
|
156
156
|
@page.stubs(:fullpath).returns('/projects/content_type_template')
|
157
157
|
@controller.request.fullpath = '/projects/edeneo.html'
|
158
|
-
@controller.current_site.pages.expects(:where).with(:
|
158
|
+
@controller.current_site.pages.expects(:where).with(depth: 2, :fullpath.in => %w{projects/edeneo projects/content_type_template content_type_template/edeneo}).returns([@page])
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'sets the content_entry variable' do
|
@@ -190,7 +190,7 @@ describe 'Locomotive rendering system' do
|
|
190
190
|
|
191
191
|
it 'should return the 404 page if the page has not been published yet' do
|
192
192
|
@controller.request.fullpath = '/contact'
|
193
|
-
@controller.current_site.pages.expects(:where).with(:
|
193
|
+
@controller.current_site.pages.expects(:where).with(depth: 1, :fullpath.in => %w{contact content_type_template}).returns([@page])
|
194
194
|
(klass = Locomotive::Page).expects(:published).returns([true])
|
195
195
|
@controller.current_site.pages.expects(:not_found).returns(klass)
|
196
196
|
@controller.send(:locomotive_page).should be_true
|
@@ -199,7 +199,7 @@ describe 'Locomotive rendering system' do
|
|
199
199
|
it 'should not return the 404 page if the page has not been published yet and admin is logged in' do
|
200
200
|
@controller.current_locomotive_account = true
|
201
201
|
@controller.request.fullpath = '/contact'
|
202
|
-
@controller.current_site.pages.expects(:where).with(:
|
202
|
+
@controller.current_site.pages.expects(:where).with(depth: 1, :fullpath.in => %w{contact content_type_template}).returns([@page])
|
203
203
|
@controller.send(:locomotive_page).should == @page
|
204
204
|
end
|
205
205
|
|
@@ -4,13 +4,13 @@ describe Locomotive::Notifications do
|
|
4
4
|
|
5
5
|
describe 'new_content_entry' do
|
6
6
|
|
7
|
-
let(:site) { FactoryGirl.build(:site, :
|
7
|
+
let(:site) { FactoryGirl.build(:site, domains: %w{www.acme.com}) }
|
8
8
|
|
9
9
|
let(:account) { FactoryGirl.build(:account) }
|
10
10
|
|
11
|
-
let(:content_type) { FactoryGirl.build(:content_type, :
|
11
|
+
let(:content_type) { FactoryGirl.build(:content_type, site: site) }
|
12
12
|
|
13
|
-
let(:content_entry) { FactoryGirl.build(:content_entry, :
|
13
|
+
let(:content_entry) { FactoryGirl.build(:content_entry, content_type: content_type, site: site) }
|
14
14
|
|
15
15
|
let(:mail) { Locomotive::Notifications.new_content_entry(account, content_entry) }
|
16
16
|
|
@@ -6,9 +6,9 @@ describe Locomotive::Ability do
|
|
6
6
|
@site = FactoryGirl.create(:site)
|
7
7
|
@account = FactoryGirl.create(:account)
|
8
8
|
|
9
|
-
@admin = FactoryGirl.create(:membership, :
|
10
|
-
@designer = FactoryGirl.create(:membership, :
|
11
|
-
@author = FactoryGirl.create(:membership, :
|
9
|
+
@admin = FactoryGirl.create(:membership, account: FactoryGirl.build(:account), site: FactoryGirl.build(:site))
|
10
|
+
@designer = FactoryGirl.create(:membership, account: FactoryGirl.build(:account), site: @site, role: %(designer))
|
11
|
+
@author = FactoryGirl.create(:membership, account: FactoryGirl.build(:account), site: @site, role: %(author))
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'pages' do
|
@@ -17,15 +17,29 @@ describe Locomotive::Ability do
|
|
17
17
|
|
18
18
|
context 'management' do
|
19
19
|
it 'should allow management of pages from (admin, designer, author)' do
|
20
|
-
should
|
21
|
-
should
|
22
|
-
should_not
|
20
|
+
should allow_permission_from :manage, @admin
|
21
|
+
should allow_permission_from :manage, @designer
|
22
|
+
should_not allow_permission_from :manage, @author
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
context '
|
27
|
-
it 'should allow
|
28
|
-
should
|
26
|
+
context 'customizing' do
|
27
|
+
it 'should allow customization of pages from (admin, designer, author)' do
|
28
|
+
should allow_permission_from :customizing, @admin
|
29
|
+
should allow_permission_from :customizing, @designer
|
30
|
+
should_not allow_permission_from :customizing, @author
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'author operations' do
|
35
|
+
it 'should allow read/create/update operations for pages' do
|
36
|
+
should allow_permission_from :read, @author
|
37
|
+
should allow_permission_from :create, @author
|
38
|
+
should allow_permission_from :update, @author
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should not allow deletion of pages' do
|
42
|
+
should_not allow_permission_from :destroy, @author
|
29
43
|
end
|
30
44
|
end
|
31
45
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Locomotive::Account do
|
4
|
-
let!(:existing_account) { FactoryGirl.create(:account, :
|
4
|
+
let!(:existing_account) { FactoryGirl.create(:account, email: 'another@email.com') }
|
5
5
|
|
6
6
|
it 'has a valid factory' do
|
7
7
|
FactoryGirl.build(:account).should be_valid
|
@@ -31,8 +31,8 @@ describe Locomotive::Account do
|
|
31
31
|
|
32
32
|
it 'owns many sites' do
|
33
33
|
account = FactoryGirl.create(:account)
|
34
|
-
site_1 = FactoryGirl.create(:site, :
|
35
|
-
site_2 = FactoryGirl.create(:site, :
|
34
|
+
site_1 = FactoryGirl.create(:site, memberships: [Locomotive::Membership.new(account: account)])
|
35
|
+
site_2 = FactoryGirl.create(:site, subdomain: 'another_one', memberships: [Locomotive::Membership.new(account: account)])
|
36
36
|
sites = [site_1, site_2].map(&:_id)
|
37
37
|
account.reload.sites.all? { |s| sites.include?(s._id) }.should be_true
|
38
38
|
end
|
@@ -41,8 +41,8 @@ describe Locomotive::Account do
|
|
41
41
|
|
42
42
|
before(:each) do
|
43
43
|
@account = FactoryGirl.build(:account)
|
44
|
-
@site_1 = FactoryGirl.build(:site
|
45
|
-
@site_2 = FactoryGirl.build(:site
|
44
|
+
@site_1 = FactoryGirl.build(:site,memberships: [FactoryGirl.build(:membership, account: @account)])
|
45
|
+
@site_2 = FactoryGirl.build(:site,memberships: [FactoryGirl.build(:membership, account: @account)])
|
46
46
|
@account.stubs(:sites).returns([@site_1, @site_2])
|
47
47
|
Locomotive::Site.any_instance.stubs(:save).returns(true)
|
48
48
|
end
|
@@ -64,7 +64,7 @@ describe Locomotive::Account do
|
|
64
64
|
|
65
65
|
end
|
66
66
|
|
67
|
-
describe '
|
67
|
+
describe '.admin?' do
|
68
68
|
|
69
69
|
it 'is considered as an admin if she/he has a membership with an admin role' do
|
70
70
|
create_site_and_account
|
@@ -78,8 +78,30 @@ describe Locomotive::Account do
|
|
78
78
|
|
79
79
|
def create_site_and_account(role = 'admin')
|
80
80
|
@account = FactoryGirl.create(:account)
|
81
|
-
@membership = Locomotive::Membership.new(:
|
82
|
-
@site = FactoryGirl.create(:site, :
|
81
|
+
@membership = Locomotive::Membership.new(account: @account, role: role)
|
82
|
+
@site = FactoryGirl.create(:site, memberships: [@membership])
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'api_key' do
|
88
|
+
|
89
|
+
let(:account) { FactoryGirl.build(:account) }
|
90
|
+
|
91
|
+
it 'is not nil for a new account (after validation)' do
|
92
|
+
account.valid?
|
93
|
+
account.api_key.should_not be_nil
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'can be not changed by mass assignment' do
|
97
|
+
account.attributes = { api_key: 'foo' }
|
98
|
+
account.api_key.should_not == 'foo'
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'can be regenerated over and over' do
|
102
|
+
key_1 = account.regenerate_api_key
|
103
|
+
key_1.should_not be_nil
|
104
|
+
account.regenerate_api_key.should_not == key_1
|
83
105
|
end
|
84
106
|
|
85
107
|
end
|
@@ -28,7 +28,7 @@ describe Locomotive::ContentAsset do
|
|
28
28
|
describe 'vignette' do
|
29
29
|
|
30
30
|
before(:each) do
|
31
|
-
@asset = FactoryGirl.build(:asset, :
|
31
|
+
@asset = FactoryGirl.build(:asset, source: FixturedAsset.open('5k.png'))
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'does not resize image smaller than 50x50' do
|
@@ -67,9 +67,15 @@ describe Locomotive::ContentEntry do
|
|
67
67
|
build_content_entry(_slug: 'fish-1-hi').tap(&:save!)._slug.should == 'fish-1-hi'
|
68
68
|
build_content_entry(_slug: 'fish-1-hi').tap(&:save!)._slug.should == 'fish-1-hi-1'
|
69
69
|
end
|
70
|
+
|
71
|
+
it 'correctly handles more than 13 slugs with the same name' do
|
72
|
+
(1..15).each do |i|
|
73
|
+
build_content_entry(_slug: 'dogs').tap(&:save!)._slug.should == "dogs-#{i}"
|
74
|
+
end
|
75
|
+
end
|
70
76
|
end
|
71
77
|
|
72
|
-
describe '#
|
78
|
+
describe '#I18n' do
|
73
79
|
|
74
80
|
before(:each) do
|
75
81
|
localize_content_type @content_type
|
@@ -90,6 +96,55 @@ describe Locomotive::ContentEntry do
|
|
90
96
|
|
91
97
|
end
|
92
98
|
|
99
|
+
describe 'csv' do
|
100
|
+
|
101
|
+
context 'entry itself' do
|
102
|
+
|
103
|
+
subject { build_content_entry }
|
104
|
+
|
105
|
+
it { should respond_to(:to_values) }
|
106
|
+
|
107
|
+
describe '#to_values' do
|
108
|
+
|
109
|
+
subject { build_content_entry.to_values(host: 'example.com') }
|
110
|
+
|
111
|
+
its(:size) { should eq(4) }
|
112
|
+
|
113
|
+
its(:first) { should eq('Locomotive') }
|
114
|
+
|
115
|
+
its(:last) { should eq('') }
|
116
|
+
|
117
|
+
context 'with a file' do
|
118
|
+
|
119
|
+
subject { build_content_entry(file: FixturedAsset.open('5k.png')).tap(&:save).to_values(host: 'example.com') }
|
120
|
+
|
121
|
+
its(:last) { should match(/^http:\/\/example.com\/sites\/[0-9a-f]+\/content_entry\/[0-9a-f]+\/files\/5k.png$/) }
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'set of entries' do
|
130
|
+
|
131
|
+
before(:each) do
|
132
|
+
@content_type.save
|
133
|
+
3.times { build_content_entry(file: FixturedAsset.open('5k.png')).save! }
|
134
|
+
end
|
135
|
+
|
136
|
+
subject { @content_type.ordered_entries.to_csv(host: 'example.com').split("\n") }
|
137
|
+
|
138
|
+
its(:size) { should eq(4) }
|
139
|
+
|
140
|
+
its(:first) { should eq("Title,Description,Visible ?,File") }
|
141
|
+
|
142
|
+
its(:last) { should match(/^Locomotive,Lorem ipsum....,false,http:\/\/example.com\/sites\/[0-9a-f]+\/content_entry\/[0-9a-f]+\/files\/5k.png$/) }
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
93
148
|
describe "#navigation" do
|
94
149
|
|
95
150
|
before(:each) do
|
@@ -277,6 +332,6 @@ describe Locomotive::ContentEntry do
|
|
277
332
|
end
|
278
333
|
|
279
334
|
def fake_bson_id(id)
|
280
|
-
BSON::ObjectId(id.to_s.rjust(24, '0'))
|
335
|
+
Moped::BSON::ObjectId(id.to_s.rjust(24, '0'))
|
281
336
|
end
|
282
337
|
end
|