tribeca_cms 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +58 -0
- data/LICENSE +1 -0
- data/README.textile +0 -0
- data/app/assets/images/locomotive/background/body.png +0 -0
- data/app/assets/images/locomotive/datepicker/ui-widget-content-top.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/flags/de.png +0 -0
- data/app/assets/images/locomotive/icons/flags/en.png +0 -0
- data/app/assets/images/locomotive/icons/flags/es.png +0 -0
- data/app/assets/images/locomotive/icons/flags/et.png +0 -0
- data/app/assets/images/locomotive/icons/flags/fr.png +0 -0
- data/app/assets/images/locomotive/icons/flags/it.png +0 -0
- data/app/assets/images/locomotive/icons/flags/nb.png +0 -0
- data/app/assets/images/locomotive/icons/flags/nl.png +0 -0
- data/app/assets/images/locomotive/icons/flags/pl.png +0 -0
- data/app/assets/images/locomotive/icons/flags/pt-BR.png +0 -0
- data/app/assets/images/locomotive/icons/flags/ru.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/aloha/plugins/custom/locomotive_media/css/image.css +3 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/img/image.gif +0 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js +96 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/fr/i18n.js +1 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/nls/i18n.js +4 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/package.json +1 -0
- data/app/assets/javascripts/locomotive.js +25 -0
- data/app/assets/javascripts/locomotive/aloha.js.coffee +2 -0
- data/app/assets/javascripts/locomotive/application.js.coffee +12 -0
- data/app/assets/javascripts/locomotive/inline_editor.js.coffee +22 -0
- data/app/assets/javascripts/locomotive/models/account.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/models/content_asset.js.coffee +20 -0
- data/app/assets/javascripts/locomotive/models/content_entry.js.coffee +61 -0
- data/app/assets/javascripts/locomotive/models/content_type.js.coffee +26 -0
- data/app/assets/javascripts/locomotive/models/custom_field.js.coffee +38 -0
- data/app/assets/javascripts/locomotive/models/custom_field_select_option.js.coffee +16 -0
- data/app/assets/javascripts/locomotive/models/domain.js.coffee +3 -0
- data/app/assets/javascripts/locomotive/models/editable_element.js.coffee +27 -0
- data/app/assets/javascripts/locomotive/models/membership.js.coffee +13 -0
- data/app/assets/javascripts/locomotive/models/page.js.coffee +27 -0
- data/app/assets/javascripts/locomotive/models/site.js.coffee +34 -0
- data/app/assets/javascripts/locomotive/models/snippet.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/models/theme_asset.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/models/translation.js.coffee +5 -0
- data/app/assets/javascripts/locomotive/not_logged_in.js.coffee +1 -0
- data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +37 -0
- data/app/assets/javascripts/locomotive/utils/core_ext.js +75 -0
- data/app/assets/javascripts/locomotive/utils/growl.js +14 -0
- data/app/assets/javascripts/locomotive/utils/handlebar_helpers.js.coffee +9 -0
- data/app/assets/javascripts/locomotive/utils/tinymce_settings.js.coffee +48 -0
- data/app/assets/javascripts/locomotive/views/application_view.js.coffee +92 -0
- data/app/assets/javascripts/locomotive/views/content_assets/picker_item_view.js.coffee +30 -0
- data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +58 -0
- data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +144 -0
- data/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee +90 -0
- data/app/assets/javascripts/locomotive/views/content_entries/edit_view.js.coffee +9 -0
- data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +36 -0
- data/app/assets/javascripts/locomotive/views/content_entries/new_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/content_types/_form_view.js.coffee +86 -0
- data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee +104 -0
- data/app/assets/javascripts/locomotive/views/content_types/custom_fields_view.coffee +94 -0
- data/app/assets/javascripts/locomotive/views/content_types/edit_view.coffee +14 -0
- data/app/assets/javascripts/locomotive/views/content_types/new_view.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee +89 -0
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +86 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/control_view.js.coffee +24 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee +83 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/file_view.js.coffee +74 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee +36 -0
- data/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee +22 -0
- data/app/assets/javascripts/locomotive/views/inline_editor/application_view.js.coffee +124 -0
- data/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee +145 -0
- data/app/assets/javascripts/locomotive/views/my_account/edit_view.js.coffee +24 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +162 -0
- data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +31 -0
- data/app/assets/javascripts/locomotive/views/pages/index_view.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +40 -0
- data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/shared/asset_picker_view.js.coffee +92 -0
- data/app/assets/javascripts/locomotive/views/shared/fields/file_view.js.coffee +88 -0
- data/app/assets/javascripts/locomotive/views/shared/fields/has_many_view.js.coffee +125 -0
- data/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee +131 -0
- data/app/assets/javascripts/locomotive/views/shared/fields/select_view.js.coffee +83 -0
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +138 -0
- data/app/assets/javascripts/locomotive/views/shared/list_item_view.js.coffee +22 -0
- data/app/assets/javascripts/locomotive/views/shared/list_view.js.coffee +53 -0
- data/app/assets/javascripts/locomotive/views/sites/domain_entry_view.js.coffee +26 -0
- data/app/assets/javascripts/locomotive/views/sites/domains_view.js.coffee +84 -0
- data/app/assets/javascripts/locomotive/views/sites/membership_entry_view.js.coffee +31 -0
- data/app/assets/javascripts/locomotive/views/sites/memberships_view.js.coffee +41 -0
- data/app/assets/javascripts/locomotive/views/sites/new_view.js.coffee +43 -0
- data/app/assets/javascripts/locomotive/views/snippets/_form_view.js.coffee +75 -0
- data/app/assets/javascripts/locomotive/views/snippets/edit_view.js.coffee +6 -0
- data/app/assets/javascripts/locomotive/views/snippets/list_item_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/snippets/list_view.js.coffee +17 -0
- data/app/assets/javascripts/locomotive/views/snippets/new_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee +104 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/edit_view.js.coffee +16 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/image_picker_view.js.coffee +48 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee +91 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/list_item_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/list_view.js.coffee +17 -0
- data/app/assets/javascripts/locomotive/views/theme_assets/new_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/translations/_form_view.js.coffee +20 -0
- data/app/assets/javascripts/locomotive/views/translations/edit_view.js.coffee +6 -0
- data/app/assets/javascripts/locomotive/views/translations/new_view.js.coffee +8 -0
- data/app/assets/javascripts/tinymce/plugins/jqueryinlinepopups/editor_plugin.js +240 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/editor_plugin.js +78 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/content.css +66 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/dialog.css.scss +78 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/butt2.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/button-bg.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/buttons.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/down_arrow.gif +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/fade-butt.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/icons.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/items.gif +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/menu-arrow.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/menu-check.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/progress.gif +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/tabs.gif +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/img/toolbarbg.png +0 -0
- data/app/assets/javascripts/tinymce/themes/advanced/skins/locomotive/ui.css +1018 -0
- data/app/assets/stylesheets/locomotive.css +16 -0
- data/app/assets/stylesheets/locomotive/backoffice/_box.css.scss +157 -0
- data/app/assets/stylesheets/locomotive/backoffice/_buttons.css.scss +178 -0
- data/app/assets/stylesheets/locomotive/backoffice/application.css.scss +332 -0
- data/app/assets/stylesheets/locomotive/backoffice/codemirror_changes.css.scss +19 -0
- data/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss +130 -0
- data/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss +178 -0
- data/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss +141 -0
- data/app/assets/stylesheets/locomotive/backoffice/editable_elements.css.scss +71 -0
- data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +735 -0
- data/app/assets/stylesheets/locomotive/backoffice/layout.css.scss +205 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu.css +8 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/_colors.css.scss +125 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/_helpers.css.scss +6 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/default.css.scss +32 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss +127 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/sub.css.scss +276 -0
- data/app/assets/stylesheets/locomotive/backoffice/sites_picker.css.scss +12 -0
- data/app/assets/stylesheets/locomotive/inline_editor.css +13 -0
- data/app/assets/stylesheets/locomotive/inline_editor/_buttons.css.scss +60 -0
- data/app/assets/stylesheets/locomotive/inline_editor/layout.css.scss +22 -0
- data/app/assets/stylesheets/locomotive/inline_editor/toolbar.css.scss +114 -0
- data/app/assets/stylesheets/locomotive/not_logged_in.css +8 -0
- data/app/assets/stylesheets/locomotive/not_logged_in/installation.css.scss +62 -0
- data/app/assets/stylesheets/locomotive/not_logged_in/layout.css.scss +185 -0
- data/app/assets/stylesheets/locomotive/shared/_helpers.css.scss +150 -0
- data/app/assets/stylesheets/locomotive/shared/_picker.css.scss +73 -0
- data/app/assets/stylesheets/locomotive/shared/common.css.scss +34 -0
- data/app/assets/stylesheets/locomotive/shared/content_locale_picker.css.scss +80 -0
- data/app/assets/stylesheets/locomotive/shared/growl.css.scss +29 -0
- data/app/cells/locomotive/content_locale_picker/show.html.haml +7 -0
- data/app/cells/locomotive/content_locale_picker_cell.rb +21 -0
- data/app/cells/locomotive/global_actions/show.html.haml +12 -0
- data/app/cells/locomotive/global_actions_cell.rb +36 -0
- data/app/cells/locomotive/main_menu/show.html.haml +13 -0
- data/app/cells/locomotive/main_menu_cell.rb +12 -0
- data/app/cells/locomotive/menu/show.html.haml +1 -0
- data/app/cells/locomotive/menu_cell.rb +102 -0
- data/app/cells/locomotive/settings_menu_cell.rb +14 -0
- data/app/cells/locomotive/sub_menu/show.html.haml +4 -0
- data/app/cells/locomotive/sub_menu_cell.rb +13 -0
- data/app/controllers/locomotive/accounts_controller.rb +18 -0
- data/app/controllers/locomotive/api/accounts_controller.rb +79 -0
- data/app/controllers/locomotive/api/base_controller.rb +50 -0
- data/app/controllers/locomotive/api/content_assets_controller.rb +39 -0
- data/app/controllers/locomotive/api/content_entries_controller.rb +45 -0
- data/app/controllers/locomotive/api/content_types_controller.rb +39 -0
- data/app/controllers/locomotive/api/current_site_controller.rb +58 -0
- data/app/controllers/locomotive/api/documentation_controller.rb +15 -0
- data/app/controllers/locomotive/api/memberships_controller.rb +97 -0
- data/app/controllers/locomotive/api/my_account_controller.rb +35 -0
- data/app/controllers/locomotive/api/pages_controller.rb +41 -0
- data/app/controllers/locomotive/api/sites_controller.rb +93 -0
- data/app/controllers/locomotive/api/snippets_controller.rb +40 -0
- data/app/controllers/locomotive/api/theme_assets_controller.rb +39 -0
- data/app/controllers/locomotive/api/tokens_controller.rb +54 -0
- data/app/controllers/locomotive/api/translations_controller.rb +31 -0
- data/app/controllers/locomotive/base_controller.rb +61 -0
- data/app/controllers/locomotive/content_assets_controller.rb +23 -0
- data/app/controllers/locomotive/content_entries_controller.rb +71 -0
- data/app/controllers/locomotive/content_types_controller.rb +40 -0
- data/app/controllers/locomotive/current_site_controller.rb +52 -0
- data/app/controllers/locomotive/installation_controller.rb +72 -0
- data/app/controllers/locomotive/memberships_controller.rb +29 -0
- data/app/controllers/locomotive/my_account_controller.rb +24 -0
- data/app/controllers/locomotive/pages_controller.rb +63 -0
- data/app/controllers/locomotive/passwords_controller.rb +19 -0
- data/app/controllers/locomotive/public/base_controller.rb +22 -0
- data/app/controllers/locomotive/public/content_entries_controller.rb +55 -0
- data/app/controllers/locomotive/public/pages_controller.rb +50 -0
- data/app/controllers/locomotive/public/robots_controller.rb +16 -0
- data/app/controllers/locomotive/public/sitemaps_controller.rb +14 -0
- data/app/controllers/locomotive/sessions_controller.rb +29 -0
- data/app/controllers/locomotive/sites_controller.rb +33 -0
- data/app/controllers/locomotive/snippets_controller.rb +47 -0
- data/app/controllers/locomotive/theme_assets_controller.rb +52 -0
- data/app/controllers/locomotive/translations_controller.rb +32 -0
- data/app/helpers/locomotive/accounts_helper.rb +13 -0
- data/app/helpers/locomotive/base_helper.rb +182 -0
- data/app/helpers/locomotive/content_entries_helper.rb +15 -0
- data/app/helpers/locomotive/content_types_helper.rb +72 -0
- data/app/helpers/locomotive/custom_fields_helper.rb +70 -0
- data/app/helpers/locomotive/installation_helper.rb +9 -0
- data/app/helpers/locomotive/pages_helper.rb +95 -0
- data/app/helpers/locomotive/sites_helper.rb +15 -0
- data/app/helpers/locomotive/snippets_helper.rb +20 -0
- data/app/helpers/locomotive/theme_assets_helper.rb +30 -0
- data/app/helpers/locomotive/translations_helper.rb +19 -0
- data/app/inputs/locomotive/code_input.rb +51 -0
- data/app/inputs/locomotive/empty_input.rb +35 -0
- data/app/inputs/locomotive/file_input.rb +45 -0
- data/app/inputs/locomotive/locale_input.rb +40 -0
- data/app/inputs/locomotive/locales_input.rb +60 -0
- data/app/inputs/locomotive/rte_input.rb +13 -0
- data/app/inputs/locomotive/small_code_input.rb +22 -0
- data/app/inputs/locomotive/subdomain_input.rb +22 -0
- data/app/inputs/locomotive/toggle_input.rb +13 -0
- data/app/mailers/locomotive/devise_mailer.rb +10 -0
- data/app/mailers/locomotive/notifications.rb +15 -0
- data/app/models/locomotive/ability.rb +89 -0
- data/app/models/locomotive/account.rb +117 -0
- data/app/models/locomotive/content_asset.rb +40 -0
- data/app/models/locomotive/content_entry.rb +197 -0
- data/app/models/locomotive/content_type.rb +224 -0
- data/app/models/locomotive/editable_control.rb +52 -0
- data/app/models/locomotive/editable_element.rb +122 -0
- data/app/models/locomotive/editable_file.rb +85 -0
- data/app/models/locomotive/editable_long_text.rb +5 -0
- data/app/models/locomotive/editable_short_text.rb +66 -0
- data/app/models/locomotive/extensions/asset/types.rb +31 -0
- data/app/models/locomotive/extensions/asset/vignette.rb +19 -0
- data/app/models/locomotive/extensions/content_type/default_values.rb +57 -0
- data/app/models/locomotive/extensions/content_type/item_template.rb +49 -0
- data/app/models/locomotive/extensions/content_type/sync.rb +62 -0
- data/app/models/locomotive/extensions/page/editable_elements.rb +105 -0
- data/app/models/locomotive/extensions/page/listed.rb +18 -0
- data/app/models/locomotive/extensions/page/parse.rb +125 -0
- data/app/models/locomotive/extensions/page/redirect.rb +25 -0
- data/app/models/locomotive/extensions/page/render.rb +93 -0
- data/app/models/locomotive/extensions/page/templatized.rb +163 -0
- data/app/models/locomotive/extensions/page/tree.rb +133 -0
- data/app/models/locomotive/extensions/shared/seo.rb +16 -0
- data/app/models/locomotive/extensions/site/first_installation.rb +20 -0
- data/app/models/locomotive/extensions/site/locales.rb +112 -0
- data/app/models/locomotive/extensions/site/subdomain_domains.rb +91 -0
- data/app/models/locomotive/membership.rb +75 -0
- data/app/models/locomotive/page.rb +130 -0
- data/app/models/locomotive/site.rb +79 -0
- data/app/models/locomotive/snippet.rb +70 -0
- data/app/models/locomotive/theme_asset.rb +175 -0
- data/app/models/locomotive/translation.rb +32 -0
- data/app/presenters/locomotive/account_presenter.rb +19 -0
- data/app/presenters/locomotive/base_presenter.rb +99 -0
- data/app/presenters/locomotive/content_asset_presenter.rb +43 -0
- data/app/presenters/locomotive/content_entry_presenter.rb +217 -0
- data/app/presenters/locomotive/content_field_presenter.rb +71 -0
- data/app/presenters/locomotive/content_type_presenter.rb +68 -0
- data/app/presenters/locomotive/editable_control_presenter.rb +19 -0
- data/app/presenters/locomotive/editable_element_presenter.rb +40 -0
- data/app/presenters/locomotive/editable_file_presenter.rb +29 -0
- data/app/presenters/locomotive/editable_long_text_presenter.rb +5 -0
- data/app/presenters/locomotive/editable_short_text_presenter.rb +27 -0
- data/app/presenters/locomotive/membership_presenter.rb +36 -0
- data/app/presenters/locomotive/page_presenter.rb +58 -0
- data/app/presenters/locomotive/site_presenter.rb +36 -0
- data/app/presenters/locomotive/snippet_presenter.rb +22 -0
- data/app/presenters/locomotive/theme_asset_presenter.rb +61 -0
- data/app/presenters/locomotive/translation_presenter.rb +9 -0
- data/app/uploaders/locomotive/content_asset_uploader.rb +13 -0
- data/app/uploaders/locomotive/editable_file_uploader.rb +15 -0
- data/app/uploaders/locomotive/theme_asset_uploader.rb +28 -0
- data/app/views/locomotive/accounts/new.html.haml +21 -0
- data/app/views/locomotive/content_assets/_asset.html.haml +5 -0
- data/app/views/locomotive/content_assets/_picker.html.haml +33 -0
- data/app/views/locomotive/content_entries/_form.html.haml +22 -0
- data/app/views/locomotive/content_entries/_list.html.haml +18 -0
- data/app/views/locomotive/content_entries/edit.html.haml +21 -0
- data/app/views/locomotive/content_entries/index.html.haml +32 -0
- data/app/views/locomotive/content_entries/new.html.haml +19 -0
- data/app/views/locomotive/content_types/_form.html.haml +39 -0
- data/app/views/locomotive/content_types/edit.html.haml +19 -0
- data/app/views/locomotive/content_types/new.html.haml +15 -0
- data/app/views/locomotive/current_site/_form.html.haml +36 -0
- data/app/views/locomotive/current_site/edit.html.haml +19 -0
- data/app/views/locomotive/custom_fields/_form.html.haml +61 -0
- data/app/views/locomotive/custom_fields/_select_templates.html.haml +16 -0
- data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +5 -0
- data/app/views/locomotive/custom_fields/types/_boolean.html.haml +4 -0
- data/app/views/locomotive/custom_fields/types/_date.html.haml +5 -0
- data/app/views/locomotive/custom_fields/types/_file.html.haml +4 -0
- data/app/views/locomotive/custom_fields/types/_has_many.html.haml +70 -0
- data/app/views/locomotive/custom_fields/types/_many_to_many.html.haml +41 -0
- data/app/views/locomotive/custom_fields/types/_select.html.haml +34 -0
- data/app/views/locomotive/custom_fields/types/_string.html.haml +4 -0
- data/app/views/locomotive/custom_fields/types/_text.html.haml +5 -0
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.haml +12 -0
- data/app/views/locomotive/errors/404.html.haml +7 -0
- data/app/views/locomotive/errors/500.html.haml +7 -0
- data/app/views/locomotive/errors/no_page.html.haml +1 -0
- data/app/views/locomotive/errors/no_site.html.haml +1 -0
- data/app/views/locomotive/installation/step_1.html.haml +23 -0
- data/app/views/locomotive/installation/step_2.html.haml +24 -0
- data/app/views/locomotive/layouts/application.html.haml +34 -0
- data/app/views/locomotive/layouts/error.html.haml +1 -0
- data/app/views/locomotive/layouts/not_logged_in.html.haml +18 -0
- data/app/views/locomotive/memberships/new.html.haml +14 -0
- data/app/views/locomotive/my_account/edit.html.haml +40 -0
- data/app/views/locomotive/notifications/new_content_entry.html.haml +29 -0
- data/app/views/locomotive/pages/_editable_elements.html.haml +64 -0
- data/app/views/locomotive/pages/_form.html.haml +61 -0
- data/app/views/locomotive/pages/_page.html.haml +42 -0
- data/app/views/locomotive/pages/edit.html.haml +18 -0
- data/app/views/locomotive/pages/index.html.haml +19 -0
- data/app/views/locomotive/pages/new.html.haml +15 -0
- data/app/views/locomotive/passwords/edit.html.haml +18 -0
- data/app/views/locomotive/passwords/new.html.haml +17 -0
- data/app/views/locomotive/public/pages/show_toolbar.html.haml +64 -0
- data/app/views/locomotive/public/sitemaps/show.xml.builder +29 -0
- data/app/views/locomotive/sessions/new.html.haml +17 -0
- data/app/views/locomotive/shared/_footer.html.haml +1 -0
- data/app/views/locomotive/shared/_form_actions.html.haml +14 -0
- data/app/views/locomotive/shared/_head.html.haml +38 -0
- data/app/views/locomotive/shared/_header.html.haml +10 -0
- data/app/views/locomotive/shared/_locale_picker_link.html.haml +6 -0
- data/app/views/locomotive/shared/_main_app_head.html.haml +1 -0
- data/app/views/locomotive/shared/_site_picker.html.haml +10 -0
- data/app/views/locomotive/shared/actions/_contents.html.haml +7 -0
- data/app/views/locomotive/shared/menu/_contents.html.haml +51 -0
- data/app/views/locomotive/sites/_domains.html.haml +22 -0
- data/app/views/locomotive/sites/_form.html.haml +12 -0
- data/app/views/locomotive/sites/_memberships.html.haml +27 -0
- data/app/views/locomotive/sites/new.html.haml +12 -0
- data/app/views/locomotive/snippets/_form.html.haml +13 -0
- data/app/views/locomotive/snippets/_snippet.html.haml +8 -0
- data/app/views/locomotive/snippets/edit.html.haml +18 -0
- data/app/views/locomotive/snippets/new.html.haml +15 -0
- data/app/views/locomotive/theme_assets/_asset.html.haml +11 -0
- data/app/views/locomotive/theme_assets/_form.html.haml +35 -0
- data/app/views/locomotive/theme_assets/_list.html.haml +7 -0
- data/app/views/locomotive/theme_assets/_picker.html.haml +25 -0
- data/app/views/locomotive/theme_assets/edit.html.haml +21 -0
- data/app/views/locomotive/theme_assets/index.html.haml +50 -0
- data/app/views/locomotive/theme_assets/new.html.haml +12 -0
- data/app/views/locomotive/translations/_form.html.haml +12 -0
- data/app/views/locomotive/translations/edit.html.haml +15 -0
- data/app/views/locomotive/translations/index.html.haml +26 -0
- data/app/views/locomotive/translations/new.html.haml +12 -0
- data/config/cucumber.yml +8 -0
- data/config/initializers/deny_phantomjs_ttf.rb +29 -0
- data/config/initializers/devise.rb +15 -0
- data/config/initializers/formtastic.rb +4 -0
- data/config/initializers/haml.rb +2 -0
- data/config/initializers/locomotive_loaded_first.rb +19 -0
- data/config/locales/admin_ui.de.yml +316 -0
- data/config/locales/admin_ui.en.yml +332 -0
- data/config/locales/admin_ui.es.yml +296 -0
- data/config/locales/admin_ui.et.yml +315 -0
- data/config/locales/admin_ui.fr.yml +326 -0
- data/config/locales/admin_ui.it.yml +295 -0
- data/config/locales/admin_ui.nb.yml +314 -0
- data/config/locales/admin_ui.nl.yml +279 -0
- data/config/locales/admin_ui.pl.yml +319 -0
- data/config/locales/admin_ui.pt-BR.yml +274 -0
- data/config/locales/admin_ui.ru.yml +313 -0
- data/config/locales/carrierwave.de.yml +4 -0
- data/config/locales/carrierwave.en.yml +4 -0
- data/config/locales/carrierwave.es.yml +4 -0
- data/config/locales/carrierwave.et.yml +4 -0
- data/config/locales/carrierwave.fr.yml +4 -0
- data/config/locales/carrierwave.it.yml +4 -0
- data/config/locales/carrierwave.nb.yml +4 -0
- data/config/locales/carrierwave.nl.yml +4 -0
- data/config/locales/carrierwave.pl.yml +4 -0
- data/config/locales/carrierwave.pt-BR.yml +4 -0
- data/config/locales/carrierwave.ru.yml +4 -0
- data/config/locales/default.de.yml +244 -0
- data/config/locales/default.en.yml +43 -0
- data/config/locales/default.es.yml +216 -0
- data/config/locales/default.et.yml +240 -0
- data/config/locales/default.fr.yml +224 -0
- data/config/locales/default.it.yml +243 -0
- data/config/locales/default.nb.yml +313 -0
- data/config/locales/default.nl.yml +170 -0
- data/config/locales/default.pl.yml +317 -0
- data/config/locales/default.pt-BR.yml +211 -0
- data/config/locales/default.ru.yml +279 -0
- data/config/locales/devise.de.yml +62 -0
- data/config/locales/devise.en.yml +63 -0
- data/config/locales/devise.es.yml +63 -0
- data/config/locales/devise.et.yml +64 -0
- data/config/locales/devise.fr.yml +67 -0
- data/config/locales/devise.it.yml +63 -0
- data/config/locales/devise.nb.yml +63 -0
- data/config/locales/devise.nl.yml +63 -0
- data/config/locales/devise.pl.yml +63 -0
- data/config/locales/devise.pt-BR.yml +61 -0
- data/config/locales/devise.ru.yml +63 -0
- data/config/locales/flash.de.yml +106 -0
- data/config/locales/flash.en.yml +115 -0
- data/config/locales/flash.es.yml +106 -0
- data/config/locales/flash.et.yml +106 -0
- data/config/locales/flash.fr.yml +106 -0
- data/config/locales/flash.it.yml +106 -0
- data/config/locales/flash.nb.yml +106 -0
- data/config/locales/flash.nl.yml +106 -0
- data/config/locales/flash.pl.yml +106 -0
- data/config/locales/flash.pt-BR.yml +106 -0
- data/config/locales/flash.ru.yml +106 -0
- data/config/locales/formtastic.de.yml +97 -0
- data/config/locales/formtastic.en.yml +105 -0
- data/config/locales/formtastic.es.yml +84 -0
- data/config/locales/formtastic.et.yml +103 -0
- data/config/locales/formtastic.fr.yml +94 -0
- data/config/locales/formtastic.it.yml +99 -0
- data/config/locales/formtastic.nb.yml +103 -0
- data/config/locales/formtastic.nl.yml +85 -0
- data/config/locales/formtastic.pl.yml +105 -0
- data/config/locales/formtastic.pt-BR.yml +70 -0
- data/config/locales/formtastic.ru.yml +103 -0
- data/config/routes.rb +116 -0
- data/lib/generators/locomotive/install/install_generator.rb +35 -0
- data/lib/generators/locomotive/install/templates/README +26 -0
- data/lib/generators/locomotive/install/templates/carrierwave.rb +28 -0
- data/lib/generators/locomotive/install/templates/dragonfly.rb +22 -0
- data/lib/generators/locomotive/install/templates/locomotive.rb +69 -0
- data/lib/generators/locomotive/install/templates/mongoid.yml +34 -0
- data/lib/locomotive.rb +136 -0
- data/lib/locomotive/action_controller.rb +5 -0
- data/lib/locomotive/action_controller/locale_helpers.rb +61 -0
- data/lib/locomotive/action_controller/public_responder.rb +17 -0
- data/lib/locomotive/action_controller/responder.rb +78 -0
- data/lib/locomotive/action_controller/section_helpers.rb +29 -0
- data/lib/locomotive/action_controller/url_helpers.rb +38 -0
- data/lib/locomotive/carrierwave.rb +10 -0
- data/lib/locomotive/carrierwave/asset.rb +72 -0
- data/lib/locomotive/carrierwave/base.rb +15 -0
- data/lib/locomotive/carrierwave/patches.rb +32 -0
- data/lib/locomotive/configuration.rb +122 -0
- data/lib/locomotive/core_ext.rb +64 -0
- data/lib/locomotive/custom_fields.rb +66 -0
- data/lib/locomotive/dependencies.rb +30 -0
- data/lib/locomotive/devise.rb +1 -0
- data/lib/locomotive/dragonfly.rb +38 -0
- data/lib/locomotive/engine.rb +37 -0
- data/lib/locomotive/formtastic.rb +13 -0
- data/lib/locomotive/haml.rb +1 -0
- data/lib/locomotive/httparty.rb +2 -0
- data/lib/locomotive/httparty/patches.rb +18 -0
- data/lib/locomotive/httparty/webservice.rb +42 -0
- data/lib/locomotive/kaminari.rb +35 -0
- data/lib/locomotive/liquid.rb +7 -0
- data/lib/locomotive/liquid/drops/base.rb +42 -0
- data/lib/locomotive/liquid/drops/content_entry.rb +76 -0
- data/lib/locomotive/liquid/drops/content_types.rb +50 -0
- data/lib/locomotive/liquid/drops/current_user.rb +21 -0
- data/lib/locomotive/liquid/drops/page.rb +55 -0
- data/lib/locomotive/liquid/drops/proxy_collection.rb +56 -0
- data/lib/locomotive/liquid/drops/site.rb +19 -0
- data/lib/locomotive/liquid/drops/uploader.rb +15 -0
- data/lib/locomotive/liquid/errors.rb +7 -0
- data/lib/locomotive/liquid/filters/base.rb +47 -0
- data/lib/locomotive/liquid/filters/date.rb +54 -0
- data/lib/locomotive/liquid/filters/html.rb +115 -0
- data/lib/locomotive/liquid/filters/misc.rb +65 -0
- data/lib/locomotive/liquid/filters/resize.rb +16 -0
- data/lib/locomotive/liquid/filters/text.rb +45 -0
- data/lib/locomotive/liquid/filters/translate.rb +16 -0
- data/lib/locomotive/liquid/patches.rb +21 -0
- data/lib/locomotive/liquid/tags/consume.rb +67 -0
- data/lib/locomotive/liquid/tags/csrf.rb +40 -0
- data/lib/locomotive/liquid/tags/editable.rb +5 -0
- data/lib/locomotive/liquid/tags/editable/base.rb +88 -0
- data/lib/locomotive/liquid/tags/editable/control.rb +31 -0
- data/lib/locomotive/liquid/tags/editable/file.rb +39 -0
- data/lib/locomotive/liquid/tags/editable/long_text.rb +33 -0
- data/lib/locomotive/liquid/tags/editable/short_text.rb +41 -0
- data/lib/locomotive/liquid/tags/extends.rb +47 -0
- data/lib/locomotive/liquid/tags/google_analytics.rb +39 -0
- data/lib/locomotive/liquid/tags/inherited_block.rb +31 -0
- data/lib/locomotive/liquid/tags/inline_editor.rb +40 -0
- data/lib/locomotive/liquid/tags/locale_switcher.rb +83 -0
- data/lib/locomotive/liquid/tags/nav.rb +155 -0
- data/lib/locomotive/liquid/tags/paginate.rb +111 -0
- data/lib/locomotive/liquid/tags/seo.rb +72 -0
- data/lib/locomotive/liquid/tags/snippet.rb +75 -0
- data/lib/locomotive/liquid/tags/with_scope.rb +47 -0
- data/lib/locomotive/logger.rb +11 -0
- data/lib/locomotive/middlewares.rb +4 -0
- data/lib/locomotive/middlewares/cache.rb +27 -0
- data/lib/locomotive/middlewares/fonts.rb +42 -0
- data/lib/locomotive/middlewares/inline_editor.rb +36 -0
- data/lib/locomotive/middlewares/seo_trailing_slash.rb +24 -0
- data/lib/locomotive/misc/api_documentation.rb +96 -0
- data/lib/locomotive/misc/api_documentation/bootstrap.html.haml +119 -0
- data/lib/locomotive/mongoid.rb +4 -0
- data/lib/locomotive/mongoid/document.rb +19 -0
- data/lib/locomotive/mongoid/liquid.rb +39 -0
- data/lib/locomotive/mongoid/patches.rb +106 -0
- data/lib/locomotive/mongoid/presenter.rb +73 -0
- data/lib/locomotive/presentable.rb +212 -0
- data/lib/locomotive/rails.rb +1 -0
- data/lib/locomotive/rails/action_view.rb +9 -0
- data/lib/locomotive/regexps.rb +11 -0
- data/lib/locomotive/render.rb +177 -0
- data/lib/locomotive/routing.rb +2 -0
- data/lib/locomotive/routing/default_constraint.rb +42 -0
- data/lib/locomotive/routing/site_dispatcher.rb +54 -0
- data/lib/locomotive/session_store.rb +64 -0
- data/lib/locomotive/version.rb +3 -0
- data/lib/locomotive_cms.rb +1 -0
- data/lib/tasks/cucumber.rake +66 -0
- data/lib/tasks/locomotive.rake +220 -0
- data/public/favicon.ico +0 -0
- data/vendor/assets/fonts/locomotive/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/locomotive/fontawesome-webfont.svg +255 -0
- data/vendor/assets/fonts/locomotive/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/locomotive/fontawesome-webfont.woff +0 -0
- data/vendor/assets/javascripts/locomotive/ICanHandlebarz.js +88 -0
- data/vendor/assets/javascripts/locomotive/backbone.modelbinding.js +565 -0
- data/vendor/assets/javascripts/locomotive/backbone.sync.js +113 -0
- data/vendor/assets/javascripts/locomotive/cmd.js +31 -0
- data/vendor/assets/javascripts/locomotive/cookies.js +96 -0
- data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +28 -0
- data/vendor/assets/javascripts/locomotive/editable_field.js +50 -0
- data/vendor/assets/javascripts/locomotive/form_submit_notification.js +39 -0
- data/vendor/assets/javascripts/locomotive/growl.js +143 -0
- data/vendor/assets/javascripts/locomotive/handlebars.js +1493 -0
- data/vendor/assets/javascripts/locomotive/liquid_mode.js +42 -0
- data/vendor/assets/javascripts/locomotive/menu_toggler.js +37 -0
- data/vendor/assets/javascripts/locomotive/resize.js +9 -0
- data/vendor/assets/javascripts/locomotive/slugify.js +31 -0
- data/vendor/assets/javascripts/locomotive/smartupdater.js +296 -0
- data/vendor/assets/javascripts/locomotive/subscribe.js +367 -0
- data/vendor/assets/javascripts/locomotive/toggle.js +143 -0
- data/vendor/assets/javascripts/locomotive/vendor.js +1 -0
- data/vendor/assets/stylesheets/locomotive/blueprint/ie.css +26 -0
- data/vendor/assets/stylesheets/locomotive/blueprint/print.css +30 -0
- data/vendor/assets/stylesheets/locomotive/blueprint/screen.css +253 -0
- data/vendor/assets/stylesheets/locomotive/font-awesome.scss +329 -0
- data/vendor/assets/stylesheets/locomotive/jquery.css +3 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/stylesheets/locomotive/jquery/ui.css +406 -0
- data/vendor/assets/stylesheets/locomotive/liquid_mode.css +7 -0
- data/vendor/assets/stylesheets/locomotive/toggle.css.scss +75 -0
- metadata +1171 -0
@@ -0,0 +1 @@
|
|
1
|
+
require 'locomotive/rails/action_view'
|
@@ -0,0 +1,177 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Render
|
3
|
+
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
protected
|
7
|
+
|
8
|
+
# Render a Locomotive page from the request fullpath and the current site.
|
9
|
+
# If the page corresponds to a redirect, then a 301 redirection is made.
|
10
|
+
#
|
11
|
+
def render_locomotive_page
|
12
|
+
if request.fullpath =~ /^\/#{Locomotive.mounted_on}\//
|
13
|
+
render :template => '/locomotive/errors/404', :layout => '/locomotive/layouts/not_logged_in', :status => :not_found
|
14
|
+
else
|
15
|
+
@page = locomotive_page
|
16
|
+
|
17
|
+
if @page.present? && @page.redirect?
|
18
|
+
self.redirect_to_locomotive_page and return
|
19
|
+
end
|
20
|
+
|
21
|
+
render_no_page_error and return if @page.nil?
|
22
|
+
|
23
|
+
output = @page.render(locomotive_context)
|
24
|
+
|
25
|
+
self.prepare_and_set_response(output)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Redirect to the url given by the redirect_url field of the
|
30
|
+
# Locomotive page. If we are in the editing mode, the "_edit" prefix
|
31
|
+
# will be added as well.
|
32
|
+
#
|
33
|
+
def redirect_to_locomotive_page
|
34
|
+
redirect_url = @page.redirect_url
|
35
|
+
|
36
|
+
redirect_url = "#{redirect_url}/_edit" if self.editing_page?
|
37
|
+
|
38
|
+
redirect_to(redirect_url, :status => @page.redirect_type)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Render the page which tells that no page exists.
|
42
|
+
# This case should not happen since all the sites contains
|
43
|
+
# the "Page Not Found" page.
|
44
|
+
#
|
45
|
+
def render_no_page_error
|
46
|
+
render :template => '/locomotive/errors/no_page', :layout => false
|
47
|
+
end
|
48
|
+
|
49
|
+
# Prepare and set the response object for the Locomotive page retrieved
|
50
|
+
# from the path. The caching (with Varnish for instance) if defined is done here.
|
51
|
+
# It is also here that the content type of the request is set (html or json).
|
52
|
+
# Behind the scene, it just calls simply the Rails render method.
|
53
|
+
#
|
54
|
+
# @param [ String ] The rendered Locomotive page
|
55
|
+
#
|
56
|
+
def prepare_and_set_response(output)
|
57
|
+
flash.discard
|
58
|
+
|
59
|
+
response.headers['Content-Type'] = "#{@page.response_type}; charset=utf-8"
|
60
|
+
response.headers['Editable'] = 'true' unless self.editing_page? || current_locomotive_account.nil?
|
61
|
+
|
62
|
+
if @page.with_cache?
|
63
|
+
fresh_when :etag => @page, :last_modified => @page.updated_at.utc, :public => true
|
64
|
+
|
65
|
+
if @page.cache_strategy != 'simple' # varnish
|
66
|
+
response.headers['Editable'] = ''
|
67
|
+
response.cache_control[:max_age] = @page.cache_strategy
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
render :text => output, :layout => false, :status => page_status unless performed?
|
72
|
+
end
|
73
|
+
|
74
|
+
# Tell if the current Locomotive page is being edited.
|
75
|
+
#
|
76
|
+
# @return [ Boolean ] True if being edited.
|
77
|
+
#
|
78
|
+
def editing_page?
|
79
|
+
!!@editing
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get the symbol matching the status of the current Locomotive page.
|
83
|
+
# It can be either :ok or :not_found (404)
|
84
|
+
#
|
85
|
+
# @return [ Symbol ] :ok if the page is not the "Page not found" one.
|
86
|
+
#
|
87
|
+
def page_status
|
88
|
+
@page.not_found? ? :not_found : :ok
|
89
|
+
end
|
90
|
+
|
91
|
+
# Get the Locomotive page matching the request and scoped by the current Locomotive site
|
92
|
+
#
|
93
|
+
# @return [ Object ] The Locomotive::Page
|
94
|
+
#
|
95
|
+
def locomotive_page
|
96
|
+
current_site.fetch_page self.locomotive_page_path, current_locomotive_account.present?
|
97
|
+
end
|
98
|
+
|
99
|
+
# Build the path that can be understood by Locomotive in order to retrieve
|
100
|
+
# the matching Locomotive page (see the locomotive_page method)
|
101
|
+
#
|
102
|
+
# @return [ String ] The path to the Locomotive page
|
103
|
+
#
|
104
|
+
def locomotive_page_path
|
105
|
+
path = (params[:path] || params[:page_path] || request.fullpath).clone # TODO: params[:path] is more consistent
|
106
|
+
path = path.split('?').first # take everything before the query string or the lookup fails
|
107
|
+
path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '') # remove the page extension
|
108
|
+
path.gsub!(/^\//, '') # remove the leading slash
|
109
|
+
|
110
|
+
path = 'index' if path.blank? || path == '_edit'
|
111
|
+
|
112
|
+
path
|
113
|
+
end
|
114
|
+
|
115
|
+
# Build the Liquid context used to render the Locomotive page. It
|
116
|
+
# stores both assigns and registers.
|
117
|
+
#
|
118
|
+
# @return [ Object ] A Liquid::Context object.
|
119
|
+
#
|
120
|
+
def locomotive_context
|
121
|
+
assigns = self.locomotive_default_assigns
|
122
|
+
|
123
|
+
assigns.merge!(Locomotive.config.context_assign_extensions)
|
124
|
+
|
125
|
+
assigns.merge!(flash.to_hash.stringify_keys) # data from public submissions
|
126
|
+
|
127
|
+
if defined?(@page) && @page.templatized? # add instance from content type
|
128
|
+
content_entry = @page.content_entry.to_liquid
|
129
|
+
['content_entry', 'entry', @page.target_entry_name].each do |key|
|
130
|
+
assigns[key] = content_entry
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Tip: switch from false to true to enable the re-thrown exception flag
|
135
|
+
::Liquid::Context.new({}, assigns, self.locomotive_default_registers, false)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Return the default Liquid assigns used inside the Locomotive Liquid context
|
139
|
+
#
|
140
|
+
# @return [ Hash ] The default liquid assigns object
|
141
|
+
#
|
142
|
+
def locomotive_default_assigns
|
143
|
+
{
|
144
|
+
'site' => current_site.to_liquid,
|
145
|
+
'page' => @page,
|
146
|
+
'models' => Locomotive::Liquid::Drops::ContentTypes.new,
|
147
|
+
'contents' => Locomotive::Liquid::Drops::ContentTypes.new, # DEPRECATED
|
148
|
+
'current_page' => self.params[:page],
|
149
|
+
'params' => self.params,
|
150
|
+
'path' => request.path,
|
151
|
+
'fullpath' => request.fullpath,
|
152
|
+
'url' => request.url,
|
153
|
+
'now' => Time.now.utc,
|
154
|
+
'today' => Date.today,
|
155
|
+
'locale' => I18n.locale.to_s,
|
156
|
+
'default_locale' => current_site.default_locale.to_s,
|
157
|
+
'locales' => current_site.locales,
|
158
|
+
'current_user' => Locomotive::Liquid::Drops::CurrentUser.new(current_locomotive_account)
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
# Return the default Liquid registers used inside the Locomotive Liquid context
|
163
|
+
#
|
164
|
+
# @return [ Hash ] The default liquid registers object
|
165
|
+
#
|
166
|
+
def locomotive_default_registers
|
167
|
+
{
|
168
|
+
:controller => self,
|
169
|
+
:site => current_site,
|
170
|
+
:page => @page,
|
171
|
+
:inline_editor => self.editing_page?,
|
172
|
+
:current_locomotive_account => current_locomotive_account
|
173
|
+
}
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Routing
|
3
|
+
class DefaultConstraint
|
4
|
+
|
5
|
+
def self.matches?(request)
|
6
|
+
if Locomotive.config.multi_sites?
|
7
|
+
domain, subdomain = domain_and_subdomain(request)
|
8
|
+
subdomain = 'www' if subdomain.blank?
|
9
|
+
|
10
|
+
domain == Locomotive.config.domain && Locomotive.config.reserved_subdomains.include?(subdomain)
|
11
|
+
else
|
12
|
+
false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# see actionpack/lib/action_dispatch/http/url.rb for more information
|
17
|
+
def self.domain_and_subdomain(request)
|
18
|
+
[extract_domain(request), extract_subdomain(request)]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.extract_domain(request, tld_length = 1)
|
22
|
+
return nil unless named_host?(request.host)
|
23
|
+
request.host.split('.').last(1 + tld_length).join('.')
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.extract_subdomain(request, tld_length = 1)
|
27
|
+
subdomains(request, tld_length).join('.')
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.named_host?(host)
|
31
|
+
!(host.nil? || /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(host))
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.subdomains(request, tld_length = 1)
|
35
|
+
return [] unless named_host?(request.host)
|
36
|
+
parts = request.host.split('.')
|
37
|
+
parts[0..-(tld_length+2)]
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Routing
|
3
|
+
module SiteDispatcher
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
if self.respond_to?(:before_filter)
|
9
|
+
before_filter :fetch_site
|
10
|
+
|
11
|
+
helper_method :current_site
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def fetch_site
|
18
|
+
Locomotive.log "[fetch site] host = #{request.host} / #{request.env['HTTP_HOST']}"
|
19
|
+
|
20
|
+
if Locomotive.config.multi_sites?
|
21
|
+
@current_site ||= Locomotive::Site.match_domain(request.host).first
|
22
|
+
else
|
23
|
+
@current_site ||= Locomotive::Site.first
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def current_site
|
28
|
+
@current_site || fetch_site
|
29
|
+
end
|
30
|
+
|
31
|
+
def require_site
|
32
|
+
return true if current_site
|
33
|
+
|
34
|
+
redirect_to installation_url and return false if Locomotive::Account.count == 0 || Locomotive::Site.count == 0
|
35
|
+
|
36
|
+
render_no_site_error and return false
|
37
|
+
end
|
38
|
+
|
39
|
+
def render_no_site_error
|
40
|
+
render :template => '/locomotive/errors/no_site', :layout => false, :status => :not_found
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate_site_membership
|
44
|
+
return true if current_site.present? && current_site.accounts.include?(current_locomotive_account)
|
45
|
+
|
46
|
+
sign_out(current_locomotive_account)
|
47
|
+
flash[:alert] = I18n.t(:no_membership, :scope => [:devise, :failure, :locomotive_account])
|
48
|
+
redirect_to new_locomotive_account_session_url and return false
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module ActionDispatch
|
2
|
+
module Session
|
3
|
+
class MongoidStore < AbstractStore
|
4
|
+
|
5
|
+
class Session
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
|
9
|
+
field :data, :type => String, :default => [Marshal.dump({})].pack("m*")
|
10
|
+
index :updated_at
|
11
|
+
end
|
12
|
+
|
13
|
+
# The class used for session storage.
|
14
|
+
cattr_accessor :session_class
|
15
|
+
self.session_class = Session
|
16
|
+
|
17
|
+
SESSION_RECORD_KEY = 'rack.session.record'.freeze
|
18
|
+
|
19
|
+
private
|
20
|
+
def generate_sid
|
21
|
+
BSON::ObjectId.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_session(env, sid)
|
25
|
+
sid ||= generate_sid
|
26
|
+
session = find_session(sid)
|
27
|
+
env[SESSION_RECORD_KEY] = session
|
28
|
+
[sid, unpack(session.data)]
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_session(env, sid, session_data, options)
|
32
|
+
record = env[SESSION_RECORD_KEY] ||= find_session(sid)
|
33
|
+
record.data = pack(session_data)
|
34
|
+
# Rack spec dictates that set_session should return true or false
|
35
|
+
# depending on whether or not the session was saved or not.
|
36
|
+
# However, ActionPack seems to want a session id instead.
|
37
|
+
record.save ? sid : false
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_session(id)
|
41
|
+
id = BSON::ObjectId.from_string(id.to_s)
|
42
|
+
@@session_class.first(:conditions => { :_id => id }) ||
|
43
|
+
@@session_class.new(:id => id)
|
44
|
+
end
|
45
|
+
|
46
|
+
def pack(data)
|
47
|
+
[Marshal.dump(data)].pack("m*")
|
48
|
+
end
|
49
|
+
|
50
|
+
def unpack(packed)
|
51
|
+
return nil unless packed
|
52
|
+
Marshal.load(packed.unpack("m*").first)
|
53
|
+
end
|
54
|
+
|
55
|
+
def destroy(env)
|
56
|
+
session = @@session_class.first(:conditions => { :_id => env[SESSION_RECORD_KEY].id })
|
57
|
+
session.try(:destroy)
|
58
|
+
|
59
|
+
env[SESSION_RECORD_KEY] = nil
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'locomotive/engine'
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
require 'rails'
|
8
|
+
|
9
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
10
|
+
|
11
|
+
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
12
|
+
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'cucumber/rake/task'
|
16
|
+
|
17
|
+
namespace :cucumber do
|
18
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
19
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
20
|
+
t.fork = true # You may get faster startup if you set this to false
|
21
|
+
t.profile = 'default'
|
22
|
+
end
|
23
|
+
|
24
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
25
|
+
t.binary = vendored_cucumber_bin
|
26
|
+
t.fork = true # You may get faster startup if you set this to false
|
27
|
+
t.profile = 'wip'
|
28
|
+
end
|
29
|
+
|
30
|
+
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
31
|
+
t.binary = vendored_cucumber_bin
|
32
|
+
t.fork = true # You may get faster startup if you set this to false
|
33
|
+
t.profile = 'rerun'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Run all features'
|
37
|
+
task :all => [:ok, :wip]
|
38
|
+
|
39
|
+
task :statsetup do
|
40
|
+
require 'rails/code_statistics'
|
41
|
+
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
42
|
+
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
desc 'Alias for cucumber:ok'
|
46
|
+
task :cucumber => 'cucumber:ok'
|
47
|
+
|
48
|
+
task :default => :cucumber
|
49
|
+
|
50
|
+
task :features => :cucumber do
|
51
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
52
|
+
end
|
53
|
+
|
54
|
+
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
55
|
+
task 'db:test:prepare' do
|
56
|
+
end
|
57
|
+
|
58
|
+
task :stats => 'cucumber:statsetup'
|
59
|
+
rescue LoadError
|
60
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
61
|
+
task :cucumber do
|
62
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :locomotive do
|
4
|
+
|
5
|
+
# desc 'Fetch the Locomotive default site template for the installation'
|
6
|
+
# task :fetch_default_site_template => :environment do
|
7
|
+
# puts "Downloading default site template from '#{Locomotive::Import.DEFAULT_SITE_TEMPLATE}'"
|
8
|
+
# `curl -L -s -o #{Rails.root}/tmp/default_site_template.zip #{Locomotive::Import.DEFAULT_SITE_TEMPLATE}`
|
9
|
+
# puts '...done'
|
10
|
+
# end
|
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
|
+
pages = site.pages.to_a
|
16
|
+
while !pages.empty? do
|
17
|
+
page = pages.pop
|
18
|
+
begin
|
19
|
+
page.send :_parse_and_serialize_template
|
20
|
+
page.save
|
21
|
+
puts "[#{site.name}] processing...#{page.title}"
|
22
|
+
rescue TypeError => e
|
23
|
+
pages.insert(0, page)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Add a new admin user (NOTE: currently only supports adding user to first site)'
|
30
|
+
task :add_admin => :environment do
|
31
|
+
name = ask('Display name: ') { |q| q.echo = true }
|
32
|
+
email = ask('Email address: ') { |q| q.echo = true }
|
33
|
+
password = ask('Password: ') { |q| q.echo = '*' }
|
34
|
+
password_confirm = ask('Confirm password: ') { |q| q.echo = '*' }
|
35
|
+
|
36
|
+
account = Locomotive::Account.create :email => email, :password => password, :password_confirmation => password_confirm, :name => name
|
37
|
+
|
38
|
+
# TODO: this should be changed to work for multi-sites (see desc)
|
39
|
+
site = Locomotive::Site.first
|
40
|
+
site.memberships.build :account => account, :role => 'admin'
|
41
|
+
site.save!
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :upgrade do
|
45
|
+
|
46
|
+
desc 'Fix issue with the editable file and i18n in the 2.0.0.rc'
|
47
|
+
task :fix_editable_files => :environment do
|
48
|
+
Locomotive::Page.all.each do |page|
|
49
|
+
page.editable_elements.each_with_index do |el, index|
|
50
|
+
next if el._type != 'Locomotive::EditableFile' || el.attributes['source'].is_a?(Hash)
|
51
|
+
|
52
|
+
value = el.attributes['source']
|
53
|
+
|
54
|
+
page.collection.update({ '_id' => page._id }, { '$unset' => { "editable_elements.#{index}.content" => 1 }, '$set' => { "editable_elements.#{index}.source" => { 'en' => value } } })
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc 'Make blocks and editable_elements consistent'
|
60
|
+
task :make_editable_elements_consistent => :environment do
|
61
|
+
Locomotive::Site.all.each do |site|
|
62
|
+
# site = Locomotive::Site.find('50acd6f087f64350c9000010')
|
63
|
+
site.locales.each do |locale|
|
64
|
+
::Mongoid::Fields::I18n.locale = locale
|
65
|
+
# page = Locomotive::Page.find('50acd6f087f64350c9000012') # home page
|
66
|
+
# page = Locomotive::Page.find('50ae35ff87f643f3df0000bc') # company
|
67
|
+
site.pages.each do |page|
|
68
|
+
puts "[#{site.name}] #{page.fullpath} (#{locale})"
|
69
|
+
|
70
|
+
found_elements = []
|
71
|
+
|
72
|
+
page.template.walk do |node, memo|
|
73
|
+
case node
|
74
|
+
when Locomotive::Liquid::Tags::InheritedBlock
|
75
|
+
puts "found block ! #{node.name} --- #{memo[:parent_block_name]}"
|
76
|
+
|
77
|
+
# set the new name based on a potential parent block
|
78
|
+
name = node.name.gsub(/[\"\']/o, '')
|
79
|
+
|
80
|
+
if memo[:parent_block_name] && !name.starts_with?(memo[:parent_block_name])
|
81
|
+
name = "#{memo[:parent_block_name]}/#{name}"
|
82
|
+
end
|
83
|
+
|
84
|
+
puts "new_name = #{name}"
|
85
|
+
|
86
|
+
# retrieve all the editable elements of this block and set them the new name
|
87
|
+
page.find_editable_elements(node.name).each do |el|
|
88
|
+
# puts "**> hurray found the element #{el.block} _ #{el.slug}"
|
89
|
+
el.block = name
|
90
|
+
puts "**> hurray found the element #{el.block} _ #{el.slug} | #{page.find_editable_element(name, el.slug).present?.inspect}"
|
91
|
+
end
|
92
|
+
|
93
|
+
# assign the new name to the block
|
94
|
+
node.instance_variable_set :@name, name
|
95
|
+
|
96
|
+
# record the new parent block name for children
|
97
|
+
memo[:parent_block_name] = name
|
98
|
+
|
99
|
+
when Locomotive::Liquid::Tags::Editable::ShortText,
|
100
|
+
Locomotive::Liquid::Tags::Editable::LongText,
|
101
|
+
Locomotive::Liquid::Tags::Editable::Control,
|
102
|
+
Locomotive::Liquid::Tags::Editable::File
|
103
|
+
|
104
|
+
puts "\tfound editable_element ! #{node.slug} --- #{memo[:parent_block_name]}"
|
105
|
+
|
106
|
+
slug = node.slug.gsub(/[\"\']/o, '')
|
107
|
+
|
108
|
+
# assign the new slug to the editable element
|
109
|
+
puts "\t\t...looking for #{node.slug} inside #{memo[:parent_block_name]}"
|
110
|
+
|
111
|
+
options = node.instance_variable_get :@options
|
112
|
+
block = options[:block].blank? ? memo[:parent_block_name] : options[:block]
|
113
|
+
|
114
|
+
if el = page.find_editable_element(block, node.slug)
|
115
|
+
puts "\t\t--> yep found the element"
|
116
|
+
|
117
|
+
el.slug = slug
|
118
|
+
el.block = memo[:parent_block_name] # just to make sure
|
119
|
+
|
120
|
+
node.instance_variable_set :@slug, slug
|
121
|
+
|
122
|
+
options.delete(:block)
|
123
|
+
node.instance_variable_set :@block, nil # just to make sure
|
124
|
+
|
125
|
+
found_elements << el._id
|
126
|
+
else
|
127
|
+
puts "\t\t[WARNING] el not found (#{block} - #{slug})"
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
memo
|
133
|
+
end # page walk
|
134
|
+
|
135
|
+
puts "found elements = #{found_elements.join(', ')} / #{page.editable_elements.count}"
|
136
|
+
|
137
|
+
# "hide" useless editable elements
|
138
|
+
page.editable_elements.each do |el|
|
139
|
+
next if found_elements.include?(el._id)
|
140
|
+
el.disabled = true
|
141
|
+
end
|
142
|
+
|
143
|
+
# serialize
|
144
|
+
page.send(:_serialize_template)
|
145
|
+
|
146
|
+
# puts page.template.inspect
|
147
|
+
|
148
|
+
# save ?
|
149
|
+
page.instance_variable_set :@template_changed, false
|
150
|
+
page.save
|
151
|
+
|
152
|
+
# TODO:
|
153
|
+
# x ", block: 'Asset #1'"" ???? les re-assigner a "main" d'une facon ou d'une autre
|
154
|
+
# => en fait, ce sont des editable elements qui n'ont pas vrais blocks
|
155
|
+
# x hide useless editable elements
|
156
|
+
# x re-serializer le template
|
157
|
+
# ? skipper la methode parse (quoique pas besoin car template non modifie)
|
158
|
+
# x snippets
|
159
|
+
# x sauvegarder (sans callbacks ??)
|
160
|
+
end # loop: pages
|
161
|
+
end # loop: locales
|
162
|
+
end # loop: sites
|
163
|
+
end # task: make_editable_elements_consistent
|
164
|
+
|
165
|
+
end # namespace: upgrade
|
166
|
+
|
167
|
+
desc 'Generate the documentation about the REST API'
|
168
|
+
task :generate_api_doc => :environment do
|
169
|
+
|
170
|
+
require 'locomotive/misc/api_documentation'
|
171
|
+
|
172
|
+
output = Locomotive::Misc::ApiDocumentation.generate
|
173
|
+
|
174
|
+
path = File.join(Dir.pwd, 'public')
|
175
|
+
|
176
|
+
File.open(File.join(path, 'locomotive_api.html'), 'w') do |file|
|
177
|
+
file.write(output)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
namespace :maintenance do
|
182
|
+
|
183
|
+
desc 'Unset the translation of the editable elements for a LOCALE'
|
184
|
+
task :unset_editable_elements_translation => :environment do
|
185
|
+
if ENV['LOCALE'].blank?
|
186
|
+
puts 'LOCALE is required'
|
187
|
+
else
|
188
|
+
locale = ENV['LOCALE'].downcase
|
189
|
+
pages = ENV['SITE_ID'].blank? ? Locomotive::Page.all : Locomotive::Site.find(ENV['SITE_ID']).pages
|
190
|
+
|
191
|
+
pages.each do |page|
|
192
|
+
modifications = {}
|
193
|
+
|
194
|
+
page.editable_elements.each_with_index do |el, index|
|
195
|
+
next if ['Locomotive::EditableFile', 'Locomotive::EditableControl'].include?(el._type)
|
196
|
+
|
197
|
+
if el.locales
|
198
|
+
modifications["editable_elements.#{index}.locales"] = el.locales - [locale]
|
199
|
+
end
|
200
|
+
|
201
|
+
if el.content_translations
|
202
|
+
modifications["editable_elements.#{index}.content"] = el.content_translations.delete_if { |_locale, _| _locale == locale }
|
203
|
+
end
|
204
|
+
|
205
|
+
if el.default_content_translations
|
206
|
+
modifications["editable_elements.#{index}.default_content"] = el.default_content_translations.delete_if { |_locale, _| _locale == locale }
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# persist the modifications
|
211
|
+
unless modifications.empty?
|
212
|
+
page.collection.update({ '_id' => page._id }, { '$set' => modifications })
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|