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
@@ -8,20 +8,20 @@ module Locomotive
|
|
8
8
|
include Extensions::Asset::Vignette
|
9
9
|
|
10
10
|
## fields ##
|
11
|
-
field :content_type, :
|
12
|
-
field :width, :
|
13
|
-
field :height, :
|
14
|
-
field :size, :
|
15
|
-
field :position, :
|
11
|
+
field :content_type, type: String
|
12
|
+
field :width, type: Integer
|
13
|
+
field :height, type: Integer
|
14
|
+
field :size, type: Integer
|
15
|
+
field :position, type: Integer, default: 0
|
16
16
|
|
17
17
|
## associations ##
|
18
|
-
belongs_to :site, :
|
18
|
+
belongs_to :site, class_name: 'Locomotive::Site'
|
19
19
|
|
20
20
|
## validations ##
|
21
21
|
validates_presence_of :source
|
22
22
|
|
23
23
|
## behaviours ##
|
24
|
-
mount_uploader :source, ContentAssetUploader, :
|
24
|
+
mount_uploader :source, ContentAssetUploader, mount_on: :source_filename
|
25
25
|
|
26
26
|
## methods ##
|
27
27
|
|
@@ -33,7 +33,7 @@ module Locomotive
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def to_liquid
|
36
|
-
{ :
|
36
|
+
{ url: self.source.url }.merge(self.attributes).stringify_keys
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
@@ -6,6 +6,7 @@ module Locomotive
|
|
6
6
|
## extensions ##
|
7
7
|
include ::CustomFields::Target
|
8
8
|
include Extensions::Shared::Seo
|
9
|
+
include Extensions::ContentEntry::Csv
|
9
10
|
|
10
11
|
## fields ##
|
11
12
|
field :_slug
|
@@ -29,8 +30,8 @@ module Locomotive
|
|
29
30
|
after_create :send_notifications
|
30
31
|
|
31
32
|
## named scopes ##
|
32
|
-
scope :visible, where
|
33
|
-
scope :latest_updated, order_by: :
|
33
|
+
scope :visible, where(_visible: true)
|
34
|
+
scope :latest_updated, order_by(updated_at: :desc).limit(Locomotive.config.ui[:latest_entries_nb])
|
34
35
|
|
35
36
|
## methods ##
|
36
37
|
|
@@ -114,7 +115,7 @@ module Locomotive
|
|
114
115
|
# @param [ Array ] The ordered array of ids
|
115
116
|
#
|
116
117
|
def self.sort_entries!(ids)
|
117
|
-
list = self.any_in(_id: ids.map { |id| BSON::ObjectId.from_string(id.to_s) }).to_a
|
118
|
+
list = self.any_in(_id: ids.map { |id| Moped::BSON::ObjectId.from_string(id.to_s) }).to_a
|
118
119
|
ids.each_with_index do |id, position|
|
119
120
|
if entry = list.detect { |e| e._id.to_s == id.to_s }
|
120
121
|
entry.update_attributes _position: position
|
@@ -154,7 +155,7 @@ module Locomotive
|
|
154
155
|
criterion = self.content_type.order_by_attribute.to_sym.send(matcher)
|
155
156
|
value = self.send(self.content_type.order_by_attribute.to_sym)
|
156
157
|
|
157
|
-
self.class.where(criterion => value).order_by(
|
158
|
+
self.class.where(criterion => value).order_by(:order_by.asc).limit(1).first
|
158
159
|
end
|
159
160
|
|
160
161
|
# Sets the slug of the instance by using the value of the highlighted field
|
@@ -171,9 +172,9 @@ module Locomotive
|
|
171
172
|
|
172
173
|
# Return the next available unique slug as a string
|
173
174
|
def next_unique_slug
|
174
|
-
slug = self._slug.gsub(/-\d
|
175
|
-
|
176
|
-
next_number =
|
175
|
+
slug = self._slug.gsub(/-\d+$/, '')
|
176
|
+
similar_slugs = self.class.where(:_id.ne => self._id, _slug: /^#{slug}-?\d*$/i)
|
177
|
+
next_number = similar_slugs.map {|s| s._slug.scan(/-(\d+)$/).flatten.last.to_i }.max + 1
|
177
178
|
[slug, next_number].join('-')
|
178
179
|
end
|
179
180
|
|
@@ -13,9 +13,9 @@ module Locomotive
|
|
13
13
|
field :name
|
14
14
|
field :description
|
15
15
|
field :slug
|
16
|
-
field :label_field_id, type: BSON::ObjectId
|
16
|
+
field :label_field_id, type: Moped::BSON::ObjectId
|
17
17
|
field :label_field_name
|
18
|
-
field :group_by_field_id, type: BSON::ObjectId
|
18
|
+
field :group_by_field_id, type: Moped::BSON::ObjectId
|
19
19
|
field :order_by
|
20
20
|
field :order_direction, default: 'asc'
|
21
21
|
field :public_submission_enabled, type: Boolean, default: false
|
@@ -32,10 +32,10 @@ module Locomotive
|
|
32
32
|
end
|
33
33
|
|
34
34
|
## named scopes ##
|
35
|
-
scope :ordered, order_by: :
|
35
|
+
scope :ordered, order_by(updated_at: :desc)
|
36
36
|
|
37
37
|
## indexes ##
|
38
|
-
index
|
38
|
+
index site_id: 1, slug: 1
|
39
39
|
|
40
40
|
## callbacks ##
|
41
41
|
before_validation :normalize_slug
|
@@ -80,7 +80,7 @@ module Locomotive
|
|
80
80
|
self.find_entries_custom_field(self.group_by_field_id)
|
81
81
|
end
|
82
82
|
|
83
|
-
def list_or_group_entries
|
83
|
+
def list_or_group_entries(options = {})
|
84
84
|
if self.groupable?
|
85
85
|
if group_by_field.type == 'select'
|
86
86
|
self.entries.group_by_select_option(self.group_by_field.name, self.order_by_definition)
|
@@ -88,7 +88,11 @@ module Locomotive
|
|
88
88
|
group_by_belongs_to_field(self.group_by_field)
|
89
89
|
end
|
90
90
|
else
|
91
|
-
|
91
|
+
if options[:page].nil?
|
92
|
+
self.ordered_entries
|
93
|
+
else
|
94
|
+
self.ordered_entries.page(options[:page]).per(options[:per_page])
|
95
|
+
end
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -214,7 +218,8 @@ module Locomotive
|
|
214
218
|
#
|
215
219
|
def ensure_class_name_security(field)
|
216
220
|
if field.class_name =~ /^Locomotive::ContentEntry([a-z0-9]+)$/
|
217
|
-
|
221
|
+
# if the content type does not exist (anymore), bypass the security checking
|
222
|
+
content_type = Locomotive::ContentType.find($1) rescue return
|
218
223
|
|
219
224
|
if content_type.site_id != self.site_id
|
220
225
|
field.errors.add :class_name, :security
|
@@ -3,7 +3,7 @@ module Locomotive
|
|
3
3
|
|
4
4
|
## fields ##
|
5
5
|
field :content
|
6
|
-
field :options, :
|
6
|
+
field :options, type: Array, default: []
|
7
7
|
|
8
8
|
## methods ##
|
9
9
|
|
@@ -42,7 +42,7 @@ module Locomotive
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
|
-
self.page.collection.
|
45
|
+
self.page.collection.find(self._selector).update(operations, multi: true)
|
46
46
|
end
|
47
47
|
true
|
48
48
|
end
|
@@ -8,23 +8,23 @@ module Locomotive
|
|
8
8
|
field :slug
|
9
9
|
field :block
|
10
10
|
field :hint
|
11
|
-
field :priority, :
|
12
|
-
field :fixed, :
|
13
|
-
field :disabled, :
|
14
|
-
field :from_parent, :
|
15
|
-
field :locales, :
|
11
|
+
field :priority, type: Integer, default: 0
|
12
|
+
field :fixed, type: Boolean, default: false
|
13
|
+
field :disabled, type: Boolean, default: false, localize: true
|
14
|
+
field :from_parent, type: Boolean, default: false
|
15
|
+
field :locales, type: Array, default: []
|
16
16
|
|
17
17
|
## associations ##
|
18
|
-
embedded_in :page, :
|
18
|
+
embedded_in :page, class_name: 'Locomotive::Page', inverse_of: :editable_elements
|
19
19
|
|
20
20
|
## validations ##
|
21
21
|
validates_presence_of :slug
|
22
22
|
|
23
23
|
## callbacks ##
|
24
|
-
after_save :propagate_content, :
|
24
|
+
after_save :propagate_content, if: :fixed?
|
25
25
|
|
26
26
|
## scopes ##
|
27
|
-
scope :by_priority,
|
27
|
+
scope :by_priority, order_by(priority: :desc)
|
28
28
|
|
29
29
|
## methods ##
|
30
30
|
|
@@ -61,6 +61,11 @@ module Locomotive
|
|
61
61
|
# @param [ Hash ] attributes The up-to-date attributes
|
62
62
|
#
|
63
63
|
def copy_attributes(attributes)
|
64
|
+
# _type is among the mass-assign protected attributes.
|
65
|
+
if type = attributes.delete(:_type)
|
66
|
+
self._type = type
|
67
|
+
end
|
68
|
+
|
64
69
|
self.attributes = attributes
|
65
70
|
end
|
66
71
|
|
@@ -2,14 +2,16 @@ module Locomotive
|
|
2
2
|
class EditableFile < EditableElement
|
3
3
|
|
4
4
|
## behaviours ##
|
5
|
+
# mount_uploader :source, EditableFileUploader
|
5
6
|
mount_uploader 'source', EditableFileUploader
|
6
7
|
|
7
8
|
replace_field 'source', ::String, true
|
8
9
|
|
9
10
|
## fields ##
|
10
|
-
field :default_source_url, :
|
11
|
+
field :default_source_url, localize: true
|
11
12
|
|
12
13
|
## callbacks ##
|
14
|
+
# before_save { |c| puts "#{c.block}/#{c.slug} saved called !"}
|
13
15
|
after_save :propagate_content
|
14
16
|
|
15
17
|
## methods ##
|
@@ -40,7 +42,7 @@ module Locomotive
|
|
40
42
|
def copy_attributes_from(el)
|
41
43
|
super(el)
|
42
44
|
|
43
|
-
if el.source_translations.
|
45
|
+
if el.source_translations.blank?
|
44
46
|
self.attributes['default_source_url'] = el.attributes['default_source_url'] || {}
|
45
47
|
else
|
46
48
|
el.source_translations.keys.each do |locale|
|
@@ -77,7 +79,7 @@ module Locomotive
|
|
77
79
|
}
|
78
80
|
}
|
79
81
|
|
80
|
-
self.page.collection.
|
82
|
+
self.page.collection.find(self._selector).update(operations, multi: true)
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
@@ -2,8 +2,8 @@ module Locomotive
|
|
2
2
|
class EditableShortText < EditableElement
|
3
3
|
|
4
4
|
## fields ##
|
5
|
-
field :content, :
|
6
|
-
field :default_content, :
|
5
|
+
field :content, localize: true
|
6
|
+
field :default_content, type: Boolean, localize: true, default: true
|
7
7
|
|
8
8
|
## methods ##
|
9
9
|
|
@@ -57,7 +57,7 @@ module Locomotive
|
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
60
|
-
self.page.collection.
|
60
|
+
self.page.collection.find(self._selector).update(operations, multi: true)
|
61
61
|
end
|
62
62
|
true
|
63
63
|
end
|
@@ -7,7 +7,7 @@ module Locomotive
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
%w{media image stylesheet javascript font pdf}.each do |type|
|
10
|
-
scope :"only_#{type}", where(:
|
10
|
+
scope :"only_#{type}", where(content_type: type)
|
11
11
|
|
12
12
|
define_method("#{type}?") do
|
13
13
|
self.content_type.to_s == type
|
@@ -20,7 +20,7 @@ module Locomotive
|
|
20
20
|
def by_content_type(content_type)
|
21
21
|
return self.all if content_type.blank?
|
22
22
|
|
23
|
-
self.all.where(:
|
23
|
+
self.all.where(content_type: content_type.to_s)
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Extensions
|
3
|
+
module ContentEntry
|
4
|
+
module Csv
|
5
|
+
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
# Get the values from the custom fields as an array.
|
9
|
+
# Values are ordered by the position of the custom fields.
|
10
|
+
#
|
11
|
+
# @param [ Hash ] options For now, stores only the host for the File fields.
|
12
|
+
#
|
13
|
+
# @return [ Array ]
|
14
|
+
#
|
15
|
+
def to_values(options = {})
|
16
|
+
self.content_type.ordered_entries_custom_fields.map do |field|
|
17
|
+
value = self.send(field.name)
|
18
|
+
self.value_from_type(field.type.to_sym, value, options)
|
19
|
+
end.compact
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Return the transformed value for a particular field type (string, text, ...etc).
|
25
|
+
#
|
26
|
+
# @param [ Symbol ] type Type of the field
|
27
|
+
# @param [ Object ] value Value of the field in the current instance
|
28
|
+
# @param [ Hash ] options For now, stores only the host for the File fields.
|
29
|
+
#
|
30
|
+
# @return [ Object ]
|
31
|
+
#
|
32
|
+
def value_from_type(type, value, options)
|
33
|
+
case type
|
34
|
+
when :file
|
35
|
+
value.blank? ? '' : value.guess_url(options[:host])
|
36
|
+
when :belongs_to
|
37
|
+
value.try(:_label)
|
38
|
+
when :has_many, :many_to_many
|
39
|
+
value.map(&:_label).join(', ')
|
40
|
+
when :tags
|
41
|
+
[*value].join(', ')
|
42
|
+
else
|
43
|
+
value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module ClassMethods
|
48
|
+
|
49
|
+
# Generate a csv from a collection of content entries
|
50
|
+
#
|
51
|
+
# @param [ Hash ] options Options for the csv generation
|
52
|
+
#
|
53
|
+
# @return [ String ] The well-generated CSV document
|
54
|
+
#
|
55
|
+
def to_csv(options = {})
|
56
|
+
content_type = options.delete(:content_type) || all.first.try(:content_type)
|
57
|
+
csv_options = options.select do |k, v|
|
58
|
+
CSV::DEFAULT_OPTIONS.keys.include?(k.to_sym)
|
59
|
+
end
|
60
|
+
|
61
|
+
fields = content_type.ordered_entries_custom_fields
|
62
|
+
|
63
|
+
CSV.generate(csv_options) do |csv|
|
64
|
+
# header
|
65
|
+
csv << fields.map(&:label)
|
66
|
+
# body
|
67
|
+
all.each do |entry|
|
68
|
+
csv << entry.to_values(options)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -7,7 +7,7 @@ module Locomotive
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
field :raw_item_template
|
10
|
-
field :serialized_item_template, :
|
10
|
+
field :serialized_item_template, type: Moped::BSON::Binary
|
11
11
|
|
12
12
|
before_validation :serialize_item_template
|
13
13
|
|
@@ -27,14 +27,14 @@ module Locomotive
|
|
27
27
|
begin
|
28
28
|
self._parse_and_serialize_item_template
|
29
29
|
rescue ::Liquid::SyntaxError => error
|
30
|
-
@item_parsing_errors << I18n.t(:liquid_syntax, :
|
30
|
+
@item_parsing_errors << I18n.t(:liquid_syntax, error: error.to_s, scope: [:errors, :messages])
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def _parse_and_serialize_item_template
|
36
36
|
item_template = ::Liquid::Template.parse(self.raw_item_template, {})
|
37
|
-
self.serialized_item_template = BSON::Binary.new(Marshal.dump(item_template))
|
37
|
+
self.serialized_item_template = Moped::BSON::Binary.new(:generic, Marshal.dump(item_template))
|
38
38
|
end
|
39
39
|
|
40
40
|
def item_template_must_be_valid
|
@@ -18,12 +18,12 @@ module Locomotive
|
|
18
18
|
def sync_relationships_order_by
|
19
19
|
current_class_name = self.klass_with_custom_fields(:entries).name
|
20
20
|
|
21
|
-
self.entries_custom_fields.where(:
|
21
|
+
self.entries_custom_fields.where(type: 'belongs_to').each do |field|
|
22
22
|
target_content_type = self.class_name_to_content_type(field.class_name)
|
23
23
|
|
24
24
|
operations = { '$set' => {} }
|
25
25
|
|
26
|
-
target_content_type.entries_custom_fields.where(:type.in => %w(has_many many_to_many), :
|
26
|
+
target_content_type.entries_custom_fields.where(:type.in => %w(has_many many_to_many), ui_enabled: false, class_name: current_class_name).each do |target_field|
|
27
27
|
if target_field.order_by != self.order_by_definition
|
28
28
|
target_field.order_by = self.order_by_definition # needed by the custom_fields_recipe_for method in order to be up to date
|
29
29
|
|
@@ -49,11 +49,11 @@ module Locomotive
|
|
49
49
|
|
50
50
|
operations['$set']['entries_custom_fields_version'] = content_type.entries_custom_fields_version
|
51
51
|
|
52
|
-
self.collection.
|
52
|
+
self.collection.find(_id: content_type._id).update(operations)
|
53
53
|
|
54
54
|
collection, selector = content_type.entries.collection, content_type.entries.criteria.selector
|
55
55
|
|
56
|
-
collection.update
|
56
|
+
collection.find(selector).update({ '$set' => { 'custom_fields_recipe' => content_type.custom_fields_recipe_for(:entries) } }, multi: true)
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -100,7 +100,7 @@ module Locomotive
|
|
100
100
|
return if ids.empty?
|
101
101
|
|
102
102
|
# super fast way to remove useless elements all in once
|
103
|
-
self.collection.
|
103
|
+
self.collection.find(self.atomic_selector).update('$pull' => { 'editable_elements' => { '_id' => { '$in' => ids } } })
|
104
104
|
|
105
105
|
# mark them as destroyed
|
106
106
|
self.editable_elements.each do |el|
|
@@ -7,7 +7,7 @@ module Locomotive
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
## fields ##
|
10
|
-
field :serialized_template, type: Binary, localize: true
|
10
|
+
field :serialized_template, type: Moped::BSON::Binary, localize: true
|
11
11
|
field :template_dependencies, type: Array, default: [], localize: true
|
12
12
|
field :snippet_dependencies, type: Array, default: [], localize: true
|
13
13
|
|
@@ -61,7 +61,7 @@ module Locomotive
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def _serialize_template
|
64
|
-
self.serialized_template = BSON::Binary.new(Marshal.dump(@template))
|
64
|
+
self.serialized_template = Moped::BSON::Binary.new(:generic, Marshal.dump(@template))
|
65
65
|
end
|
66
66
|
|
67
67
|
def parse(context = {})
|
@@ -28,8 +28,14 @@ module Locomotive
|
|
28
28
|
depth = path == 'index' ? 0 : path.split('/').size
|
29
29
|
|
30
30
|
matching_paths = path == 'index' ? %w(index) : path_combinations(path)
|
31
|
+
|
32
|
+
query = if I18n.locale != I18n.default_locale
|
33
|
+
site.pages.where(depth: depth).any_of({:fullpath.in => matching_paths}, {"fullpath.#{I18n.default_locale}" => {'$in' => matching_paths}})
|
34
|
+
else
|
35
|
+
site.pages.where(depth: depth, :fullpath.in => matching_paths)
|
36
|
+
end
|
31
37
|
|
32
|
-
|
38
|
+
query.each do |_page|
|
33
39
|
if !_page.published? && !logged_in
|
34
40
|
next
|
35
41
|
else
|