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
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Locomotive::Extensions::Page::Redirect do
|
4
4
|
|
5
|
-
let(:page) { FactoryGirl.build(:page, :
|
5
|
+
let(:page) { FactoryGirl.build(:page, redirect: true, redirect_url: 'http://www.locomotivecms.com') }
|
6
6
|
|
7
7
|
describe 'redirect option enabled' do
|
8
8
|
|
@@ -5,8 +5,7 @@ describe Locomotive::Extensions::Page::Render do
|
|
5
5
|
before(:each) do
|
6
6
|
Locomotive::Site.any_instance.stubs(:create_default_pages!).returns(true)
|
7
7
|
@site = FactoryGirl.create(:site)
|
8
|
-
@home = FactoryGirl.create(:page, :
|
9
|
-
"""
|
8
|
+
@home = FactoryGirl.create(:page, site: @site, raw_template: """
|
10
9
|
Hello world
|
11
10
|
{% block header %}Home header{% endblock %}
|
12
11
|
{% block main %}My home page{% endblock %}
|
@@ -20,20 +19,17 @@ describe Locomotive::Extensions::Page::Render do
|
|
20
19
|
describe '#inheritance' do
|
21
20
|
|
22
21
|
before(:each) do
|
23
|
-
@inner = FactoryGirl.create(:sub_page, :
|
24
|
-
"""
|
22
|
+
@inner = FactoryGirl.create(:sub_page, slug: 'innerpage', site: @site, raw_template: """
|
25
23
|
{% extends parent %}
|
26
24
|
{% block header %}Inner header{% endblock %}
|
27
25
|
{% block main %}Inner page{% endblock %}
|
28
26
|
""")
|
29
|
-
@contact = FactoryGirl.create(:sub_page, :
|
30
|
-
"""
|
27
|
+
@contact = FactoryGirl.create(:sub_page, slug: 'contact', site: @site, raw_template: """
|
31
28
|
{% extends 'innerpage' %}
|
32
29
|
{% block header %}Contact header{% endblock %}
|
33
30
|
{% block main %}Contact page{% endblock %}
|
34
31
|
""")
|
35
|
-
@about = FactoryGirl.create(:sub_page, :
|
36
|
-
"""
|
32
|
+
@about = FactoryGirl.create(:sub_page, slug: 'about', site: @site, raw_template: """
|
37
33
|
{% extends 'innerpage' %}
|
38
34
|
{% block main %}About page{% endblock %}
|
39
35
|
""")
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Locomotive::Extensions::Site::Locales do
|
4
4
|
|
5
|
-
let(:site) { FactoryGirl.build(:site, :
|
5
|
+
let(:site) { FactoryGirl.build(:site, locales: [:en, :fr]) }
|
6
6
|
|
7
7
|
describe '#localized_page_fullpath' do
|
8
8
|
|
@@ -22,7 +22,7 @@ describe Locomotive::Extensions::Site::Locales do
|
|
22
22
|
|
23
23
|
context 'another page' do
|
24
24
|
|
25
|
-
let(:page) { build_page('about-us', { :
|
25
|
+
let(:page) { build_page('about-us', { fr: 'a-notre-sujet' }) }
|
26
26
|
|
27
27
|
it 'returns only the fullpath if default locale' do
|
28
28
|
site.localized_page_fullpath(page).should == 'about-us'
|
@@ -3,11 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe Locomotive::Membership do
|
4
4
|
|
5
5
|
it 'should have a valid factory' do
|
6
|
-
FactoryGirl.build(:membership, :
|
6
|
+
FactoryGirl.build(:membership, account: FactoryGirl.build(:account)).should be_valid
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should validate presence of account' do
|
10
|
-
membership = FactoryGirl.build(:membership, :
|
10
|
+
membership = FactoryGirl.build(:membership, account: nil)
|
11
11
|
membership.should_not be_valid
|
12
12
|
membership.errors[:account].should == ["can't be blank"]
|
13
13
|
end
|
@@ -15,7 +15,7 @@ describe Locomotive::Membership do
|
|
15
15
|
it 'should assign account from email' do
|
16
16
|
Locomotive::Account.stubs(:where).returns([FactoryGirl.build(:account)])
|
17
17
|
Locomotive::Account.stubs(:find).returns(FactoryGirl.build(:account))
|
18
|
-
membership = FactoryGirl.build(:membership, :
|
18
|
+
membership = FactoryGirl.build(:membership, account: nil)
|
19
19
|
membership.email = 'bart@simpson.net'
|
20
20
|
membership.account.should_not be_nil
|
21
21
|
membership.account.name.should == 'Bart Simpson'
|
@@ -24,7 +24,7 @@ describe Locomotive::Membership do
|
|
24
24
|
describe 'next action to take' do
|
25
25
|
|
26
26
|
before(:each) do
|
27
|
-
@membership = FactoryGirl.build(:membership, :
|
27
|
+
@membership = FactoryGirl.build(:membership, site: FactoryGirl.build(:site))
|
28
28
|
@account = FactoryGirl.build(:account)
|
29
29
|
@account.stubs(:save).returns(true)
|
30
30
|
Locomotive::Account.stubs(:where).returns([@account])
|
@@ -53,7 +53,7 @@ describe Locomotive::Membership do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def build_membership(account = nil)
|
56
|
-
FactoryGirl.build(:membership, :
|
56
|
+
FactoryGirl.build(:membership, site: FactoryGirl.build(:site), account: account || FactoryGirl.build(:account))
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -180,6 +180,15 @@ describe Locomotive::Page do
|
|
180
180
|
archives.reload.children.count.should == 2
|
181
181
|
archives.children.last.depth.should == 2
|
182
182
|
archives.children.last.children.first.depth.should == 3
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
it "builds children fullpaths" do
|
187
|
+
sub_child_1 = FactoryGirl.create(:page, title: 'Sub Subpage 1', slug: 'bar', parent: @child_1, site: @home.site)
|
188
|
+
sub_child_1.fullpath.should == "foo/bar"
|
189
|
+
@child_1.slug = "milky"
|
190
|
+
@child_1.save
|
191
|
+
sub_child_1.reload.fullpath.should == "milky/bar"
|
183
192
|
end
|
184
193
|
|
185
194
|
it 'destroys descendants as well' do
|
@@ -421,7 +430,7 @@ describe Locomotive::Page do
|
|
421
430
|
end
|
422
431
|
|
423
432
|
def fake_bson_id(id)
|
424
|
-
BSON::ObjectId(id.to_s.rjust(24, '0'))
|
433
|
+
Moped::BSON::ObjectId(id.to_s.rjust(24, '0'))
|
425
434
|
end
|
426
435
|
|
427
436
|
end
|
@@ -11,33 +11,33 @@ describe Locomotive::Site do
|
|
11
11
|
## Validations ##
|
12
12
|
|
13
13
|
it 'should validate presence of name' do
|
14
|
-
site = FactoryGirl.build(:site, :
|
14
|
+
site = FactoryGirl.build(:site, name: nil)
|
15
15
|
site.should_not be_valid
|
16
16
|
site.errors[:name].should == ["can't be blank"]
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should validate presence of subdomain' do
|
20
|
-
site = FactoryGirl.build(:site, :
|
20
|
+
site = FactoryGirl.build(:site, subdomain: nil)
|
21
21
|
site.should_not be_valid
|
22
22
|
site.errors[:subdomain].should == ["can't be blank"]
|
23
23
|
end
|
24
24
|
|
25
25
|
%w{test test42 foo_bar}.each do |subdomain|
|
26
26
|
it "should accept subdomain like '#{subdomain}'" do
|
27
|
-
FactoryGirl.build(:site, :
|
27
|
+
FactoryGirl.build(:site, subdomain: subdomain).should be_valid
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
['-', '_test', 'test_', 't est', '42', '42test'].each do |subdomain|
|
32
32
|
it "should not accept subdomain like '#{subdomain}'" do
|
33
|
-
(site = FactoryGirl.build(:site, :
|
33
|
+
(site = FactoryGirl.build(:site, subdomain: subdomain)).should_not be_valid
|
34
34
|
site.errors[:subdomain].should == ['is invalid']
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should not use reserved keywords as subdomain" do
|
39
39
|
%w{www admin email blog webmail mail support help site sites}.each do |subdomain|
|
40
|
-
(site = FactoryGirl.build(:site, :
|
40
|
+
(site = FactoryGirl.build(:site, subdomain: subdomain)).should_not be_valid
|
41
41
|
site.errors[:subdomain].should == ['is reserved']
|
42
42
|
end
|
43
43
|
end
|
@@ -49,26 +49,26 @@ describe Locomotive::Site do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should validate uniqueness of domains' do
|
52
|
-
FactoryGirl.create(:site, :
|
52
|
+
FactoryGirl.create(:site, domains: %w{www.acme.net www.acme.com})
|
53
53
|
|
54
|
-
(site = FactoryGirl.build(:site, :
|
54
|
+
(site = FactoryGirl.build(:site, domains: %w{www.acme.com})).should_not be_valid
|
55
55
|
site.errors[:domains].should == ["www.acme.com is already taken"]
|
56
56
|
|
57
|
-
(site = FactoryGirl.build(:site, :
|
57
|
+
(site = FactoryGirl.build(:site, subdomain: 'foo', domains: %w{acme.example.com})).should_not be_valid
|
58
58
|
site.errors[:domains].should == ["acme.example.com is already taken"]
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should validate format of domains' do
|
62
|
-
site = FactoryGirl.build(:site, :
|
62
|
+
site = FactoryGirl.build(:site, domains: ['barformat.a', '-foo.net', 'goodformat.superlong'])
|
63
63
|
site.should_not be_valid
|
64
|
-
site.errors[:domains].should == ['barformat.
|
64
|
+
site.errors[:domains].should == ['barformat.a is invalid', '-foo.net is invalid']
|
65
65
|
end
|
66
66
|
|
67
67
|
## Named scopes ##
|
68
68
|
|
69
69
|
it 'should retrieve sites by domain' do
|
70
|
-
site_1 = FactoryGirl.create(:site, :
|
71
|
-
site_2 = FactoryGirl.create(:site, :
|
70
|
+
site_1 = FactoryGirl.create(:site, domains: %w{www.acme.net})
|
71
|
+
site_2 = FactoryGirl.create(:site, subdomain: 'test', domains: %w{www.example.com})
|
72
72
|
|
73
73
|
sites = Locomotive::Site.match_domain('www.acme.net')
|
74
74
|
sites.size.should == 1
|
@@ -90,9 +90,9 @@ describe Locomotive::Site do
|
|
90
90
|
|
91
91
|
it 'should have many accounts' do
|
92
92
|
site = FactoryGirl.build(:site)
|
93
|
-
account_1, account_2 = FactoryGirl.create(:account), FactoryGirl.create(:account, :
|
94
|
-
site.memberships.build(:
|
95
|
-
site.memberships.build(:
|
93
|
+
account_1, account_2 = FactoryGirl.create(:account), FactoryGirl.create(:account, name: 'homer', email: 'homer@simpson.net')
|
94
|
+
site.memberships.build(account: account_1, admin: true)
|
95
|
+
site.memberships.build(account: account_2)
|
96
96
|
site.memberships.size.should == 2
|
97
97
|
site.accounts.should == [account_1, account_2]
|
98
98
|
end
|
@@ -100,7 +100,7 @@ describe Locomotive::Site do
|
|
100
100
|
## Methods ##
|
101
101
|
|
102
102
|
it 'should return domains without subdomain' do
|
103
|
-
site = FactoryGirl.create(:site, :
|
103
|
+
site = FactoryGirl.create(:site, domains: %w{www.acme.net www.acme.com})
|
104
104
|
site.domains.should == %w{www.acme.net www.acme.com acme.example.com}
|
105
105
|
site.domains_without_subdomain.should == %w{www.acme.net www.acme.com}
|
106
106
|
end
|
@@ -117,7 +117,7 @@ describe Locomotive::Site do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'translates the index/404 pages if a new locale is added' do
|
120
|
-
@site.update_attributes :
|
120
|
+
@site.update_attributes locales: %w(en fr)
|
121
121
|
|
122
122
|
@site.errors.should be_empty
|
123
123
|
|
@@ -135,7 +135,7 @@ describe Locomotive::Site do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'translates the index/404 pages if the default locale changes' do
|
138
|
-
@site.update_attributes :
|
138
|
+
@site.update_attributes locales: %w(fr en)
|
139
139
|
|
140
140
|
@site.errors.should be_empty
|
141
141
|
|
@@ -153,7 +153,7 @@ describe Locomotive::Site do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
it 'does not allow to remove the default locale' do
|
156
|
-
@site.update_attributes :
|
156
|
+
@site.update_attributes locales: %w(fr)
|
157
157
|
@site.errors[:locales].should == ['The previous default locale can not be removed right away.']
|
158
158
|
end
|
159
159
|
|
@@ -19,18 +19,18 @@ describe Locomotive::Snippet do
|
|
19
19
|
describe '#update_templates' do
|
20
20
|
|
21
21
|
before :each do
|
22
|
-
@site = FactoryGirl.create(:site, :
|
23
|
-
@snippet = FactoryGirl.create(:snippet, :
|
22
|
+
@site = FactoryGirl.create(:site, subdomain: 'omg')
|
23
|
+
@snippet = FactoryGirl.create(:snippet, site: @site, slug: 'my_test_snippet', template: 'a testing template')
|
24
24
|
end
|
25
25
|
|
26
26
|
context 'with a normal top level snippet' do
|
27
27
|
|
28
28
|
before :each do
|
29
|
-
@page = FactoryGirl.create(:page, :
|
29
|
+
@page = FactoryGirl.create(:page, site: @site, slug: 'my_page_here', raw_template: "{% include 'my_test_snippet' %}")
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'updates templates with the new snippet template' do
|
33
|
-
@snippet.update_attributes(:
|
33
|
+
@snippet.update_attributes(template: 'a new template')
|
34
34
|
Locomotive::Page.find(@page.id).render({}).should == 'a new template'
|
35
35
|
end
|
36
36
|
|
@@ -39,11 +39,11 @@ describe Locomotive::Snippet do
|
|
39
39
|
context 'for snippets inside of a block' do
|
40
40
|
|
41
41
|
before :each do
|
42
|
-
@page = FactoryGirl.create(:page, :
|
42
|
+
@page = FactoryGirl.create(:page, site: @site, slug: 'my_page_here', raw_template: "{% block main %}{% include 'my_test_snippet' %}{% endblock %}")
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'updates templates with the new snippet template' do
|
46
|
-
@snippet.update_attributes(:
|
46
|
+
@snippet.update_attributes(template: 'a new template')
|
47
47
|
Locomotive::Page.find(@page.id).render({}).should == 'a new template'
|
48
48
|
end
|
49
49
|
|
@@ -53,8 +53,8 @@ describe Locomotive::Snippet do
|
|
53
53
|
|
54
54
|
before :each do
|
55
55
|
Mongoid::Fields::I18n.with_locale(:fr) do
|
56
|
-
@snippet = FactoryGirl.create(:snippet, :
|
57
|
-
@page = FactoryGirl.create(:page, :
|
56
|
+
@snippet = FactoryGirl.create(:snippet, site: @site, slug: 'my_localized_test_snippet', template: 'a testing template')
|
57
|
+
@page = FactoryGirl.create(:page, site: @site, slug: 'my_localized_test_snippet', raw_template: "{% block main %}{% include 'my_localized_test_snippet' %}{% endblock %}")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -65,7 +65,7 @@ describe Locomotive::Snippet do
|
|
65
65
|
|
66
66
|
it 'updates the templates with the new snippet' do
|
67
67
|
Mongoid::Fields::I18n.with_locale(:fr) do
|
68
|
-
@snippet.update_attributes(:
|
68
|
+
@snippet.update_attributes(template: 'a new template')
|
69
69
|
Locomotive::Page.find(@page.id).render({}).should == 'a new template'
|
70
70
|
end
|
71
71
|
end
|
@@ -4,25 +4,24 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Locomotive::ThemeAsset do
|
6
6
|
|
7
|
-
|
7
|
+
let(:site) { FactoryGirl.build(:site, domains: %w{www.acme.com}) }
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
let(:asset) { FactoryGirl.build(:theme_asset, site: site) }
|
10
|
+
|
11
|
+
describe 'attaching a file' do
|
13
12
|
|
14
13
|
describe 'file is a picture' do
|
15
14
|
|
16
15
|
it 'should process picture' do
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
asset.source = FixturedAsset.open('5k.png')
|
17
|
+
asset.source.file.content_type.should_not be_nil
|
18
|
+
asset.image?.should be_true
|
20
19
|
end
|
21
20
|
|
22
21
|
it 'should get width and height from the image' do
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
asset.source = FixturedAsset.open('5k.png')
|
23
|
+
asset.width.should == 32
|
24
|
+
asset.height.should == 32
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -30,30 +29,30 @@ describe Locomotive::ThemeAsset do
|
|
30
29
|
describe 'local path and folder' do
|
31
30
|
|
32
31
|
it 'should set the local path based on the content type' do
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
asset.source = FixturedAsset.open('5k.png')
|
33
|
+
asset.save
|
34
|
+
asset.local_path.should == 'images/5k.png'
|
36
35
|
end
|
37
36
|
|
38
37
|
it 'should set the local path based on the folder' do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
asset.folder = 'trash'
|
39
|
+
asset.source = FixturedAsset.open('5k.png')
|
40
|
+
asset.save
|
41
|
+
asset.local_path.should == 'images/trash/5k.png'
|
43
42
|
end
|
44
43
|
|
45
44
|
it 'should not only use the folder to build the local path' do
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
asset.folder = 'images42'
|
46
|
+
asset.source = FixturedAsset.open('5k.png')
|
47
|
+
asset.save
|
48
|
+
asset.local_path.should == 'images/images42/5k.png'
|
50
49
|
end
|
51
50
|
|
52
51
|
it 'should set sanitize the local path' do
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
asset.folder = '/images/à la poubelle'
|
53
|
+
asset.source = FixturedAsset.open('5k.png')
|
54
|
+
asset.save
|
55
|
+
asset.local_path.should == 'images/a_la_poubelle/5k.png'
|
57
56
|
end
|
58
57
|
|
59
58
|
end
|
@@ -61,16 +60,16 @@ describe Locomotive::ThemeAsset do
|
|
61
60
|
describe '#validation' do
|
62
61
|
|
63
62
|
it 'does not accept text file' do
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
asset.source = FixturedAsset.open('wrong.txt')
|
64
|
+
asset.valid?.should be_false
|
65
|
+
asset.errors[:source].should_not be_blank
|
67
66
|
end
|
68
67
|
|
69
68
|
it 'is not valid if another file with the same path exists' do
|
70
|
-
|
71
|
-
|
69
|
+
asset.source = FixturedAsset.open('5k.png')
|
70
|
+
asset.save!
|
72
71
|
|
73
|
-
another_asset = FactoryGirl.build(:theme_asset, :
|
72
|
+
another_asset = FactoryGirl.build(:theme_asset, site: asset.site)
|
74
73
|
another_asset.source = FixturedAsset.open('5k.png')
|
75
74
|
another_asset.valid?.should be_false
|
76
75
|
another_asset.errors[:local_path].should_not be_blank
|
@@ -79,48 +78,83 @@ describe Locomotive::ThemeAsset do
|
|
79
78
|
end
|
80
79
|
|
81
80
|
it 'should process stylesheet' do
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
asset.source = FixturedAsset.open('main.css')
|
82
|
+
asset.source.file.content_type.should_not be_nil
|
83
|
+
asset.stylesheet?.should be_true
|
85
84
|
end
|
86
85
|
|
87
86
|
it 'should process javascript' do
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
asset.source = FixturedAsset.open('application.js')
|
88
|
+
asset.source.file.content_type.should_not be_nil
|
89
|
+
asset.javascript?.should be_true
|
91
90
|
end
|
92
91
|
|
93
92
|
it 'should get size' do
|
94
|
-
|
95
|
-
|
93
|
+
asset.source = FixturedAsset.open('main.css')
|
94
|
+
asset.size.should == 25
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'sets the checksum when it is saved' do
|
98
|
+
asset.source = FixturedAsset.open('5k.png')
|
99
|
+
asset.save
|
100
|
+
asset.checksum.should == 'f1af16493e6cba9eaed7bc8a8643246e'
|
96
101
|
end
|
97
102
|
|
98
103
|
end
|
99
104
|
|
100
105
|
describe 'creating from plain text' do
|
101
106
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:plain_text => 'Lorem ipsum',
|
108
|
-
:performing_plain_text => true
|
109
|
-
})
|
110
|
-
end
|
107
|
+
let(:asset) { FactoryGirl.build(:theme_asset,
|
108
|
+
site: site,
|
109
|
+
plain_text_name: 'test',
|
110
|
+
plain_text: 'Lorem ipsum',
|
111
|
+
performing_plain_text: true) }
|
111
112
|
|
112
113
|
it 'should handle stylesheet' do
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
asset.plain_text_type = 'stylesheet'
|
115
|
+
asset.valid?.should be_true
|
116
|
+
asset.stylesheet?.should be_true
|
117
|
+
asset.source.should_not be_nil
|
117
118
|
end
|
118
119
|
|
119
120
|
it 'should handle javascript' do
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
121
|
+
asset.plain_text_type = 'javascript'
|
122
|
+
asset.valid?.should be_true
|
123
|
+
asset.javascript?.should be_true
|
124
|
+
asset.source.should_not be_nil
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
describe '.escape_shortcut_urls' do
|
130
|
+
|
131
|
+
before(:each) do
|
132
|
+
site.theme_assets.stubs(:where).returns([image])
|
133
|
+
end
|
134
|
+
|
135
|
+
let(:image) { stub(source: OpenStruct.new(url: 'http://engine.dev/images/banner.png')) }
|
136
|
+
|
137
|
+
subject { asset.send(:escape_shortcut_urls, text) }
|
138
|
+
|
139
|
+
context 'simple url' do
|
140
|
+
|
141
|
+
let(:text) { "background: url(/images/banner.png) no-repeat 0 0" }
|
142
|
+
it { should == "background: url(http://engine.dev/images/banner.png) no-repeat 0 0" }
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'url with quotes' do
|
147
|
+
|
148
|
+
let(:text) { "background: url(\"/images/banner.png\") no-repeat 0 0" }
|
149
|
+
it { should == "background: url(\"http://engine.dev/images/banner.png\") no-repeat 0 0" }
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'url with quotes and timestamps' do
|
154
|
+
|
155
|
+
let(:text) { "background: url(\"/images/banner.png?123456\") no-repeat 0 0" }
|
156
|
+
it { should == "background: url(\"http://engine.dev/images/banner.png\") no-repeat 0 0" }
|
157
|
+
|
124
158
|
end
|
125
159
|
|
126
160
|
end
|