locomotivecms 3.0.0.pre.alpha.3 → 3.0.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -8
- data/app/api/locomotive/api.rb +1 -0
- data/app/api/locomotive/api/entities/content_entry_entity.rb +1 -0
- data/app/api/locomotive/api/entities/content_type_entity.rb +2 -1
- data/app/api/locomotive/api/entities/site_entity.rb +4 -0
- data/app/api/locomotive/api/entities/theme_asset_entity.rb +3 -3
- data/app/api/locomotive/api/forms/base_form.rb +0 -6
- data/app/api/locomotive/api/forms/content_type_field_form.rb +6 -10
- data/app/api/locomotive/api/forms/content_type_form.rb +26 -4
- data/app/api/locomotive/api/middlewares/params_decoder_middleware.rb +91 -0
- data/app/api/locomotive/api/resources/content_type_resource.rb +7 -2
- data/app/api/locomotive/api/resources/current_site_resource.rb +10 -2
- data/app/assets/images/locomotive/favicon.png +0 -0
- data/app/assets/javascripts/locomotive/not_logged_in.js.coffee +11 -1
- data/app/assets/javascripts/locomotive/views/application_view.js.coffee +0 -76
- data/app/assets/javascripts/locomotive/views/content_assets/edit_image_view.js.coffee +3 -1
- data/app/assets/javascripts/locomotive/views/dashboard/show_view.js.coffee +33 -1
- data/app/assets/javascripts/locomotive/views/developers_documentation/show_view.js.coffee +9 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/edit_view.js.coffee +3 -1
- data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +11 -11
- data/app/assets/javascripts/locomotive/views/inputs/text_view.js.coffee +16 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +0 -158
- data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +0 -41
- data/app/assets/javascripts/locomotive/views/public_submission_accounts/edit_view.js.coffee +7 -0
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +11 -3
- data/app/assets/javascripts/locomotive/views/shared/list_view.js.coffee +4 -2
- data/app/assets/javascripts/locomotive/views/translations/index_view.js.coffee +5 -0
- data/app/assets/stylesheets/locomotive/application.scss +4 -0
- data/app/assets/stylesheets/locomotive/base/_fonts.scss +5 -5
- data/app/assets/stylesheets/locomotive/base/form/_base.scss +9 -1
- data/app/assets/stylesheets/locomotive/components/_activity_feed.scss +66 -0
- data/app/assets/stylesheets/locomotive/components/_content_assets.scss +27 -8
- data/app/assets/stylesheets/locomotive/components/_developers.scss +34 -0
- data/app/assets/stylesheets/locomotive/components/_error.scss +37 -0
- data/app/assets/stylesheets/locomotive/components/_list.scss +6 -0
- data/app/assets/stylesheets/locomotive/components/_main.scss +4 -0
- data/app/assets/stylesheets/locomotive/components/_misc.scss +1 -0
- data/app/assets/stylesheets/locomotive/components/_translations.scss +13 -0
- data/app/assets/stylesheets/locomotive/components/header/_base.scss +7 -2
- data/app/assets/stylesheets/locomotive/components/misc/_modal.scss +13 -0
- data/app/assets/stylesheets/locomotive/components/misc/_notify.scss +2 -2
- data/app/assets/stylesheets/locomotive/components/not_logged_in/_sign_in_and_up.scss +11 -1
- data/app/assets/stylesheets/locomotive/components/sidebar/_pages_tree.scss +2 -2
- data/app/assets/stylesheets/locomotive/error.scss +12 -0
- data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +1 -1
- data/app/assets/stylesheets/locomotive/globals/_mixins.scss +8 -4
- data/app/assets/stylesheets/locomotive/globals/_variables.scss +2 -0
- data/app/assets/stylesheets/locomotive/not_logged_in.scss +4 -0
- data/app/controllers/locomotive/accounts_controller.rb +6 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/exception_controller.rb +2 -1
- data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +2 -1
- data/app/controllers/locomotive/content_assets_controller.rb +2 -2
- data/app/controllers/locomotive/content_entries_controller.rb +2 -2
- data/app/controllers/locomotive/current_site_controller.rb +5 -1
- data/app/controllers/locomotive/custom_fields/select_options_controller.rb +1 -1
- data/app/controllers/locomotive/dashboard_controller.rb +2 -0
- data/app/controllers/locomotive/developers_documentation_controller.rb +11 -0
- data/app/controllers/locomotive/editable_elements_controller.rb +11 -10
- data/app/controllers/locomotive/errors_controller.rb +15 -0
- data/app/controllers/locomotive/pages_controller.rb +3 -3
- data/app/controllers/locomotive/public_submission_accounts_controller.rb +42 -0
- data/app/controllers/locomotive/translations_controller.rb +9 -23
- data/app/helpers/locomotive/base_helper.rb +25 -23
- data/app/helpers/locomotive/content_assets_helper.rb +8 -0
- data/app/helpers/locomotive/content_entries_helper.rb +13 -19
- data/app/helpers/locomotive/content_types_helper.rb +9 -12
- data/app/helpers/locomotive/custom_fields_helper.rb +1 -0
- data/app/helpers/locomotive/dashboard_helper.rb +91 -0
- data/app/helpers/locomotive/developers_documentation_helper.rb +32 -0
- data/app/helpers/locomotive/editable_elements_helper.rb +25 -14
- data/app/helpers/locomotive/errors_helper.rb +21 -0
- data/app/helpers/locomotive/my_account_helper.rb +10 -8
- data/app/helpers/locomotive/pages_helper.rb +1 -1
- data/app/helpers/locomotive/public_submission_accounts_helper.rb +11 -0
- data/app/helpers/locomotive/shared/accounts_helper.rb +2 -2
- data/app/helpers/locomotive/sites_helper.rb +15 -11
- data/app/helpers/locomotive/translations_helper.rb +21 -13
- data/app/inputs/locomotive/api_key_input.rb +2 -0
- data/app/inputs/locomotive/array_input.rb +8 -3
- data/app/inputs/locomotive/code_input.rb +1 -47
- data/app/inputs/locomotive/document_picker_input.rb +1 -0
- data/app/inputs/locomotive/rte_input.rb +2 -0
- data/app/inputs/locomotive/toggle_input.rb +2 -0
- data/app/models/locomotive/activity.rb +32 -0
- data/app/models/locomotive/concerns/content_entry/localized.rb +12 -1
- data/app/models/locomotive/concerns/content_type/entry_template.rb +52 -0
- data/app/models/locomotive/concerns/page/editable_elements.rb +0 -111
- data/app/models/locomotive/concerns/page/layout.rb +21 -6
- data/app/models/locomotive/concerns/site/access_points.rb +24 -3
- data/app/models/locomotive/concerns/site/locales.rb +7 -27
- data/app/models/locomotive/content_asset.rb +0 -4
- data/app/models/locomotive/content_entry.rb +10 -8
- data/app/models/locomotive/content_type.rb +12 -1
- data/app/models/locomotive/editable_element.rb +11 -106
- data/app/models/locomotive/editable_file.rb +6 -53
- data/app/models/locomotive/editable_model.rb +13 -0
- data/app/models/locomotive/editable_text.rb +0 -51
- data/app/models/locomotive/page.rb +31 -17
- data/app/models/locomotive/site.rb +12 -13
- data/app/models/locomotive/theme_asset.rb +0 -4
- data/app/models/locomotive/translation.rb +50 -35
- data/app/policies/locomotive/content_type_policy.rb +4 -0
- data/app/policies/locomotive/site_policy.rb +4 -0
- data/app/services/locomotive/concerns/activity_service.rb +27 -0
- data/app/services/locomotive/content_asset_service.rb +16 -2
- data/app/services/locomotive/content_entry_service.rb +77 -8
- data/app/services/locomotive/content_type_service.rb +6 -2
- data/app/services/locomotive/editable_element_service.rb +11 -4
- data/app/services/locomotive/membership_service.rb +20 -4
- data/app/services/locomotive/page_parsing_service.rb +94 -23
- data/app/services/locomotive/page_service.rb +61 -3
- data/app/services/locomotive/site_service.rb +43 -1
- data/app/services/locomotive/translation_service.rb +51 -0
- data/app/uploaders/locomotive/picture_uploader.rb +5 -1
- data/app/views/locomotive/accounts/{new.html.haml → new.html.slim} +0 -0
- data/app/views/locomotive/content_assets/{_dropzone.html.haml → _dropzone.html.slim} +4 -3
- data/app/views/locomotive/content_assets/{_list.html.haml → _list.html.slim} +11 -9
- data/app/views/locomotive/content_assets/{_nav.html.haml → _nav.html.slim} +5 -5
- data/app/views/locomotive/content_assets/{_search_form.html.haml → _search_form.html.slim} +1 -1
- data/app/views/locomotive/content_assets/edit_in_drawer.html.slim +27 -0
- data/app/views/locomotive/content_assets/{index.html.haml → index.html.slim} +4 -4
- data/app/views/locomotive/content_assets/{index_in_drawer.html.haml → index_in_drawer.html.slim} +1 -1
- data/app/views/locomotive/content_entries/{_entry.html.haml → _entry.html.slim} +3 -3
- data/app/views/locomotive/content_entries/{_list.html.haml → _list.html.slim} +9 -8
- data/app/views/locomotive/content_entries/{edit.html.haml → edit.html.slim} +5 -0
- data/app/views/locomotive/content_entries/form/{_actions.html.haml → _actions.html.slim} +0 -0
- data/app/views/locomotive/content_entries/form/{_advanced.html.haml → _advanced.html.slim} +0 -0
- data/app/views/locomotive/content_entries/form/{_main.html.haml → _main.html.slim} +0 -0
- data/app/views/locomotive/content_entries/form/{_panes.html.haml → _panes.html.slim} +0 -0
- data/app/views/locomotive/content_entries/form/{_seo.html.haml → _seo.html.slim} +0 -0
- data/app/views/locomotive/content_entries/form/_tabs.html.slim +13 -0
- data/app/views/locomotive/content_entries/{index.html.haml → index.html.slim} +22 -9
- data/app/views/locomotive/content_entries/{new.html.haml → new.html.slim} +0 -0
- data/app/views/locomotive/current_site/{_domain.html.haml → _domain.html.slim} +3 -3
- data/app/views/locomotive/current_site/{_locale.html.haml → _locale.html.slim} +4 -4
- data/app/views/locomotive/current_site/{_membership.html.haml → _membership.html.slim} +7 -6
- data/app/views/locomotive/current_site/{edit.html.haml → edit.html.slim} +1 -1
- data/app/views/locomotive/current_site/form/{_access_points.html.haml → _access_points.html.slim} +1 -0
- data/app/views/locomotive/current_site/form/{_advanced.html.haml → _advanced.html.slim} +0 -0
- data/app/views/locomotive/current_site/form/{_main.html.haml → _main.html.slim} +0 -0
- data/app/views/locomotive/current_site/form/{_panes.html.haml → _panes.html.slim} +0 -0
- data/app/views/locomotive/current_site/form/{_seo.html.haml → _seo.html.slim} +0 -0
- data/app/views/locomotive/current_site/form/_tabs.html.slim +14 -0
- data/app/views/locomotive/custom_fields/select_options/{_option.html.haml → _option.html.slim} +7 -7
- data/app/views/locomotive/custom_fields/select_options/{edit.html.haml → edit.html.slim} +0 -0
- data/app/views/locomotive/dashboard/show.html.slim +28 -0
- data/app/views/locomotive/developers_documentation/_api.html.slim +44 -0
- data/app/views/locomotive/developers_documentation/_wagon.html.slim +42 -0
- data/app/views/locomotive/developers_documentation/show.html.slim +11 -0
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +12 -0
- data/app/views/locomotive/editable_elements/_edit.html.slim +52 -0
- data/app/views/locomotive/editable_elements/{_form.html.haml → _form.html.slim} +12 -3
- data/app/views/locomotive/editable_elements/index.html.slim +8 -0
- data/app/views/locomotive/editable_elements/{index_without_preview.html.haml → index_without_preview.html.slim} +5 -4
- data/app/views/locomotive/errors/404.html.slim +2 -0
- data/app/views/locomotive/errors/500.html.slim +2 -0
- data/app/views/locomotive/errors/no_site.html.slim +7 -0
- data/app/views/locomotive/layouts/application.html.slim +42 -0
- data/app/views/locomotive/layouts/error.html.slim +24 -0
- data/app/views/locomotive/layouts/{live_editing.html.haml → live_editing.html.slim} +10 -10
- data/app/views/locomotive/layouts/not_logged_in.html.slim +26 -0
- data/app/views/locomotive/layouts/{without_site.html.haml → without_site.html.slim} +9 -6
- data/app/views/locomotive/memberships/{edit.html.haml → edit.html.slim} +0 -0
- data/app/views/locomotive/memberships/{new.html.haml → new.html.slim} +0 -0
- data/app/views/locomotive/my_account/{edit.html.haml → edit.html.slim} +1 -1
- data/app/views/locomotive/my_account/form/{_actions.html.haml → _actions.html.slim} +0 -0
- data/app/views/locomotive/my_account/form/{_api.html.haml → _api.html.slim} +0 -1
- data/app/views/locomotive/my_account/form/{_credentials.html.haml → _credentials.html.slim} +0 -0
- data/app/views/locomotive/my_account/form/{_main.html.haml → _main.html.slim} +0 -0
- data/app/views/locomotive/my_account/form/{_panes.html.haml → _panes.html.slim} +1 -1
- data/app/views/locomotive/my_account/form/_tabs.html.slim +7 -0
- data/app/views/locomotive/notifications/{new_content_entry.html.haml → new_content_entry.html.slim} +11 -11
- data/app/views/locomotive/pages/{edit.html.haml → edit.html.slim} +0 -0
- data/app/views/locomotive/pages/form/{_actions.html.haml → _actions.html.slim} +0 -0
- data/app/views/locomotive/pages/form/{_main.html.haml → _main.html.slim} +0 -0
- data/app/views/locomotive/pages/form/{_panes.html.haml → _panes.html.slim} +0 -0
- data/app/views/locomotive/pages/form/{_seo.html.haml → _seo.html.slim} +0 -0
- data/app/views/locomotive/pages/form/{_tabs.html.haml → _tabs.html.slim} +1 -1
- data/app/views/locomotive/pages/{new.html.haml → new.html.slim} +0 -0
- data/app/views/locomotive/pages/show.html.slim +2 -0
- data/app/views/locomotive/passwords/{edit.html.haml → edit.html.slim} +6 -6
- data/app/views/locomotive/passwords/{new.html.haml → new.html.slim} +6 -6
- data/app/views/locomotive/public_submission_accounts/_account.html.slim +19 -0
- data/app/views/locomotive/public_submission_accounts/edit.html.slim +16 -0
- data/app/views/locomotive/registrations/{new.html.haml → new.html.slim} +2 -4
- data/app/views/locomotive/sessions/{new.html.haml → new.html.slim} +2 -4
- data/app/views/locomotive/shared/_footer.html.slim +2 -0
- data/app/views/locomotive/shared/{_form_actions.html.haml → _form_actions.html.slim} +4 -4
- data/app/views/locomotive/shared/_head.html.slim +39 -0
- data/app/views/locomotive/shared/{_header.html.haml → _header.html.slim} +10 -10
- data/app/views/locomotive/shared/_locale_picker_link.html.slim +11 -0
- data/app/views/locomotive/shared/{_main_app_head.html.haml → _main_app_head.html.slim} +0 -0
- data/app/views/locomotive/shared/{_main_app_head_before_backbone.html.haml → _main_app_head_before_backbone.html.slim} +0 -0
- data/app/views/locomotive/shared/{_main_app_header.html.haml → _main_app_header.html.slim} +0 -0
- data/app/views/locomotive/shared/{_sidebar.html.haml → _sidebar.html.slim} +6 -0
- data/app/views/locomotive/shared/{_sidebar_without_site.html.haml → _sidebar_without_site.html.slim} +0 -0
- data/app/views/locomotive/shared/actions/{_contents.html.haml → _contents.html.slim} +1 -1
- data/app/views/locomotive/shared/header/{_account.html.haml → _account.html.slim} +1 -1
- data/app/views/locomotive/shared/header/_account_menu.html.slim +5 -0
- data/app/views/locomotive/shared/header/_brand.html.slim +5 -0
- data/app/views/locomotive/shared/header/{_site.html.haml → _site.html.slim} +2 -2
- data/app/views/locomotive/shared/rte/{_image_popover.html.haml → _image_popover.html.slim} +5 -5
- data/app/views/locomotive/shared/rte/{_link_popover.html.haml → _link_popover.html.slim} +5 -5
- data/app/views/locomotive/shared/rte/_toolbar.html.slim +62 -0
- data/app/views/locomotive/shared/sidebar/_content_types.html.slim +16 -0
- data/app/views/locomotive/shared/sidebar/_link.html.slim +10 -0
- data/app/views/locomotive/shared/sidebar/{_my_account.html.haml → _my_account.html.slim} +2 -2
- data/app/views/locomotive/shared/sidebar/_page.html.slim +33 -0
- data/app/views/locomotive/shared/sidebar/_pages.html.slim +11 -0
- data/app/views/locomotive/sites/{_site.html.haml → _site.html.slim} +3 -3
- data/app/views/locomotive/sites/{index.html.haml → index.html.slim} +3 -3
- data/app/views/locomotive/sites/{new.html.haml → new.html.slim} +0 -0
- data/app/views/locomotive/translations/_form.html.slim +9 -0
- data/app/views/locomotive/translations/edit.html.slim +7 -0
- data/app/views/locomotive/translations/index.html.slim +41 -0
- data/config/initializers/slim.rb +1 -0
- data/config/initializers/time_format.rb +15 -0
- data/config/locales/admin_ui.en.yml +65 -49
- data/config/locales/default.en.yml +3 -0
- data/config/locales/default.fr.yml +4 -1
- data/config/locales/simple_form.en.yml +14 -8
- data/config/routes.rb +6 -0
- data/features/support/env.rb +1 -1
- data/lib/generators/locomotive/install/install_generator.rb +48 -0
- data/lib/generators/locomotive/install/templates/heroku.rb +29 -0
- data/lib/generators/locomotive/install/templates/locomotive.rb +5 -2
- data/lib/generators/locomotive/install/templates/mongoid.yml +1 -1
- data/lib/generators/locomotive/install/templates/mongoid_heroku.yml +78 -0
- data/lib/locomotive.rb +0 -1
- data/lib/locomotive/configuration.rb +2 -6
- data/lib/locomotive/dependencies.rb +1 -2
- data/lib/locomotive/dragonfly.rb +4 -5
- data/lib/locomotive/engine.rb +10 -13
- data/lib/locomotive/middlewares.rb +0 -1
- data/lib/locomotive/middlewares/custom_public_exceptions.rb +19 -0
- data/lib/locomotive/middlewares/site.rb +49 -16
- data/lib/locomotive/simple_form.rb +67 -26
- data/lib/locomotive/steam/middlewares/missing_translations.rb +48 -0
- data/lib/locomotive/steam/middlewares/page_editing.rb +48 -0
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +38 -0
- data/lib/locomotive/steam_adaptor.rb +25 -6
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/locomotive.rake +27 -47
- data/spec/dummy/app/views/foo/index.html.slim +1 -0
- data/spec/dummy/app/views/locomotive/shared/{_main_app_head.html.haml → _main_app_head.html.slim} +0 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +4 -0
- data/spec/dummy/config/environments/profile.rb +48 -0
- data/spec/dummy/config/mongoid.yml +6 -6
- data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +39 -0
- data/spec/models/locomotive/concerns/content_type/entry_template_spec.rb +55 -0
- data/spec/models/locomotive/concerns/page/layout_spec.rb +2 -2
- data/spec/models/locomotive/concerns/site/access_points_spec.rb +87 -2
- data/spec/models/locomotive/concerns/site/locales_spec.rb +2 -3
- data/spec/models/locomotive/content_entry_spec.rb +22 -37
- data/spec/models/locomotive/page_spec.rb +11 -0
- data/spec/models/locomotive/site_spec.rb +0 -36
- data/spec/requests/site_spec.rb +28 -0
- data/spec/support/capybara.rb +27 -0
- data/spec/support/factories.rb +9 -0
- data/spec/support/features/session_helpers.rb +21 -0
- data/spec/support/locomotive.rb +0 -4
- data/spec/support/matchers.rb +0 -25
- data/vendor/assets/javascripts/locomotive/highlight.pack.js +1 -0
- data/vendor/assets/stylesheets/locomotive/highlightjs/default.css +155 -0
- data/vendor/assets/stylesheets/locomotive/highlightjs/github.css +123 -0
- metadata +179 -195
- data/app/assets/images/locomotive/background/body.png +0 -0
- data/app/assets/images/locomotive/form/error-arrow.png +0 -0
- data/app/assets/images/locomotive/form/input-sep.png +0 -0
- data/app/assets/images/locomotive/icons/start.png +0 -0
- data/app/assets/images/locomotive/list/empty.png +0 -0
- data/app/assets/images/locomotive/list/item-left.png +0 -0
- data/app/assets/images/locomotive/nocoffee.png +0 -0
- data/app/assets/images/locomotive/plugins/sites_picker_top_arrow.png +0 -0
- data/app/assets/images/locomotive/rails.png +0 -0
- data/app/assets/javascripts/locomotive/views/pages/index_view.js.coffee +0 -11
- data/app/cells/locomotive/content_locale_picker/show.html.haml +0 -7
- data/app/cells/locomotive/content_locale_picker_cell.rb +0 -21
- data/app/helpers/locomotive/installation_helper.rb +0 -9
- data/app/inputs/locomotive/locale_input.rb +0 -41
- data/app/inputs/locomotive/small_code_input.rb +0 -23
- data/app/models/locomotive/concerns/content_entry/notifications.rb +0 -33
- data/app/models/locomotive/concerns/content_type/item_template.rb +0 -49
- data/app/models/locomotive/concerns/page/parse.rb +0 -133
- data/app/presenters/locomotive/account_presenter.rb +0 -20
- data/app/presenters/locomotive/base_presenter.rb +0 -144
- data/app/presenters/locomotive/content_asset_presenter.rb +0 -51
- data/app/presenters/locomotive/content_entry_presenter.rb +0 -177
- data/app/presenters/locomotive/content_field_presenter.rb +0 -76
- data/app/presenters/locomotive/content_type_presenter.rb +0 -82
- data/app/presenters/locomotive/editable_control_presenter.rb +0 -19
- data/app/presenters/locomotive/editable_element_presenter.rb +0 -46
- data/app/presenters/locomotive/editable_file_presenter.rb +0 -36
- data/app/presenters/locomotive/editable_text_presenter.rb +0 -40
- data/app/presenters/locomotive/membership_presenter.rb +0 -35
- data/app/presenters/locomotive/page_presenter.rb +0 -81
- data/app/presenters/locomotive/site_presenter.rb +0 -40
- data/app/presenters/locomotive/snippet_presenter.rb +0 -22
- data/app/presenters/locomotive/theme_asset_presenter.rb +0 -61
- data/app/presenters/locomotive/translation_presenter.rb +0 -9
- data/app/views/locomotive/content_assets/edit_in_drawer.html.haml +0 -26
- data/app/views/locomotive/content_entries/form/_tabs.html.haml +0 -9
- data/app/views/locomotive/current_site/form/_tabs.html.haml +0 -14
- data/app/views/locomotive/dashboard/show.html.haml +0 -0
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.haml +0 -12
- data/app/views/locomotive/editable_elements/_edit.html.haml +0 -49
- data/app/views/locomotive/editable_elements/_edit_with_content_entry.html.haml +0 -21
- data/app/views/locomotive/editable_elements/index.html.haml +0 -8
- data/app/views/locomotive/errors/404.html.haml +0 -7
- data/app/views/locomotive/errors/500.html.haml +0 -7
- data/app/views/locomotive/errors/no_page.html.haml +0 -1
- data/app/views/locomotive/errors/no_site.html.haml +0 -1
- data/app/views/locomotive/layouts/application.html.haml +0 -42
- data/app/views/locomotive/layouts/error.html.haml +0 -1
- data/app/views/locomotive/layouts/not_logged_in.html.haml +0 -18
- data/app/views/locomotive/my_account/form/_tabs.html.haml +0 -7
- data/app/views/locomotive/pages/_editable_elements.html.haml +0 -64
- data/app/views/locomotive/pages/index.html.haml +0 -22
- data/app/views/locomotive/pages/show.html.haml +0 -2
- data/app/views/locomotive/shared/_footer.html.haml +0 -2
- data/app/views/locomotive/shared/_head.html.haml +0 -40
- data/app/views/locomotive/shared/_locale_picker_link.html.haml +0 -6
- data/app/views/locomotive/shared/header/_account_menu.html.haml +0 -5
- data/app/views/locomotive/shared/header/_brand.html.haml +0 -4
- data/app/views/locomotive/shared/rte/_toolbar.html.haml +0 -62
- data/app/views/locomotive/shared/sidebar/_content_types.html.haml +0 -15
- data/app/views/locomotive/shared/sidebar/_link.html.haml +0 -10
- data/app/views/locomotive/shared/sidebar/_page.html.haml +0 -33
- data/app/views/locomotive/shared/sidebar/_pages.html.haml +0 -11
- data/app/views/locomotive/translations/_form.html.haml +0 -12
- data/app/views/locomotive/translations/edit.html.haml +0 -15
- data/app/views/locomotive/translations/index.html.haml +0 -30
- data/app/views/locomotive/translations/new.html.haml +0 -12
- data/config/initializers/haml.rb +0 -2
- data/config/initializers/locomotive_loaded_first.rb +0 -19
- data/config/locales/formtastic.bg.yml +0 -113
- data/config/locales/formtastic.cs.yml +0 -125
- data/config/locales/formtastic.de.yml +0 -106
- data/config/locales/formtastic.es.yml +0 -84
- data/config/locales/formtastic.et.yml +0 -103
- data/config/locales/formtastic.fr.yml +0 -109
- data/config/locales/formtastic.it.yml +0 -99
- data/config/locales/formtastic.ja.yml +0 -103
- data/config/locales/formtastic.nb.yml +0 -103
- data/config/locales/formtastic.nl.yml +0 -85
- data/config/locales/formtastic.pl.yml +0 -105
- data/config/locales/formtastic.pt-BR.yml +0 -70
- data/config/locales/formtastic.pt.yml +0 -70
- data/config/locales/formtastic.ru.yml +0 -106
- data/config/locales/formtastic.sk.yml +0 -125
- data/config/locales/formtastic.sr.yml +0 -112
- data/config/locales/formtastic.zh-CN.yml +0 -112
- data/lib/locomotive/haml.rb +0 -1
- data/lib/locomotive/middlewares/page_editing.rb +0 -41
- data/spec/dummy/app/views/foo/index.html.haml +0 -1
- data/spec/dummy/config/initializers/haml.rb +0 -2
- data/spec/support/asset_host_stubs.rb +0 -17
- data/spec/support/controller.rb +0 -32
@@ -8,22 +8,51 @@ module Locomotive
|
|
8
8
|
|
9
9
|
def find_or_create_editable_elements(page)
|
10
10
|
benchmark "Parse page #{page._id} find_or_create_editable_elements" do
|
11
|
-
parsed = { extends: {}, blocks: {}, elements: [] }
|
11
|
+
parsed = { extends: {}, blocks: {}, super_blocks: {}, elements: [] }
|
12
12
|
|
13
|
-
subscribe(parsed)
|
13
|
+
subscribe(parsed) do
|
14
|
+
parse(page)
|
14
15
|
|
15
|
-
|
16
|
+
persist_editable_elements(page, parsed).tap do |elements|
|
17
|
+
remove_useless_editable_elements(page, elements)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
16
22
|
|
17
|
-
|
23
|
+
# Each element of the elements parameter is a couple: Page, EditableElement
|
24
|
+
def group_and_sort_editable_elements(elements)
|
25
|
+
elements.group_by { |(_, el)| el.block }.tap do |groups|
|
26
|
+
groups.each do |_, list|
|
27
|
+
list.sort! { |(_, a), (_, b)| (b.priority || 0) <=> (a.priority || 0) }
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
|
32
|
+
def blocks_from_grouped_editable_elements(groups)
|
33
|
+
groups.map do |block, elements|
|
34
|
+
next if elements.empty?
|
35
|
+
|
36
|
+
element = elements.first.last
|
37
|
+
|
38
|
+
{ name: block, label: element.block_label, priority: element.block_priority }
|
39
|
+
end.sort { |a, b| b[:priority] <=> a[:priority] }
|
40
|
+
end
|
41
|
+
|
21
42
|
private
|
22
43
|
|
23
|
-
def subscribe(parsed)
|
24
|
-
|
25
|
-
|
26
|
-
|
44
|
+
def subscribe(parsed, &block)
|
45
|
+
subscribers = [
|
46
|
+
subscribe_to_extends(parsed[:extends]),
|
47
|
+
subscribe_to_blocks(parsed[:blocks], parsed[:super_blocks]),
|
48
|
+
subscribe_to_editable_elements(parsed[:elements])
|
49
|
+
]
|
50
|
+
|
51
|
+
yield.tap do
|
52
|
+
subscribers.each do |subscriber|
|
53
|
+
ActiveSupport::Notifications.unsubscribe(subscriber)
|
54
|
+
end
|
55
|
+
end
|
27
56
|
end
|
28
57
|
|
29
58
|
def subscribe_to_extends(extends)
|
@@ -33,11 +62,13 @@ module Locomotive
|
|
33
62
|
end
|
34
63
|
end
|
35
64
|
|
36
|
-
def subscribe_to_blocks(blocks)
|
65
|
+
def subscribe_to_blocks(blocks, super_blocks)
|
37
66
|
ActiveSupport::Notifications.subscribe('steam.parse.inherited_block') do |name, start, finish, id, payload|
|
38
67
|
page_id, block_name, found_super = payload[:page]._id, payload[:name], payload[:found_super]
|
39
|
-
|
40
|
-
|
68
|
+
super_blocks[page_id] ||= {}
|
69
|
+
super_blocks[page_id][block_name] = found_super
|
70
|
+
|
71
|
+
blocks[block_name] ||= payload.slice(:short_name, :priority)
|
41
72
|
end
|
42
73
|
end
|
43
74
|
|
@@ -50,14 +81,14 @@ module Locomotive
|
|
50
81
|
|
51
82
|
def parse(page)
|
52
83
|
entity = repository.build(page.attributes.dup)
|
53
|
-
decorated_page = Locomotive::Steam::Decorators::TemplateDecorator.new(entity, self.locale)
|
84
|
+
decorated_page = Locomotive::Steam::Decorators::TemplateDecorator.new(entity, self.locale, self.site.default_locale)
|
54
85
|
|
55
86
|
parser = services.liquid_parser
|
56
87
|
parser.parse(decorated_page)
|
57
88
|
end
|
58
89
|
|
59
90
|
def persist_editable_elements(page, parsed)
|
60
|
-
modified_pages = [] # group modifications by page
|
91
|
+
modified_pages, pages = [], { page._id => page } # group modifications by page
|
61
92
|
|
62
93
|
elements = parsed[:elements].map do |couple|
|
63
94
|
_page, attributes = couple
|
@@ -65,10 +96,12 @@ module Locomotive
|
|
65
96
|
next if !persist_editable_element?(page, parsed, _page, attributes)
|
66
97
|
|
67
98
|
# Note: _page is a Steam entity but we need a Mongoid document to save the elements
|
68
|
-
_page = attributes[:fixed] ?
|
99
|
+
_page = attributes[:fixed] ? find_page(_page._id, pages) : page
|
100
|
+
|
101
|
+
element = add_or_modify_editable_element(_page, attributes)
|
102
|
+
couple[0], couple[1] = _page, element # we get now a Mongoid document instead of a Steam entity
|
69
103
|
|
70
|
-
element
|
71
|
-
couple[1] = element # we get now a Mongoid document instead of a Steam entity
|
104
|
+
assign_block_information(element, parsed[:blocks])
|
72
105
|
|
73
106
|
modified_pages << _page
|
74
107
|
|
@@ -82,13 +115,34 @@ module Locomotive
|
|
82
115
|
|
83
116
|
def persist_editable_element?(page, parsed, _page, attributes)
|
84
117
|
page_id, block_name = _page._id, attributes[:block]
|
85
|
-
descendant = parsed[:extends][page_id]
|
86
|
-
found_super = parsed[:blocks][descendant].try(:[], block_name)
|
87
118
|
|
88
|
-
page._id == _page._id
|
89
|
-
|
90
|
-
|
91
|
-
|
119
|
+
if page._id == _page._id # same page
|
120
|
+
true
|
121
|
+
elsif block_name.blank? # an editable_element out of a block (impossible to remove it in pages extending this template)
|
122
|
+
true
|
123
|
+
else
|
124
|
+
block_visible?(_page._id, parsed, attributes)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def block_visible?(page_id, parsed, attributes)
|
129
|
+
block_name = attributes[:block]
|
130
|
+
descendant = parsed[:extends][page_id]
|
131
|
+
|
132
|
+
return true if descendant.nil?
|
133
|
+
|
134
|
+
# find if the descendant hides the block
|
135
|
+
if (blocks = parsed[:super_blocks][descendant]).blank?
|
136
|
+
# we can not know for sure, ask the descendant of the descendant
|
137
|
+
block_visible?(descendant, parsed, attributes)
|
138
|
+
else
|
139
|
+
found_super = blocks[block_name]
|
140
|
+
hidden = blocks.keys.any? { |name| block_name =~ /\A#{name}(\Z|\/)/ }
|
141
|
+
if found_super || !hidden
|
142
|
+
# again, we need to ask the descendant of the descendant
|
143
|
+
block_visible?(descendant, parsed, attributes)
|
144
|
+
end
|
145
|
+
end
|
92
146
|
end
|
93
147
|
|
94
148
|
def add_or_modify_editable_element(page, attributes)
|
@@ -97,7 +151,20 @@ module Locomotive
|
|
97
151
|
element
|
98
152
|
else
|
99
153
|
klass = "Locomotive::#{attributes[:type].to_s.classify}".constantize
|
100
|
-
|
154
|
+
page.editable_elements.build(attributes, klass)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def remove_useless_editable_elements(page, elements)
|
159
|
+
if _elements = (elements.map { |p, _elements| p._id == page._id ? _elements : nil }.flatten.compact)
|
160
|
+
page.editable_elements.where(:_id.nin => _elements.map(&:_id)).destroy_all
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def assign_block_information(element, blocks)
|
165
|
+
if element.block && (options = blocks[element.block])
|
166
|
+
element.block_name = element.block.split('/').last if options[:short_name]
|
167
|
+
element.block_priority = options[:priority]
|
101
168
|
end
|
102
169
|
end
|
103
170
|
|
@@ -112,6 +179,10 @@ module Locomotive
|
|
112
179
|
services.repositories.page
|
113
180
|
end
|
114
181
|
|
182
|
+
def find_page(id, in_memory)
|
183
|
+
in_memory[id] ||= Locomotive::Page.find(id)
|
184
|
+
end
|
185
|
+
|
115
186
|
def logger
|
116
187
|
Rails.logger
|
117
188
|
end
|
@@ -2,6 +2,8 @@ module Locomotive
|
|
2
2
|
|
3
3
|
class PageService < Struct.new(:site, :account)
|
4
4
|
|
5
|
+
include Locomotive::Concerns::ActivityService
|
6
|
+
|
5
7
|
# Create a page from the attributes passed in parameter.
|
6
8
|
# It sets the created_by column with the current account.
|
7
9
|
#
|
@@ -12,7 +14,16 @@ module Locomotive
|
|
12
14
|
def create(attributes)
|
13
15
|
site.pages.build(attributes).tap do |page|
|
14
16
|
page.created_by = account if account
|
15
|
-
|
17
|
+
|
18
|
+
if page.save
|
19
|
+
track_activity 'page.created', parameters: { title: page.title, _id: page._id }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def sort(page, children)
|
25
|
+
page.sort_children!(children).tap do
|
26
|
+
track_activity 'page.sorted', parameters: { title: page.title, _id: page._id }
|
16
27
|
end
|
17
28
|
end
|
18
29
|
|
@@ -27,8 +38,55 @@ module Locomotive
|
|
27
38
|
def update(page, attributes)
|
28
39
|
page.tap do
|
29
40
|
page.attributes = attributes
|
30
|
-
page.updated_by = account
|
31
|
-
|
41
|
+
page.updated_by = account if account
|
42
|
+
|
43
|
+
if page.save
|
44
|
+
track_activity 'page.updated', parameters: { title: page.title, _id: page._id }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy(page)
|
50
|
+
page.destroy.tap do
|
51
|
+
track_activity 'page.destroyed', parameters: { title: page.title }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# For all the pages of a site, use the slug property from
|
56
|
+
# the default locale for all the new locales passed as the first argument.
|
57
|
+
# Do not erase existing values in the new locales.
|
58
|
+
# This method is called when an user has changed the locales of a site.
|
59
|
+
#
|
60
|
+
def localize(locales, previous_default_locale)
|
61
|
+
parent_fullpaths = {}
|
62
|
+
default_locale = previous_default_locale || site.default_locale
|
63
|
+
|
64
|
+
site.pages.without_sorting.order_by(:depth.asc).each_by(50) do |page|
|
65
|
+
_localize(page, locales, default_locale, parent_fullpaths)
|
66
|
+
|
67
|
+
page.skip_callbacks_on_update = true
|
68
|
+
page.save if page.changed?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def _localize(page, locales, default_locale, parent_fullpaths)
|
75
|
+
slug = page.slug_translations[default_locale]
|
76
|
+
|
77
|
+
locales.each do |locale|
|
78
|
+
next if locale == default_locale
|
79
|
+
|
80
|
+
::Mongoid::Fields::I18n.with_locale(locale) do
|
81
|
+
page.slug ||= slug
|
82
|
+
page.fullpath ||= page.depth > 1 ? parent_fullpaths[page.parent_id][locale] + '/' + slug : slug
|
83
|
+
|
84
|
+
if page.depth == 0 && (slug == 'index' || slug == '404')
|
85
|
+
page.title ||= ::I18n.t("attributes.defaults.pages.#{slug}.title", locale: locale)
|
86
|
+
end
|
87
|
+
|
88
|
+
(parent_fullpaths[page._id] ||= {})[locale] = page.fullpath
|
89
|
+
end
|
32
90
|
end
|
33
91
|
end
|
34
92
|
|
@@ -1,6 +1,17 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class SiteService < Struct.new(:account)
|
3
3
|
|
4
|
+
include Locomotive::Concerns::ActivityService
|
5
|
+
include Morphine
|
6
|
+
|
7
|
+
register :page_service do
|
8
|
+
Locomotive::PageService.new(nil, account)
|
9
|
+
end
|
10
|
+
|
11
|
+
register :content_entry_service do
|
12
|
+
Locomotive::ContentEntryService.new(nil, account)
|
13
|
+
end
|
14
|
+
|
4
15
|
def list
|
5
16
|
sorter = lambda do |site_a, site_b|
|
6
17
|
site_a.name.downcase <=> site_b.name.downcase
|
@@ -21,7 +32,11 @@ module Locomotive
|
|
21
32
|
Site.new(attributes).tap do |site|
|
22
33
|
site.memberships.build account: account, role: 'admin'
|
23
34
|
|
24
|
-
raise_if_not_valid ? site.save! : site.save
|
35
|
+
success = raise_if_not_valid ? site.save! : site.save
|
36
|
+
|
37
|
+
ActiveSupport::Notifications.instrument 'locomotive.site.created', account: account, site: site
|
38
|
+
|
39
|
+
track_activity 'site.created', site: site, parameters: { name: site.name } if success
|
25
40
|
end
|
26
41
|
end
|
27
42
|
|
@@ -29,8 +44,35 @@ module Locomotive
|
|
29
44
|
create(attributes, true)
|
30
45
|
end
|
31
46
|
|
47
|
+
def update(site, attributes)
|
48
|
+
site.attributes = attributes
|
49
|
+
|
50
|
+
new_locales = site.locales_changed? ? site.locales - site.locales_was : nil
|
51
|
+
previous_default_locale = site.default_locale_was
|
52
|
+
|
53
|
+
site.save.tap do |success|
|
54
|
+
if success
|
55
|
+
localize_pages_and_content_entries(site, new_locales, previous_default_locale)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
32
60
|
private
|
33
61
|
|
62
|
+
def localize_pages_and_content_entries(site, new_locales, previous_default_locale)
|
63
|
+
return unless new_locales.present?
|
64
|
+
|
65
|
+
# localize all the existing pages
|
66
|
+
page_service.site = site
|
67
|
+
page_service.localize(new_locales, previous_default_locale)
|
68
|
+
|
69
|
+
# localize all the content entries of localized content types
|
70
|
+
site.localized_content_types.each do |content_type|
|
71
|
+
content_entry_service.content_type = content_type
|
72
|
+
content_entry_service.localize(new_locales, previous_default_locale)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
34
76
|
def unique_handle
|
35
77
|
Bazaar.heroku do |value|
|
36
78
|
Site.where(handle: value).exists?
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Locomotive
|
2
|
+
|
3
|
+
class TranslationService < Struct.new(:site, :account)
|
4
|
+
|
5
|
+
def all(options = {})
|
6
|
+
query = site.translations.ordered
|
7
|
+
keywords = prepare_keywords_statement(options[:q])
|
8
|
+
completion = prepare_completion_statement(options[:filter_by])
|
9
|
+
|
10
|
+
# filtering
|
11
|
+
query = if completion then query.and(*keywords, *completion) else query.where(keywords) end
|
12
|
+
|
13
|
+
# pagination
|
14
|
+
query
|
15
|
+
.page(options[:page] || 1)
|
16
|
+
.per(options[:per_page] || Locomotive.config.ui[:per_page])
|
17
|
+
end
|
18
|
+
|
19
|
+
def update(translation, values)
|
20
|
+
translation.tap do
|
21
|
+
translation.values = values
|
22
|
+
translation.updated_by = account if account
|
23
|
+
translation.save
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def prepare_keywords_statement(keywords)
|
30
|
+
return {} if keywords.blank?
|
31
|
+
|
32
|
+
regexp = /.*#{keywords.split.map { |k| Regexp.escape(k) }.join('.*')}.*/i
|
33
|
+
|
34
|
+
[{ '$or' => [
|
35
|
+
{ key: regexp },
|
36
|
+
*site.locales.map { |l| { "values.#{l}" => regexp } }
|
37
|
+
] }]
|
38
|
+
end
|
39
|
+
|
40
|
+
def prepare_completion_statement(filter_by)
|
41
|
+
case filter_by
|
42
|
+
when 'done' then [{ completion: site.locales.size }]
|
43
|
+
when 'partially' then [{ :completion.lt => site.locales.size }, { :completion.gt => 0 }]
|
44
|
+
when 'none' then [{ completion: 0 }]
|
45
|
+
else {}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
File without changes
|
@@ -1,7 +1,8 @@
|
|
1
1
|
.instructions
|
2
|
-
|
3
|
-
|
2
|
+
i.fa.fa-cloud-upload
|
3
|
+
br
|
4
4
|
= t('.instructions').html_safe
|
5
|
+
|
|
5
6
|
= link_to t('.browse'), '#', class: 'upload'
|
6
7
|
|
7
8
|
= form_tag('', class: 'hide') do
|
@@ -10,4 +11,4 @@
|
|
10
11
|
= link_to 'Refresh', request.fullpath, remote: remote, class: 'refresh hide'
|
11
12
|
|
12
13
|
.progress.hide
|
13
|
-
.progress-bar
|
14
|
+
.progress-bar role='progressbar' aria-valuenow='0' aria-valuemin='0' aria-valuemax='100'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
- if @content_assets.empty?
|
2
|
-
|
2
|
+
br
|
3
3
|
|
4
4
|
.alert.alert-warning
|
5
|
-
|
5
|
+
== t('.no_items')
|
6
6
|
|
7
7
|
- else
|
8
8
|
- # Display the assets
|
@@ -10,27 +10,29 @@
|
|
10
10
|
- @content_assets.each do |asset|
|
11
11
|
.asset
|
12
12
|
.top
|
13
|
+
h2= asset_filename(asset)
|
14
|
+
.size= human_asset_size(asset)
|
15
|
+
|
16
|
+
.body
|
13
17
|
.small-thumbnail
|
14
18
|
- if asset_with_thumbnail?(asset)
|
15
19
|
= image_tag asset.alternative_vignette_url
|
16
20
|
- else
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
%h2= asset_filename(asset)
|
21
|
+
div class="not-a-image #{asset.content_type}"
|
22
|
+
span= asset_text(asset)
|
21
23
|
|
22
24
|
.actions
|
23
25
|
- if enable_select
|
24
26
|
= link_to t('.buttons.select'), asset.source.url, class: 'btn btn-primary btn-sm select', title: asset_filename(asset), data: { image: asset.image? }
|
25
|
-
|
27
|
+
|
|
26
28
|
|
27
29
|
- if asset.image?
|
28
30
|
= link_to t('.buttons.edit'), edit_content_asset_path(current_site, asset._id), class: 'btn btn-primary btn-sm edit'
|
29
31
|
|
30
|
-
|
32
|
+
|
|
31
33
|
|
32
34
|
= link_to content_asset_path(current_site, asset, params.slice(:types, :query, :page, :per_page)), class: 'remove', method: :delete, data: { confirm: t('locomotive.messages.confirm'), return_url: request.original_url }, title: t('locomotive.buttons.delete'), remote: remote do
|
33
|
-
|
35
|
+
i.fa.fa-trash-o
|
34
36
|
|
35
37
|
.text-center
|
36
38
|
= paginate @content_assets, theme: 'twitter-bootstrap-3', pagination_class: 'pagination-sm', remote: remote
|