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
@@ -17,18 +17,13 @@ module Locomotive
|
|
17
17
|
|
18
18
|
## associations ##
|
19
19
|
has_many :pages, class_name: 'Locomotive::Page', validate: false, autosave: false
|
20
|
-
has_many :snippets, class_name: 'Locomotive::Snippet', dependent: :destroy, validate: false,
|
21
|
-
|
22
|
-
has_many :
|
23
|
-
|
24
|
-
has_many :
|
25
|
-
|
26
|
-
has_many :
|
27
|
-
autosave: false
|
28
|
-
has_many :content_entries, class_name: 'Locomotive::ContentEntry', dependent: :destroy, validate: false,
|
29
|
-
autosave: false
|
30
|
-
has_many :translations, class_name: 'Locomotive::Translation', dependent: :destroy, validate: false,
|
31
|
-
autosave: false
|
20
|
+
has_many :snippets, class_name: 'Locomotive::Snippet', dependent: :destroy, validate: false, autosave: false
|
21
|
+
has_many :theme_assets, class_name: 'Locomotive::ThemeAsset', dependent: :destroy, validate: false, autosave: false
|
22
|
+
has_many :content_assets, class_name: 'Locomotive::ContentAsset', dependent: :destroy, validate: false, autosave: false
|
23
|
+
has_many :content_types, class_name: 'Locomotive::ContentType', dependent: :destroy, validate: false, autosave: false
|
24
|
+
has_many :content_entries, class_name: 'Locomotive::ContentEntry', dependent: :destroy, validate: false, autosave: false
|
25
|
+
has_many :translations, class_name: 'Locomotive::Translation', dependent: :destroy, validate: false, autosave: false
|
26
|
+
has_many :activities, class_name: 'Locomotive::Activity', dependent: :destroy, validate: false, autosave: false
|
32
27
|
embeds_many :memberships, class_name: 'Locomotive::Membership'
|
33
28
|
|
34
29
|
## validations ##
|
@@ -57,6 +52,10 @@ module Locomotive
|
|
57
52
|
Locomotive::Page.fetch_page_from_path self, path, logged_in
|
58
53
|
end
|
59
54
|
|
55
|
+
def localized_content_types
|
56
|
+
self.content_types.localized
|
57
|
+
end
|
58
|
+
|
60
59
|
def accounts
|
61
60
|
Account.criteria.in(_id: self.memberships.map(&:account_id))
|
62
61
|
end
|
@@ -88,7 +87,7 @@ module Locomotive
|
|
88
87
|
%w{index 404}.each do |slug|
|
89
88
|
page = nil
|
90
89
|
|
91
|
-
self.each_locale do |locale|
|
90
|
+
self.each_locale do |locale, _|
|
92
91
|
page ||= self.pages.build(published: true) # first locale = default one
|
93
92
|
|
94
93
|
page.attributes = {
|
@@ -1,41 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
module Locomotive
|
2
|
+
class Translation
|
3
|
+
|
4
|
+
include Locomotive::Mongoid::Document
|
5
|
+
include Concerns::Shared::Userstamp
|
6
|
+
|
7
|
+
## fields ##
|
8
|
+
field :key
|
9
|
+
field :values, type: Hash, default: {}
|
10
|
+
field :completion, type: Integer, default: 0
|
11
|
+
|
12
|
+
## associations ##
|
13
|
+
belongs_to :site, class_name: 'Locomotive::Site', validate: false, autosave: false
|
14
|
+
|
15
|
+
## validations ##
|
16
|
+
validates_uniqueness_of :key, scope: :site_id
|
17
|
+
validates_presence_of :site, :key
|
18
|
+
|
19
|
+
## named scopes ##
|
20
|
+
scope :ordered, -> { order_by(key: :asc) }
|
21
|
+
scope :by_id_or_key, ->(id_or_key) { all.or({ _id: id_or_key }, { key: id_or_key }) }
|
22
|
+
|
23
|
+
## callbacks ##
|
24
|
+
before_validation :underscore_key
|
25
|
+
before_validation :set_completion
|
26
|
+
before_validation :remove_blanks
|
27
|
+
|
28
|
+
## indexes ##
|
29
|
+
index site_id: 1
|
30
|
+
index site_id: 1, key: 1
|
31
|
+
index site_id: 1, completion: 1
|
32
|
+
index site_id: 1, key: 1, completion: 1
|
33
|
+
|
34
|
+
## methods ##
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
# Make sure the translation key is underscored
|
39
|
+
# since it is the unique way to use it in a liquid template.
|
40
|
+
#
|
41
|
+
def underscore_key
|
42
|
+
if self.key
|
43
|
+
self.key = self.key.permalink(true)
|
44
|
+
end
|
45
|
+
end
|
25
46
|
|
26
|
-
|
47
|
+
def set_completion
|
48
|
+
self.completion = values.count { |_, v| v.present? }
|
49
|
+
end
|
27
50
|
|
28
|
-
|
29
|
-
|
30
|
-
#
|
31
|
-
def underscore_key
|
32
|
-
if self.key
|
33
|
-
self.key = self.key.permalink(true)
|
51
|
+
def remove_blanks
|
52
|
+
self.values.delete_if { |_, v| v.is_a?(String) && v.empty? }
|
34
53
|
end
|
35
|
-
end
|
36
54
|
|
37
|
-
def remove_blanks
|
38
|
-
self.values.delete_if { |k,v| v.blank? }
|
39
55
|
end
|
40
|
-
|
41
56
|
end
|
@@ -41,6 +41,10 @@ module Locomotive
|
|
41
41
|
super_admin? || site_admin?
|
42
42
|
end
|
43
43
|
|
44
|
+
def show_developers_documentation?
|
45
|
+
super_admin? || site_admin?
|
46
|
+
end
|
47
|
+
|
44
48
|
def permitted_attributes
|
45
49
|
plain = [:name, :handle, :picture, :remove_picture, :seo_title, :meta_keywords, :meta_description, :timezone_name, :robots_txt]
|
46
50
|
hash = { domains: [], locales: [] }
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Concerns
|
3
|
+
module ActivityService
|
4
|
+
|
5
|
+
def track_activity(key, options = {})
|
6
|
+
return if @activity_disabled
|
7
|
+
|
8
|
+
site = respond_to?(:site) ? self.site : options.delete(:site)
|
9
|
+
|
10
|
+
if options[:actor].blank? && respond_to?(:account)
|
11
|
+
options[:actor] = self.account
|
12
|
+
end
|
13
|
+
|
14
|
+
site.activities.create! options.merge(key: key)
|
15
|
+
end
|
16
|
+
|
17
|
+
def without_tracking_activity(&block)
|
18
|
+
@activity_disabled = true
|
19
|
+
yield.tap do
|
20
|
+
@activity_disabled = false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Locomotive
|
2
|
-
class ContentAssetService < Struct.new(:site)
|
2
|
+
class ContentAssetService < Struct.new(:site, :account)
|
3
|
+
|
4
|
+
include Locomotive::Concerns::ActivityService
|
3
5
|
|
4
6
|
def list(options = {})
|
5
7
|
options[:per_page] ||= Locomotive.config.ui[:per_page]
|
@@ -13,9 +15,21 @@ module Locomotive
|
|
13
15
|
|
14
16
|
def bulk_create(list)
|
15
17
|
list = list.values if list.is_a?(Hash)
|
16
|
-
|
18
|
+
|
19
|
+
assets = list.map do |params|
|
17
20
|
site.content_assets.create(params)
|
18
21
|
end
|
22
|
+
|
23
|
+
valid_assets = assets.map { |a| a.errors.empty? ? { name: a.source_filename, url: a.source.url, image: a.image? } : nil }.compact
|
24
|
+
track_activity 'content_asset.created_bulk', parameters: { assets: valid_assets } unless valid_assets.empty?
|
25
|
+
|
26
|
+
assets
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy(asset)
|
30
|
+
asset.destroy.tap do
|
31
|
+
track_activity 'content_asset.destroyed', parameters: { name: asset.source_filename }
|
32
|
+
end
|
19
33
|
end
|
20
34
|
|
21
35
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class ContentEntryService < Struct.new(:content_type, :account)
|
3
3
|
|
4
|
+
include Locomotive::Concerns::ActivityService
|
5
|
+
|
4
6
|
# List all the entries of a content type.
|
5
7
|
#
|
6
8
|
# If the content type allows the pagination, in other words, if the entries are not
|
@@ -28,6 +30,8 @@ module Locomotive
|
|
28
30
|
def sort(ids)
|
29
31
|
klass = self.content_type.klass_with_custom_fields(:entries)
|
30
32
|
klass.sort_entries!(ids, self.content_type.sortable_column)
|
33
|
+
|
34
|
+
track_activity 'content_entry.sorted', parameters: activity_parameters
|
31
35
|
end
|
32
36
|
|
33
37
|
# Create a content entry from the attributes passed in parameter.
|
@@ -42,24 +46,33 @@ module Locomotive
|
|
42
46
|
|
43
47
|
content_type.entries.build(attributes).tap do |entry|
|
44
48
|
entry.created_by = account if account
|
45
|
-
|
49
|
+
|
50
|
+
if entry.save
|
51
|
+
track_activity 'content_entry.created', parameters: activity_parameters(entry)
|
52
|
+
end
|
46
53
|
end
|
47
54
|
end
|
48
55
|
|
49
56
|
# Create a content entry from the attributes passed in parameter.
|
50
57
|
# It does not set the created_by column since it's called
|
51
58
|
# from the public side of the site with no logged in account.
|
52
|
-
# The attributes are filtered through the
|
59
|
+
# The attributes are filtered through the Grape::Entity / Form.
|
60
|
+
# A notification email is sent to the selected members of the site.
|
53
61
|
#
|
54
62
|
# @param [ Hash ] attributes The attributes of new content entry.
|
55
63
|
#
|
56
64
|
# @return [ Object ] An instance of the content entry.
|
57
65
|
#
|
58
66
|
def public_create(attributes)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
entry.
|
67
|
+
form = Locomotive::API::Forms::ContentEntryForm.new(self.content_type, attributes)
|
68
|
+
|
69
|
+
without_tracking_activity { create(form.serializable_hash) }.tap do |entry|
|
70
|
+
if entry.errors.empty?
|
71
|
+
# send an email to selected local accounts
|
72
|
+
send_notifications(entry)
|
73
|
+
|
74
|
+
track_activity 'content_entry.created_public', parameters: activity_parameters(entry)
|
75
|
+
end
|
63
76
|
end
|
64
77
|
end
|
65
78
|
|
@@ -77,7 +90,38 @@ module Locomotive
|
|
77
90
|
entry.tap do |entry|
|
78
91
|
entry.attributes = attributes
|
79
92
|
entry.updated_by = account
|
80
|
-
|
93
|
+
|
94
|
+
if entry.save
|
95
|
+
track_activity 'content_entry.updated', parameters: activity_parameters(entry)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def destroy(entry)
|
101
|
+
entry.destroy.tap do
|
102
|
+
track_activity 'content_entry.destroyed', parameters: activity_parameters(entry)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Make sure the content entries has a non-blank slug in the new locales.
|
107
|
+
# We take the slug in the default locale or the previous default locale (if provided)
|
108
|
+
# in the other locales.
|
109
|
+
#
|
110
|
+
def localize(new_locales, previous_default_locale)
|
111
|
+
default_locale = previous_default_locale || content_type.site.default_locale
|
112
|
+
|
113
|
+
content_type.entries.each_by(50) do |entry|
|
114
|
+
slug = entry._slug_translations[default_locale]
|
115
|
+
|
116
|
+
new_locales.each do |locale|
|
117
|
+
next if locale == default_locale
|
118
|
+
|
119
|
+
::Mongoid::Fields::I18n.with_locale(locale) do
|
120
|
+
entry._slug ||= slug
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
entry.save if entry.changed?
|
81
125
|
end
|
82
126
|
end
|
83
127
|
|
@@ -88,6 +132,18 @@ module Locomotive
|
|
88
132
|
content_type.entries.destroy_all
|
89
133
|
end
|
90
134
|
|
135
|
+
def send_notifications(entry)
|
136
|
+
return unless self.content_type.public_submission_enabled?
|
137
|
+
|
138
|
+
account_ids = (self.content_type.public_submission_accounts || []).map(&:to_s)
|
139
|
+
|
140
|
+
self.content_type.site.accounts.each do |account|
|
141
|
+
next unless account_ids.include?(account._id.to_s)
|
142
|
+
|
143
|
+
Locomotive::Notifications.new_content_entry(account, entry).deliver
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
91
147
|
# Give the list of permitted attributes for a content entry.
|
92
148
|
# It includes:
|
93
149
|
# - the default ones (_slug, seo, ...etc)
|
@@ -117,6 +173,10 @@ module Locomotive
|
|
117
173
|
(default + dynamic + [referenced.empty? ? nil : referenced]).compact
|
118
174
|
end
|
119
175
|
|
176
|
+
def site
|
177
|
+
self.content_type.site
|
178
|
+
end
|
179
|
+
|
120
180
|
protected
|
121
181
|
|
122
182
|
def sanitize_attributes!(attributes)
|
@@ -157,7 +217,7 @@ module Locomotive
|
|
157
217
|
end
|
158
218
|
|
159
219
|
def prepare_query_statement(query)
|
160
|
-
regexp
|
220
|
+
regexp = /.*#{query.split.map { |q| Regexp.escape(q) }.join('.*')}.*/i
|
161
221
|
|
162
222
|
{}.tap do |where|
|
163
223
|
if self.content_type.filter_fields.blank?
|
@@ -172,5 +232,14 @@ module Locomotive
|
|
172
232
|
end
|
173
233
|
end
|
174
234
|
|
235
|
+
def activity_parameters(entry = nil)
|
236
|
+
{
|
237
|
+
_id: entry.try(:_id),
|
238
|
+
label: entry.try(:_label),
|
239
|
+
content_type: content_type.name,
|
240
|
+
content_type_slug: content_type.slug
|
241
|
+
}
|
242
|
+
end
|
243
|
+
|
175
244
|
end
|
176
245
|
end
|
@@ -3,13 +3,17 @@ module Locomotive
|
|
3
3
|
|
4
4
|
def list
|
5
5
|
site.content_types
|
6
|
-
.only(:_id, :name, :slug, :number_of_entries)
|
7
|
-
.order_by(:name.asc).to_a
|
6
|
+
.only(:_id, :name, :slug, :number_of_entries, :display_settings)
|
7
|
+
.order_by(:'display_settings.position'.asc, :name.asc).to_a
|
8
8
|
end
|
9
9
|
|
10
10
|
def find_by_slug(slug)
|
11
11
|
site.content_types.by_id_or_slug(slug)
|
12
12
|
end
|
13
13
|
|
14
|
+
def update(content_type, attributes = {})
|
15
|
+
content_type.update_attributes(attributes)
|
16
|
+
end
|
17
|
+
|
14
18
|
end
|
15
19
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module Locomotive
|
2
|
-
|
3
2
|
class EditableElementService < Struct.new(:site, :account)
|
4
3
|
|
4
|
+
include Locomotive::Concerns::ActivityService
|
5
|
+
|
5
6
|
def update_all(list_of_attributes)
|
6
7
|
[].tap do |elements|
|
7
|
-
pages = {}
|
8
|
+
pages, modified_pages = {}, {}
|
8
9
|
|
9
10
|
list_of_attributes.each do |attributes|
|
10
11
|
page_id = attributes[:page_id]
|
@@ -12,14 +13,21 @@ module Locomotive
|
|
12
13
|
if page = (pages[page_id] || Locomotive::Page.find(page_id))
|
13
14
|
pages[page_id] = page
|
14
15
|
|
15
|
-
if element = page.editable_elements.find(attributes[:
|
16
|
+
if element = page.editable_elements.find(attributes[:_id])
|
16
17
|
element.attributes = clean_attributes_for(element, attributes)
|
18
|
+
|
19
|
+
modified_pages[page_id] = page if element.changed?
|
20
|
+
|
17
21
|
elements << [page, element]
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
26
|
save_all_pages(pages.values)
|
27
|
+
|
28
|
+
track_activity 'editable_element.updated_bulk', parameters: {
|
29
|
+
pages: modified_pages.values.map { |p| { title: p.title, _id: p._id } }
|
30
|
+
} unless modified_pages.empty?
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
@@ -43,5 +51,4 @@ module Locomotive
|
|
43
51
|
end
|
44
52
|
|
45
53
|
end
|
46
|
-
|
47
54
|
end
|
@@ -1,18 +1,30 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class MembershipService < Struct.new(:site, :policy)
|
3
3
|
|
4
|
+
include Locomotive::Concerns::ActivityService
|
5
|
+
|
4
6
|
# Create a new membership for the site assigned to that service.
|
5
7
|
# In case, no account is found from the email passed in parameter,
|
6
8
|
# this method will return nil.
|
7
9
|
# By default, the author role will be set to the new membership.
|
8
10
|
#
|
9
|
-
# @param [
|
11
|
+
# @param [ Object ] email_or_account The email or the account ifself
|
10
12
|
#
|
11
13
|
# @return [ Object ] A new membership (with errors or not) or nil (no account found)
|
12
14
|
#
|
13
|
-
def create(
|
14
|
-
|
15
|
-
|
15
|
+
def create(email_or_account)
|
16
|
+
_account = if email_or_account.respond_to?(:email)
|
17
|
+
email_or_account
|
18
|
+
else
|
19
|
+
Locomotive::Account.find_by_email(email_or_account)
|
20
|
+
end
|
21
|
+
|
22
|
+
if _account
|
23
|
+
site.memberships.create(account: _account, email: _account.email).tap do |success|
|
24
|
+
if success
|
25
|
+
track_activity 'membership.created', parameters: { name: _account.name, email: _account.email }
|
26
|
+
end
|
27
|
+
end
|
16
28
|
else
|
17
29
|
nil
|
18
30
|
end
|
@@ -41,5 +53,9 @@ module Locomotive
|
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
56
|
+
def account
|
57
|
+
policy.account
|
58
|
+
end
|
59
|
+
|
44
60
|
end
|
45
61
|
end
|