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
@@ -1,3 +1,5 @@
|
|
1
|
+
# require 'pry-byebug'
|
2
|
+
|
1
3
|
module Locomotive
|
2
4
|
module SimpleForm
|
3
5
|
module BootstrapHelpers
|
@@ -30,14 +32,47 @@ module Locomotive
|
|
30
32
|
end
|
31
33
|
|
32
34
|
end
|
35
|
+
|
36
|
+
module Inputs
|
37
|
+
|
38
|
+
module FasterTranslate
|
39
|
+
|
40
|
+
def translate_from_namespace(namespace, default = '')
|
41
|
+
if (model_names = lookup_model_names)[0] == 'locomotive'
|
42
|
+
model_name = model_names.join('.')
|
43
|
+
|
44
|
+
_key = [
|
45
|
+
I18n.locale,
|
46
|
+
template.instance_variable_get(:"@virtual_path"),
|
47
|
+
namespace,
|
48
|
+
model_name,
|
49
|
+
reflection_or_attribute_name].join('/')
|
50
|
+
|
51
|
+
Rails.cache.fetch(_key) do
|
52
|
+
lookups = [:"#{model_name}.#{lookup_action}.#{reflection_or_attribute_name}"]
|
53
|
+
lookups << :"#{model_name}.#{reflection_or_attribute_name}"
|
54
|
+
lookups << default
|
55
|
+
|
56
|
+
t(lookups.shift, scope: :"#{i18n_scope}.#{namespace}", default: lookups).presence
|
57
|
+
end
|
58
|
+
else
|
59
|
+
super
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
::SimpleForm::FormBuilder.mappings.values.uniq.each do |klass|
|
66
|
+
klass.send(:include, FasterTranslate)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
33
70
|
end
|
34
71
|
|
35
72
|
class FormBuilder < ::SimpleForm::FormBuilder
|
36
73
|
|
37
74
|
def inputs(name = nil, options = {}, &block)
|
38
|
-
|
39
|
-
|
40
|
-
html = template.content_tag(:legend, template.content_tag(:span, label))
|
75
|
+
html = template.content_tag(:legend, template.content_tag(:span, name))
|
41
76
|
html += template.capture(&block)
|
42
77
|
|
43
78
|
options[:class] ||= 'inputs'
|
@@ -59,13 +94,13 @@ module Locomotive
|
|
59
94
|
|
60
95
|
template.content_tag(:div, action +
|
61
96
|
' '.html_safe +
|
62
|
-
|
97
|
+
translate_button(:or) +
|
63
98
|
' '.html_safe +
|
64
99
|
back_button, class: 'text-right form-actions')
|
65
100
|
end
|
66
101
|
|
67
102
|
def back_button_action(options = {})
|
68
|
-
label =
|
103
|
+
label = translate_button(:cancel)
|
69
104
|
url = options[:back_url]
|
70
105
|
|
71
106
|
if options[:use_stored_location]
|
@@ -77,8 +112,8 @@ module Locomotive
|
|
77
112
|
|
78
113
|
def action(misc_class = '')
|
79
114
|
action = object.persisted? ? :update : :create
|
80
|
-
label =
|
81
|
-
loading_text =
|
115
|
+
label = translate_button(action)
|
116
|
+
loading_text = translate_button(:loading_text)
|
82
117
|
|
83
118
|
template.content_tag :button, label,
|
84
119
|
type: 'submit',
|
@@ -87,27 +122,33 @@ module Locomotive
|
|
87
122
|
end
|
88
123
|
|
89
124
|
def submit_text(action = :submit)
|
90
|
-
|
125
|
+
translate_button(action)
|
91
126
|
end
|
92
127
|
|
93
|
-
# Translate text for the submits and titles namespace.
|
94
|
-
# it differs from the simple_form translate_from_namespace method
|
95
|
-
# in that this does not care about the attribute.
|
96
|
-
#
|
97
|
-
def translate_text(key, namespace, default = '')
|
98
|
-
|
99
|
-
|
128
|
+
# # Translate text for the submits and titles namespace.
|
129
|
+
# # it differs from the simple_form translate_from_namespace method
|
130
|
+
# # in that this does not care about the attribute.
|
131
|
+
# #
|
132
|
+
# def translate_text(key, namespace, default = '')
|
133
|
+
# model_names = lookup_model_names.dup
|
134
|
+
# lookups = []
|
100
135
|
|
101
|
-
|
102
|
-
|
103
|
-
|
136
|
+
# while !model_names.empty?
|
137
|
+
# joined_model_names = model_names.join(".")
|
138
|
+
# model_names.shift
|
104
139
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
140
|
+
# lookups << :"#{joined_model_names}.#{key}"
|
141
|
+
# end
|
142
|
+
# lookups << :"defaults.locomotive.#{key}"
|
143
|
+
# lookups << default.to_s
|
144
|
+
|
145
|
+
# puts "#{i18n_scope}.#{namespace}.#{lookups.first} - #{lookups.inspect}"
|
109
146
|
|
110
|
-
|
147
|
+
# I18n.t(lookups.shift, scope: :"#{i18n_scope}.#{namespace}", default: lookups).presence
|
148
|
+
# end
|
149
|
+
|
150
|
+
def translate_button(key)
|
151
|
+
template.t("simple_form.buttons.defaults.locomotive.#{key}")
|
111
152
|
end
|
112
153
|
|
113
154
|
# Extract the model names from the object_name mess, ignoring numeric and
|
@@ -130,9 +171,9 @@ module Locomotive
|
|
130
171
|
end
|
131
172
|
end
|
132
173
|
|
133
|
-
def i18n_scope
|
134
|
-
|
135
|
-
end
|
174
|
+
# def i18n_scope
|
175
|
+
# ::SimpleForm.i18n_scope
|
176
|
+
# end
|
136
177
|
|
137
178
|
end
|
138
179
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Steam
|
3
|
+
module Middlewares
|
4
|
+
|
5
|
+
class MissingTranslations
|
6
|
+
|
7
|
+
def initialize(app, opts = {})
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
find_and_persist_missing_translations(env['steam.site']) do
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_and_persist_missing_translations(site)
|
18
|
+
translations = []
|
19
|
+
|
20
|
+
subscription = ActiveSupport::Notifications.subscribe('steam.missing_translation') do |name, start, finish, id, payload|
|
21
|
+
translations << { key: payload[:input], values: { payload[:input] => false } }
|
22
|
+
end
|
23
|
+
|
24
|
+
yield.tap do
|
25
|
+
ActiveSupport::Notifications.unsubscribe(subscription)
|
26
|
+
persist_missing_translations(site, translations) unless translations.empty?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def persist_missing_translations(site, translations)
|
31
|
+
new_translations = []
|
32
|
+
|
33
|
+
translations.each do |attributes|
|
34
|
+
if existing = site.translations.where(key: attributes[:key]).first
|
35
|
+
existing.update_attribute :values, existing.values.merge(attributes[:values])
|
36
|
+
else
|
37
|
+
new_translations << attributes
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
site.translations.create(new_translations) unless new_translations.empty?
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Steam
|
3
|
+
module Middlewares
|
4
|
+
|
5
|
+
class PageEditing
|
6
|
+
|
7
|
+
include Locomotive::Engine.routes.url_helpers
|
8
|
+
|
9
|
+
def initialize(app, opts = {})
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
status, headers, response = @app.call(env)
|
15
|
+
site, page, locale = env['steam.site'], env['steam.page'], env['steam.locale'].to_s
|
16
|
+
|
17
|
+
if page && !page.redirect && page.response_type == 'text/html' && response.first
|
18
|
+
html = %(
|
19
|
+
<meta name="locomotive-locale" content="#{locale}" />
|
20
|
+
<meta name="locomotive-editable-elements-path" content="#{editable_elements_path(site, page, locale, env)}" />
|
21
|
+
<meta name="locomotive-page-id" content="#{page._id}" />
|
22
|
+
)
|
23
|
+
response.first.gsub!('</head>', %(#{html}</head>))
|
24
|
+
end
|
25
|
+
|
26
|
+
[status, headers, response]
|
27
|
+
end
|
28
|
+
|
29
|
+
def editable_elements_path(site, page, locale, env)
|
30
|
+
options = {}
|
31
|
+
|
32
|
+
if content_entry_id = env['steam.content_entry'].try(:_id)
|
33
|
+
options = {
|
34
|
+
content_entry_id: content_entry_id,
|
35
|
+
preview_path: env['steam.path'],
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
options[:content_locale] = locale if site.locales.size > 1
|
40
|
+
|
41
|
+
super(site, page._id, options)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Steam
|
3
|
+
|
4
|
+
class APIEntrySubmissionService < Struct.new(:site, :locale)
|
5
|
+
|
6
|
+
def submit(slug, attributes = {})
|
7
|
+
load_content_type(slug)
|
8
|
+
create_entry(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_json(entry)
|
12
|
+
make_entity(entry).to_json
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def load_content_type(slug)
|
18
|
+
@content_type = site.content_types.where(slug: slug).first
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_entry(attributes)
|
22
|
+
::Mongoid::Fields::I18n.with_locale(locale) do
|
23
|
+
service.public_create(attributes)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def make_entity(entry)
|
28
|
+
Locomotive::API::Entities::ContentEntryEntity.represent(entry)
|
29
|
+
end
|
30
|
+
|
31
|
+
def service
|
32
|
+
Locomotive::ContentEntryService.new(@content_type, nil)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -2,11 +2,21 @@ require 'locomotive/steam'
|
|
2
2
|
require 'locomotive/steam/server'
|
3
3
|
|
4
4
|
Locomotive::Steam.configure do |config|
|
5
|
-
|
5
|
+
|
6
|
+
# asset_host or asset_path? Depends on the Carrierwave configuration
|
7
|
+
storage = CarrierWave::Uploader::Base.storage.to_s
|
8
|
+
|
9
|
+
if asset_host = CarrierWave::Uploader::Base.asset_host
|
10
|
+
config.asset_host = asset_host
|
11
|
+
config.serve_assets = false
|
12
|
+
elsif CarrierWave::Uploader::Base.storage_engines.invert[storage] == :file
|
13
|
+
config.asset_path = Rails.application.root.join('public')
|
14
|
+
end
|
6
15
|
|
7
16
|
# rely on Mongoid for the connection information
|
8
17
|
if mongoid = Mongoid.configure.sessions[:default]
|
9
|
-
|
18
|
+
options = mongoid[:uri] ? mongoid.slice(:uri) : mongoid.slice(:database, :hosts, :username, :password)
|
19
|
+
config.adapter = { name: :'mongoDB' }.merge(options.symbolize_keys)
|
10
20
|
end
|
11
21
|
|
12
22
|
# if Steam is used inside the engine, we can rely on the Rails
|
@@ -14,11 +24,20 @@ Locomotive::Steam.configure do |config|
|
|
14
24
|
config.middleware.delete Rack::Lint
|
15
25
|
config.middleware.delete Rack::Session::Moneta
|
16
26
|
|
17
|
-
|
27
|
+
require_relative 'steam/middlewares/missing_translations'
|
28
|
+
require_relative 'steam/middlewares/page_editing'
|
29
|
+
|
30
|
+
config.middleware.insert_after Locomotive::Steam::Middlewares::Page, Locomotive::Steam::Middlewares::PageEditing
|
31
|
+
config.middleware.insert_after Locomotive::Steam::Middlewares::Page, Locomotive::Steam::Middlewares::MissingTranslations
|
32
|
+
|
33
|
+
require_relative 'steam/services/api_entry_submission_service'
|
34
|
+
|
35
|
+
# let the Rails engine handle the "no site" error
|
36
|
+
config.render_404_if_no_site = false
|
18
37
|
|
19
|
-
|
20
|
-
|
21
|
-
|
38
|
+
config.services_hook = -> (services) {
|
39
|
+
services.entry_submission = Locomotive::Steam::APIEntrySubmissionService.new(services.current_site, services.locale) if services.request
|
40
|
+
}
|
22
41
|
end
|
23
42
|
|
24
43
|
Locomotive::Common.reset
|
data/lib/locomotive/version.rb
CHANGED
data/lib/tasks/locomotive.rake
CHANGED
@@ -9,34 +9,6 @@ namespace :locomotive do
|
|
9
9
|
# puts '...done'
|
10
10
|
# end
|
11
11
|
|
12
|
-
desc 'Rebuild the serialized template of all the site pages'
|
13
|
-
task rebuild_serialized_page_templates: :environment do
|
14
|
-
Locomotive::Site.all.each do |site|
|
15
|
-
default_locale = site.default_locale
|
16
|
-
|
17
|
-
([default_locale] + (site.locales - [default_locale])).each do |locale|
|
18
|
-
Mongoid::Fields::I18n.with_locale(locale) do
|
19
|
-
pages = site.pages.to_a
|
20
|
-
while !pages.empty? do
|
21
|
-
page = pages.pop
|
22
|
-
begin
|
23
|
-
page.send :_parse_and_serialize_template
|
24
|
-
page.instance_variable_set :@template_changed, true
|
25
|
-
page.save
|
26
|
-
puts "[#{site.name}][#{locale}] processing...#{page.title} [saved]"
|
27
|
-
rescue TypeError
|
28
|
-
pages.insert(0, page)
|
29
|
-
rescue ::Liquid::Error => e
|
30
|
-
puts "\tLiquid error: #{e.message} (#{page._id})"
|
31
|
-
rescue Exception => e
|
32
|
-
puts "\tUnknown error: #{e.message} (#{page._id})"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
12
|
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
|
41
13
|
task add_admin: :environment do
|
42
14
|
name = ask('Display name: ') { |q| q.echo = true }
|
@@ -55,36 +27,44 @@ namespace :locomotive do
|
|
55
27
|
|
56
28
|
namespace :upgrade do
|
57
29
|
|
58
|
-
desc '
|
59
|
-
task
|
60
|
-
|
61
|
-
page.editable_elements.each_with_index do |el, index|
|
62
|
-
next if el._type != 'Locomotive::EditableFile' || el.attributes['source'].is_a?(Hash)
|
30
|
+
desc 'Upgrade to Locomotive v3 from v2.5.x'
|
31
|
+
task v3: :environment do
|
32
|
+
puts '...'
|
63
33
|
|
64
|
-
|
34
|
+
# content asset checksums
|
35
|
+
Locomotive::ContentAsset.all.each do |asset|
|
36
|
+
asset.send(:calculate_checksum)
|
37
|
+
asset.save
|
38
|
+
end
|
39
|
+
puts '[x] generate checksums for existing content assets'
|
65
40
|
|
66
|
-
|
67
|
-
|
41
|
+
# translation completion
|
42
|
+
Locomotive::Translation.all.each do |translation|
|
43
|
+
translation.send(:set_completion)
|
44
|
+
translation.save
|
68
45
|
end
|
46
|
+
puts '[x] set completion for translations'
|
47
|
+
|
48
|
+
puts "\nDone!"
|
69
49
|
end
|
70
50
|
|
71
51
|
end # namespace: upgrade
|
72
52
|
|
73
|
-
desc 'Generate the documentation about the REST API'
|
74
|
-
task generate_api_doc: :environment do
|
75
|
-
|
76
|
-
require 'locomotive/misc/api_documentation'
|
77
53
|
|
78
|
-
|
54
|
+
namespace :maintenance do
|
79
55
|
|
80
|
-
|
56
|
+
desc 'Delete items older than N_DAYS days (30 by default) from the activity feed'
|
57
|
+
task clean_activity_feed: :environment do
|
58
|
+
days = (ENV['N_DAYS'] ? ENV['N_DAYS'].to_i : 30).days.ago
|
59
|
+
criteria = Locomotive::Activity.where(:created_at.lt => days)
|
81
60
|
|
82
|
-
|
83
|
-
|
61
|
+
if (size = criteria.count) > 0
|
62
|
+
criteria.destroy_all
|
63
|
+
puts "#{size} items from the activity feed have been deleted"
|
64
|
+
else
|
65
|
+
puts "No items from the activity feed have been deleted"
|
66
|
+
end
|
84
67
|
end
|
85
|
-
end
|
86
|
-
|
87
|
-
namespace :maintenance do
|
88
68
|
|
89
69
|
desc 'Unset the translation of the editable elements for a LOCALE'
|
90
70
|
task unset_editable_elements_translation: :environment do
|
@@ -0,0 +1 @@
|
|
1
|
+
p Hello world!
|
data/spec/dummy/app/views/locomotive/shared/{_main_app_head.html.haml → _main_app_head.html.slim}
RENAMED
File without changes
|