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.
Files changed (361) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +15 -8
  3. data/app/api/locomotive/api.rb +1 -0
  4. data/app/api/locomotive/api/entities/content_entry_entity.rb +1 -0
  5. data/app/api/locomotive/api/entities/content_type_entity.rb +2 -1
  6. data/app/api/locomotive/api/entities/site_entity.rb +4 -0
  7. data/app/api/locomotive/api/entities/theme_asset_entity.rb +3 -3
  8. data/app/api/locomotive/api/forms/base_form.rb +0 -6
  9. data/app/api/locomotive/api/forms/content_type_field_form.rb +6 -10
  10. data/app/api/locomotive/api/forms/content_type_form.rb +26 -4
  11. data/app/api/locomotive/api/middlewares/params_decoder_middleware.rb +91 -0
  12. data/app/api/locomotive/api/resources/content_type_resource.rb +7 -2
  13. data/app/api/locomotive/api/resources/current_site_resource.rb +10 -2
  14. data/app/assets/images/locomotive/favicon.png +0 -0
  15. data/app/assets/javascripts/locomotive/not_logged_in.js.coffee +11 -1
  16. data/app/assets/javascripts/locomotive/views/application_view.js.coffee +0 -76
  17. data/app/assets/javascripts/locomotive/views/content_assets/edit_image_view.js.coffee +3 -1
  18. data/app/assets/javascripts/locomotive/views/dashboard/show_view.js.coffee +33 -1
  19. data/app/assets/javascripts/locomotive/views/developers_documentation/show_view.js.coffee +9 -0
  20. data/app/assets/javascripts/locomotive/views/editable_elements/edit_view.js.coffee +3 -1
  21. data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +11 -11
  22. data/app/assets/javascripts/locomotive/views/inputs/text_view.js.coffee +16 -0
  23. data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +0 -158
  24. data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +0 -41
  25. data/app/assets/javascripts/locomotive/views/public_submission_accounts/edit_view.js.coffee +7 -0
  26. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +11 -3
  27. data/app/assets/javascripts/locomotive/views/shared/list_view.js.coffee +4 -2
  28. data/app/assets/javascripts/locomotive/views/translations/index_view.js.coffee +5 -0
  29. data/app/assets/stylesheets/locomotive/application.scss +4 -0
  30. data/app/assets/stylesheets/locomotive/base/_fonts.scss +5 -5
  31. data/app/assets/stylesheets/locomotive/base/form/_base.scss +9 -1
  32. data/app/assets/stylesheets/locomotive/components/_activity_feed.scss +66 -0
  33. data/app/assets/stylesheets/locomotive/components/_content_assets.scss +27 -8
  34. data/app/assets/stylesheets/locomotive/components/_developers.scss +34 -0
  35. data/app/assets/stylesheets/locomotive/components/_error.scss +37 -0
  36. data/app/assets/stylesheets/locomotive/components/_list.scss +6 -0
  37. data/app/assets/stylesheets/locomotive/components/_main.scss +4 -0
  38. data/app/assets/stylesheets/locomotive/components/_misc.scss +1 -0
  39. data/app/assets/stylesheets/locomotive/components/_translations.scss +13 -0
  40. data/app/assets/stylesheets/locomotive/components/header/_base.scss +7 -2
  41. data/app/assets/stylesheets/locomotive/components/misc/_modal.scss +13 -0
  42. data/app/assets/stylesheets/locomotive/components/misc/_notify.scss +2 -2
  43. data/app/assets/stylesheets/locomotive/components/not_logged_in/_sign_in_and_up.scss +11 -1
  44. data/app/assets/stylesheets/locomotive/components/sidebar/_pages_tree.scss +2 -2
  45. data/app/assets/stylesheets/locomotive/error.scss +12 -0
  46. data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +1 -1
  47. data/app/assets/stylesheets/locomotive/globals/_mixins.scss +8 -4
  48. data/app/assets/stylesheets/locomotive/globals/_variables.scss +2 -0
  49. data/app/assets/stylesheets/locomotive/not_logged_in.scss +4 -0
  50. data/app/controllers/locomotive/accounts_controller.rb +6 -1
  51. data/app/controllers/locomotive/base_controller.rb +1 -1
  52. data/app/controllers/locomotive/concerns/exception_controller.rb +2 -1
  53. data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +2 -1
  54. data/app/controllers/locomotive/content_assets_controller.rb +2 -2
  55. data/app/controllers/locomotive/content_entries_controller.rb +2 -2
  56. data/app/controllers/locomotive/current_site_controller.rb +5 -1
  57. data/app/controllers/locomotive/custom_fields/select_options_controller.rb +1 -1
  58. data/app/controllers/locomotive/dashboard_controller.rb +2 -0
  59. data/app/controllers/locomotive/developers_documentation_controller.rb +11 -0
  60. data/app/controllers/locomotive/editable_elements_controller.rb +11 -10
  61. data/app/controllers/locomotive/errors_controller.rb +15 -0
  62. data/app/controllers/locomotive/pages_controller.rb +3 -3
  63. data/app/controllers/locomotive/public_submission_accounts_controller.rb +42 -0
  64. data/app/controllers/locomotive/translations_controller.rb +9 -23
  65. data/app/helpers/locomotive/base_helper.rb +25 -23
  66. data/app/helpers/locomotive/content_assets_helper.rb +8 -0
  67. data/app/helpers/locomotive/content_entries_helper.rb +13 -19
  68. data/app/helpers/locomotive/content_types_helper.rb +9 -12
  69. data/app/helpers/locomotive/custom_fields_helper.rb +1 -0
  70. data/app/helpers/locomotive/dashboard_helper.rb +91 -0
  71. data/app/helpers/locomotive/developers_documentation_helper.rb +32 -0
  72. data/app/helpers/locomotive/editable_elements_helper.rb +25 -14
  73. data/app/helpers/locomotive/errors_helper.rb +21 -0
  74. data/app/helpers/locomotive/my_account_helper.rb +10 -8
  75. data/app/helpers/locomotive/pages_helper.rb +1 -1
  76. data/app/helpers/locomotive/public_submission_accounts_helper.rb +11 -0
  77. data/app/helpers/locomotive/shared/accounts_helper.rb +2 -2
  78. data/app/helpers/locomotive/sites_helper.rb +15 -11
  79. data/app/helpers/locomotive/translations_helper.rb +21 -13
  80. data/app/inputs/locomotive/api_key_input.rb +2 -0
  81. data/app/inputs/locomotive/array_input.rb +8 -3
  82. data/app/inputs/locomotive/code_input.rb +1 -47
  83. data/app/inputs/locomotive/document_picker_input.rb +1 -0
  84. data/app/inputs/locomotive/rte_input.rb +2 -0
  85. data/app/inputs/locomotive/toggle_input.rb +2 -0
  86. data/app/models/locomotive/activity.rb +32 -0
  87. data/app/models/locomotive/concerns/content_entry/localized.rb +12 -1
  88. data/app/models/locomotive/concerns/content_type/entry_template.rb +52 -0
  89. data/app/models/locomotive/concerns/page/editable_elements.rb +0 -111
  90. data/app/models/locomotive/concerns/page/layout.rb +21 -6
  91. data/app/models/locomotive/concerns/site/access_points.rb +24 -3
  92. data/app/models/locomotive/concerns/site/locales.rb +7 -27
  93. data/app/models/locomotive/content_asset.rb +0 -4
  94. data/app/models/locomotive/content_entry.rb +10 -8
  95. data/app/models/locomotive/content_type.rb +12 -1
  96. data/app/models/locomotive/editable_element.rb +11 -106
  97. data/app/models/locomotive/editable_file.rb +6 -53
  98. data/app/models/locomotive/editable_model.rb +13 -0
  99. data/app/models/locomotive/editable_text.rb +0 -51
  100. data/app/models/locomotive/page.rb +31 -17
  101. data/app/models/locomotive/site.rb +12 -13
  102. data/app/models/locomotive/theme_asset.rb +0 -4
  103. data/app/models/locomotive/translation.rb +50 -35
  104. data/app/policies/locomotive/content_type_policy.rb +4 -0
  105. data/app/policies/locomotive/site_policy.rb +4 -0
  106. data/app/services/locomotive/concerns/activity_service.rb +27 -0
  107. data/app/services/locomotive/content_asset_service.rb +16 -2
  108. data/app/services/locomotive/content_entry_service.rb +77 -8
  109. data/app/services/locomotive/content_type_service.rb +6 -2
  110. data/app/services/locomotive/editable_element_service.rb +11 -4
  111. data/app/services/locomotive/membership_service.rb +20 -4
  112. data/app/services/locomotive/page_parsing_service.rb +94 -23
  113. data/app/services/locomotive/page_service.rb +61 -3
  114. data/app/services/locomotive/site_service.rb +43 -1
  115. data/app/services/locomotive/translation_service.rb +51 -0
  116. data/app/uploaders/locomotive/picture_uploader.rb +5 -1
  117. data/app/views/locomotive/accounts/{new.html.haml → new.html.slim} +0 -0
  118. data/app/views/locomotive/content_assets/{_dropzone.html.haml → _dropzone.html.slim} +4 -3
  119. data/app/views/locomotive/content_assets/{_list.html.haml → _list.html.slim} +11 -9
  120. data/app/views/locomotive/content_assets/{_nav.html.haml → _nav.html.slim} +5 -5
  121. data/app/views/locomotive/content_assets/{_search_form.html.haml → _search_form.html.slim} +1 -1
  122. data/app/views/locomotive/content_assets/edit_in_drawer.html.slim +27 -0
  123. data/app/views/locomotive/content_assets/{index.html.haml → index.html.slim} +4 -4
  124. data/app/views/locomotive/content_assets/{index_in_drawer.html.haml → index_in_drawer.html.slim} +1 -1
  125. data/app/views/locomotive/content_entries/{_entry.html.haml → _entry.html.slim} +3 -3
  126. data/app/views/locomotive/content_entries/{_list.html.haml → _list.html.slim} +9 -8
  127. data/app/views/locomotive/content_entries/{edit.html.haml → edit.html.slim} +5 -0
  128. data/app/views/locomotive/content_entries/form/{_actions.html.haml → _actions.html.slim} +0 -0
  129. data/app/views/locomotive/content_entries/form/{_advanced.html.haml → _advanced.html.slim} +0 -0
  130. data/app/views/locomotive/content_entries/form/{_main.html.haml → _main.html.slim} +0 -0
  131. data/app/views/locomotive/content_entries/form/{_panes.html.haml → _panes.html.slim} +0 -0
  132. data/app/views/locomotive/content_entries/form/{_seo.html.haml → _seo.html.slim} +0 -0
  133. data/app/views/locomotive/content_entries/form/_tabs.html.slim +13 -0
  134. data/app/views/locomotive/content_entries/{index.html.haml → index.html.slim} +22 -9
  135. data/app/views/locomotive/content_entries/{new.html.haml → new.html.slim} +0 -0
  136. data/app/views/locomotive/current_site/{_domain.html.haml → _domain.html.slim} +3 -3
  137. data/app/views/locomotive/current_site/{_locale.html.haml → _locale.html.slim} +4 -4
  138. data/app/views/locomotive/current_site/{_membership.html.haml → _membership.html.slim} +7 -6
  139. data/app/views/locomotive/current_site/{edit.html.haml → edit.html.slim} +1 -1
  140. data/app/views/locomotive/current_site/form/{_access_points.html.haml → _access_points.html.slim} +1 -0
  141. data/app/views/locomotive/current_site/form/{_advanced.html.haml → _advanced.html.slim} +0 -0
  142. data/app/views/locomotive/current_site/form/{_main.html.haml → _main.html.slim} +0 -0
  143. data/app/views/locomotive/current_site/form/{_panes.html.haml → _panes.html.slim} +0 -0
  144. data/app/views/locomotive/current_site/form/{_seo.html.haml → _seo.html.slim} +0 -0
  145. data/app/views/locomotive/current_site/form/_tabs.html.slim +14 -0
  146. data/app/views/locomotive/custom_fields/select_options/{_option.html.haml → _option.html.slim} +7 -7
  147. data/app/views/locomotive/custom_fields/select_options/{edit.html.haml → edit.html.slim} +0 -0
  148. data/app/views/locomotive/dashboard/show.html.slim +28 -0
  149. data/app/views/locomotive/developers_documentation/_api.html.slim +44 -0
  150. data/app/views/locomotive/developers_documentation/_wagon.html.slim +42 -0
  151. data/app/views/locomotive/developers_documentation/show.html.slim +11 -0
  152. data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +12 -0
  153. data/app/views/locomotive/editable_elements/_edit.html.slim +52 -0
  154. data/app/views/locomotive/editable_elements/{_form.html.haml → _form.html.slim} +12 -3
  155. data/app/views/locomotive/editable_elements/index.html.slim +8 -0
  156. data/app/views/locomotive/editable_elements/{index_without_preview.html.haml → index_without_preview.html.slim} +5 -4
  157. data/app/views/locomotive/errors/404.html.slim +2 -0
  158. data/app/views/locomotive/errors/500.html.slim +2 -0
  159. data/app/views/locomotive/errors/no_site.html.slim +7 -0
  160. data/app/views/locomotive/layouts/application.html.slim +42 -0
  161. data/app/views/locomotive/layouts/error.html.slim +24 -0
  162. data/app/views/locomotive/layouts/{live_editing.html.haml → live_editing.html.slim} +10 -10
  163. data/app/views/locomotive/layouts/not_logged_in.html.slim +26 -0
  164. data/app/views/locomotive/layouts/{without_site.html.haml → without_site.html.slim} +9 -6
  165. data/app/views/locomotive/memberships/{edit.html.haml → edit.html.slim} +0 -0
  166. data/app/views/locomotive/memberships/{new.html.haml → new.html.slim} +0 -0
  167. data/app/views/locomotive/my_account/{edit.html.haml → edit.html.slim} +1 -1
  168. data/app/views/locomotive/my_account/form/{_actions.html.haml → _actions.html.slim} +0 -0
  169. data/app/views/locomotive/my_account/form/{_api.html.haml → _api.html.slim} +0 -1
  170. data/app/views/locomotive/my_account/form/{_credentials.html.haml → _credentials.html.slim} +0 -0
  171. data/app/views/locomotive/my_account/form/{_main.html.haml → _main.html.slim} +0 -0
  172. data/app/views/locomotive/my_account/form/{_panes.html.haml → _panes.html.slim} +1 -1
  173. data/app/views/locomotive/my_account/form/_tabs.html.slim +7 -0
  174. data/app/views/locomotive/notifications/{new_content_entry.html.haml → new_content_entry.html.slim} +11 -11
  175. data/app/views/locomotive/pages/{edit.html.haml → edit.html.slim} +0 -0
  176. data/app/views/locomotive/pages/form/{_actions.html.haml → _actions.html.slim} +0 -0
  177. data/app/views/locomotive/pages/form/{_main.html.haml → _main.html.slim} +0 -0
  178. data/app/views/locomotive/pages/form/{_panes.html.haml → _panes.html.slim} +0 -0
  179. data/app/views/locomotive/pages/form/{_seo.html.haml → _seo.html.slim} +0 -0
  180. data/app/views/locomotive/pages/form/{_tabs.html.haml → _tabs.html.slim} +1 -1
  181. data/app/views/locomotive/pages/{new.html.haml → new.html.slim} +0 -0
  182. data/app/views/locomotive/pages/show.html.slim +2 -0
  183. data/app/views/locomotive/passwords/{edit.html.haml → edit.html.slim} +6 -6
  184. data/app/views/locomotive/passwords/{new.html.haml → new.html.slim} +6 -6
  185. data/app/views/locomotive/public_submission_accounts/_account.html.slim +19 -0
  186. data/app/views/locomotive/public_submission_accounts/edit.html.slim +16 -0
  187. data/app/views/locomotive/registrations/{new.html.haml → new.html.slim} +2 -4
  188. data/app/views/locomotive/sessions/{new.html.haml → new.html.slim} +2 -4
  189. data/app/views/locomotive/shared/_footer.html.slim +2 -0
  190. data/app/views/locomotive/shared/{_form_actions.html.haml → _form_actions.html.slim} +4 -4
  191. data/app/views/locomotive/shared/_head.html.slim +39 -0
  192. data/app/views/locomotive/shared/{_header.html.haml → _header.html.slim} +10 -10
  193. data/app/views/locomotive/shared/_locale_picker_link.html.slim +11 -0
  194. data/app/views/locomotive/shared/{_main_app_head.html.haml → _main_app_head.html.slim} +0 -0
  195. data/app/views/locomotive/shared/{_main_app_head_before_backbone.html.haml → _main_app_head_before_backbone.html.slim} +0 -0
  196. data/app/views/locomotive/shared/{_main_app_header.html.haml → _main_app_header.html.slim} +0 -0
  197. data/app/views/locomotive/shared/{_sidebar.html.haml → _sidebar.html.slim} +6 -0
  198. data/app/views/locomotive/shared/{_sidebar_without_site.html.haml → _sidebar_without_site.html.slim} +0 -0
  199. data/app/views/locomotive/shared/actions/{_contents.html.haml → _contents.html.slim} +1 -1
  200. data/app/views/locomotive/shared/header/{_account.html.haml → _account.html.slim} +1 -1
  201. data/app/views/locomotive/shared/header/_account_menu.html.slim +5 -0
  202. data/app/views/locomotive/shared/header/_brand.html.slim +5 -0
  203. data/app/views/locomotive/shared/header/{_site.html.haml → _site.html.slim} +2 -2
  204. data/app/views/locomotive/shared/rte/{_image_popover.html.haml → _image_popover.html.slim} +5 -5
  205. data/app/views/locomotive/shared/rte/{_link_popover.html.haml → _link_popover.html.slim} +5 -5
  206. data/app/views/locomotive/shared/rte/_toolbar.html.slim +62 -0
  207. data/app/views/locomotive/shared/sidebar/_content_types.html.slim +16 -0
  208. data/app/views/locomotive/shared/sidebar/_link.html.slim +10 -0
  209. data/app/views/locomotive/shared/sidebar/{_my_account.html.haml → _my_account.html.slim} +2 -2
  210. data/app/views/locomotive/shared/sidebar/_page.html.slim +33 -0
  211. data/app/views/locomotive/shared/sidebar/_pages.html.slim +11 -0
  212. data/app/views/locomotive/sites/{_site.html.haml → _site.html.slim} +3 -3
  213. data/app/views/locomotive/sites/{index.html.haml → index.html.slim} +3 -3
  214. data/app/views/locomotive/sites/{new.html.haml → new.html.slim} +0 -0
  215. data/app/views/locomotive/translations/_form.html.slim +9 -0
  216. data/app/views/locomotive/translations/edit.html.slim +7 -0
  217. data/app/views/locomotive/translations/index.html.slim +41 -0
  218. data/config/initializers/slim.rb +1 -0
  219. data/config/initializers/time_format.rb +15 -0
  220. data/config/locales/admin_ui.en.yml +65 -49
  221. data/config/locales/default.en.yml +3 -0
  222. data/config/locales/default.fr.yml +4 -1
  223. data/config/locales/simple_form.en.yml +14 -8
  224. data/config/routes.rb +6 -0
  225. data/features/support/env.rb +1 -1
  226. data/lib/generators/locomotive/install/install_generator.rb +48 -0
  227. data/lib/generators/locomotive/install/templates/heroku.rb +29 -0
  228. data/lib/generators/locomotive/install/templates/locomotive.rb +5 -2
  229. data/lib/generators/locomotive/install/templates/mongoid.yml +1 -1
  230. data/lib/generators/locomotive/install/templates/mongoid_heroku.yml +78 -0
  231. data/lib/locomotive.rb +0 -1
  232. data/lib/locomotive/configuration.rb +2 -6
  233. data/lib/locomotive/dependencies.rb +1 -2
  234. data/lib/locomotive/dragonfly.rb +4 -5
  235. data/lib/locomotive/engine.rb +10 -13
  236. data/lib/locomotive/middlewares.rb +0 -1
  237. data/lib/locomotive/middlewares/custom_public_exceptions.rb +19 -0
  238. data/lib/locomotive/middlewares/site.rb +49 -16
  239. data/lib/locomotive/simple_form.rb +67 -26
  240. data/lib/locomotive/steam/middlewares/missing_translations.rb +48 -0
  241. data/lib/locomotive/steam/middlewares/page_editing.rb +48 -0
  242. data/lib/locomotive/steam/services/api_entry_submission_service.rb +38 -0
  243. data/lib/locomotive/steam_adaptor.rb +25 -6
  244. data/lib/locomotive/version.rb +1 -1
  245. data/lib/tasks/locomotive.rake +27 -47
  246. data/spec/dummy/app/views/foo/index.html.slim +1 -0
  247. data/spec/dummy/app/views/locomotive/shared/{_main_app_head.html.haml → _main_app_head.html.slim} +0 -0
  248. data/spec/dummy/config.ru +4 -0
  249. data/spec/dummy/config/application.rb +4 -0
  250. data/spec/dummy/config/environments/profile.rb +48 -0
  251. data/spec/dummy/config/mongoid.yml +6 -6
  252. data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +39 -0
  253. data/spec/models/locomotive/concerns/content_type/entry_template_spec.rb +55 -0
  254. data/spec/models/locomotive/concerns/page/layout_spec.rb +2 -2
  255. data/spec/models/locomotive/concerns/site/access_points_spec.rb +87 -2
  256. data/spec/models/locomotive/concerns/site/locales_spec.rb +2 -3
  257. data/spec/models/locomotive/content_entry_spec.rb +22 -37
  258. data/spec/models/locomotive/page_spec.rb +11 -0
  259. data/spec/models/locomotive/site_spec.rb +0 -36
  260. data/spec/requests/site_spec.rb +28 -0
  261. data/spec/support/capybara.rb +27 -0
  262. data/spec/support/factories.rb +9 -0
  263. data/spec/support/features/session_helpers.rb +21 -0
  264. data/spec/support/locomotive.rb +0 -4
  265. data/spec/support/matchers.rb +0 -25
  266. data/vendor/assets/javascripts/locomotive/highlight.pack.js +1 -0
  267. data/vendor/assets/stylesheets/locomotive/highlightjs/default.css +155 -0
  268. data/vendor/assets/stylesheets/locomotive/highlightjs/github.css +123 -0
  269. metadata +179 -195
  270. data/app/assets/images/locomotive/background/body.png +0 -0
  271. data/app/assets/images/locomotive/form/error-arrow.png +0 -0
  272. data/app/assets/images/locomotive/form/input-sep.png +0 -0
  273. data/app/assets/images/locomotive/icons/start.png +0 -0
  274. data/app/assets/images/locomotive/list/empty.png +0 -0
  275. data/app/assets/images/locomotive/list/item-left.png +0 -0
  276. data/app/assets/images/locomotive/nocoffee.png +0 -0
  277. data/app/assets/images/locomotive/plugins/sites_picker_top_arrow.png +0 -0
  278. data/app/assets/images/locomotive/rails.png +0 -0
  279. data/app/assets/javascripts/locomotive/views/pages/index_view.js.coffee +0 -11
  280. data/app/cells/locomotive/content_locale_picker/show.html.haml +0 -7
  281. data/app/cells/locomotive/content_locale_picker_cell.rb +0 -21
  282. data/app/helpers/locomotive/installation_helper.rb +0 -9
  283. data/app/inputs/locomotive/locale_input.rb +0 -41
  284. data/app/inputs/locomotive/small_code_input.rb +0 -23
  285. data/app/models/locomotive/concerns/content_entry/notifications.rb +0 -33
  286. data/app/models/locomotive/concerns/content_type/item_template.rb +0 -49
  287. data/app/models/locomotive/concerns/page/parse.rb +0 -133
  288. data/app/presenters/locomotive/account_presenter.rb +0 -20
  289. data/app/presenters/locomotive/base_presenter.rb +0 -144
  290. data/app/presenters/locomotive/content_asset_presenter.rb +0 -51
  291. data/app/presenters/locomotive/content_entry_presenter.rb +0 -177
  292. data/app/presenters/locomotive/content_field_presenter.rb +0 -76
  293. data/app/presenters/locomotive/content_type_presenter.rb +0 -82
  294. data/app/presenters/locomotive/editable_control_presenter.rb +0 -19
  295. data/app/presenters/locomotive/editable_element_presenter.rb +0 -46
  296. data/app/presenters/locomotive/editable_file_presenter.rb +0 -36
  297. data/app/presenters/locomotive/editable_text_presenter.rb +0 -40
  298. data/app/presenters/locomotive/membership_presenter.rb +0 -35
  299. data/app/presenters/locomotive/page_presenter.rb +0 -81
  300. data/app/presenters/locomotive/site_presenter.rb +0 -40
  301. data/app/presenters/locomotive/snippet_presenter.rb +0 -22
  302. data/app/presenters/locomotive/theme_asset_presenter.rb +0 -61
  303. data/app/presenters/locomotive/translation_presenter.rb +0 -9
  304. data/app/views/locomotive/content_assets/edit_in_drawer.html.haml +0 -26
  305. data/app/views/locomotive/content_entries/form/_tabs.html.haml +0 -9
  306. data/app/views/locomotive/current_site/form/_tabs.html.haml +0 -14
  307. data/app/views/locomotive/dashboard/show.html.haml +0 -0
  308. data/app/views/locomotive/devise_mailer/reset_password_instructions.html.haml +0 -12
  309. data/app/views/locomotive/editable_elements/_edit.html.haml +0 -49
  310. data/app/views/locomotive/editable_elements/_edit_with_content_entry.html.haml +0 -21
  311. data/app/views/locomotive/editable_elements/index.html.haml +0 -8
  312. data/app/views/locomotive/errors/404.html.haml +0 -7
  313. data/app/views/locomotive/errors/500.html.haml +0 -7
  314. data/app/views/locomotive/errors/no_page.html.haml +0 -1
  315. data/app/views/locomotive/errors/no_site.html.haml +0 -1
  316. data/app/views/locomotive/layouts/application.html.haml +0 -42
  317. data/app/views/locomotive/layouts/error.html.haml +0 -1
  318. data/app/views/locomotive/layouts/not_logged_in.html.haml +0 -18
  319. data/app/views/locomotive/my_account/form/_tabs.html.haml +0 -7
  320. data/app/views/locomotive/pages/_editable_elements.html.haml +0 -64
  321. data/app/views/locomotive/pages/index.html.haml +0 -22
  322. data/app/views/locomotive/pages/show.html.haml +0 -2
  323. data/app/views/locomotive/shared/_footer.html.haml +0 -2
  324. data/app/views/locomotive/shared/_head.html.haml +0 -40
  325. data/app/views/locomotive/shared/_locale_picker_link.html.haml +0 -6
  326. data/app/views/locomotive/shared/header/_account_menu.html.haml +0 -5
  327. data/app/views/locomotive/shared/header/_brand.html.haml +0 -4
  328. data/app/views/locomotive/shared/rte/_toolbar.html.haml +0 -62
  329. data/app/views/locomotive/shared/sidebar/_content_types.html.haml +0 -15
  330. data/app/views/locomotive/shared/sidebar/_link.html.haml +0 -10
  331. data/app/views/locomotive/shared/sidebar/_page.html.haml +0 -33
  332. data/app/views/locomotive/shared/sidebar/_pages.html.haml +0 -11
  333. data/app/views/locomotive/translations/_form.html.haml +0 -12
  334. data/app/views/locomotive/translations/edit.html.haml +0 -15
  335. data/app/views/locomotive/translations/index.html.haml +0 -30
  336. data/app/views/locomotive/translations/new.html.haml +0 -12
  337. data/config/initializers/haml.rb +0 -2
  338. data/config/initializers/locomotive_loaded_first.rb +0 -19
  339. data/config/locales/formtastic.bg.yml +0 -113
  340. data/config/locales/formtastic.cs.yml +0 -125
  341. data/config/locales/formtastic.de.yml +0 -106
  342. data/config/locales/formtastic.es.yml +0 -84
  343. data/config/locales/formtastic.et.yml +0 -103
  344. data/config/locales/formtastic.fr.yml +0 -109
  345. data/config/locales/formtastic.it.yml +0 -99
  346. data/config/locales/formtastic.ja.yml +0 -103
  347. data/config/locales/formtastic.nb.yml +0 -103
  348. data/config/locales/formtastic.nl.yml +0 -85
  349. data/config/locales/formtastic.pl.yml +0 -105
  350. data/config/locales/formtastic.pt-BR.yml +0 -70
  351. data/config/locales/formtastic.pt.yml +0 -70
  352. data/config/locales/formtastic.ru.yml +0 -106
  353. data/config/locales/formtastic.sk.yml +0 -125
  354. data/config/locales/formtastic.sr.yml +0 -112
  355. data/config/locales/formtastic.zh-CN.yml +0 -112
  356. data/lib/locomotive/haml.rb +0 -1
  357. data/lib/locomotive/middlewares/page_editing.rb +0 -41
  358. data/spec/dummy/app/views/foo/index.html.haml +0 -1
  359. data/spec/dummy/config/initializers/haml.rb +0 -2
  360. data/spec/support/asset_host_stubs.rb +0 -17
  361. data/spec/support/controller.rb +0 -32
@@ -50,6 +50,7 @@ $form_input_hovered_background_color: #f7f8d1;
50
50
  $form_input_padding: 15px;
51
51
  $form_input_radius: 4px;
52
52
  $form_input_label_color: #555;
53
+ $form_input_label_untranslated_color: #f89406;
53
54
  $form_input_label_size: 11px;
54
55
  $form_input_control_border_size: 4px;
55
56
  $form_input_control_border_color: #d7d7d7;
@@ -99,6 +100,7 @@ $asset_border_radius: 4px;
99
100
  $asset_width: 240px;
100
101
  $asset_height: 240px;
101
102
  $asset_title_color: #333;
103
+ $asset_size_color: #aaa;
102
104
  $asset_thumbnail_background: #d7d7d7;
103
105
  $asset_thumbnail_border_radius: 4px;
104
106
  $asset_thumbnail_img_border: 2px solid #acacac;
@@ -1,3 +1,6 @@
1
+ @import "font-awesome-sprockets";
2
+ @import "font-awesome";
3
+
1
4
  @import "./globals/bootstrap";
2
5
  @import "bootstrap";
3
6
 
@@ -6,6 +9,7 @@
6
9
 
7
10
  @import "layouts/not_logged_in";
8
11
 
12
+ @import "components/misc/notify";
9
13
  @import "components/not_logged_in/sign_in_and_up";
10
14
  @import "components/not_logged_in/passwords";
11
15
 
@@ -12,7 +12,7 @@ module Locomotive
12
12
  def create
13
13
  authorize Membership
14
14
  @account = Account.create(account_params)
15
- current_site.memberships.create(account: @account) if @account.errors.empty?
15
+ service.create(@account) if @account.errors.empty?
16
16
  respond_with @account, location: edit_current_site_path(current_site)
17
17
  end
18
18
 
@@ -22,5 +22,10 @@ module Locomotive
22
22
  params.require(:account).permit(:email, :name, :locale, :password, :password_confirmation)
23
23
  end
24
24
 
25
+ def service
26
+ policy = MembershipPolicy.new(pundit_user, @membership || Membership)
27
+ @service ||= Locomotive::MembershipService.new(current_site, policy)
28
+ end
29
+
25
30
  end
26
31
  end
@@ -14,7 +14,7 @@ module Locomotive
14
14
 
15
15
  before_filter :require_ssl
16
16
 
17
- helper Locomotive::BaseHelper
17
+ helper Locomotive::BaseHelper, Locomotive::ErrorsHelper
18
18
 
19
19
  self.responder = Locomotive::ActionController::Responder # custom responder
20
20
 
@@ -16,7 +16,8 @@ module Locomotive
16
16
  status = (case exception
17
17
  when ::Mongoid::Errors::DocumentNotFound then 404
18
18
  else
19
- raise exception # 500
19
+ raise exception unless request.xhr?
20
+ 500
20
21
  end)
21
22
 
22
23
  if request.xhr?
@@ -29,7 +29,8 @@ module Locomotive
29
29
  def render_no_site_error
30
30
  respond_to do |format|
31
31
  format.html do
32
- render template: '/locomotive/errors/no_site', layout: false, status: :not_found
32
+ @title = t(:title, scope: 'locomotive.errors.no_site')
33
+ render template: '/locomotive/errors/no_site', layout: 'locomotive/layouts/error', status: :not_found
33
34
  end
34
35
  format.json do
35
36
  render json: { error: 'No site found' }, status: :not_found
@@ -35,7 +35,7 @@ module Locomotive
35
35
 
36
36
  def destroy
37
37
  authorize @content_asset
38
- @content_asset.destroy
38
+ service.destroy(@content_asset)
39
39
  respond_with(@content_asset) do |format|
40
40
  format.html do
41
41
  if request.xhr?
@@ -67,7 +67,7 @@ module Locomotive
67
67
  end
68
68
 
69
69
  def service
70
- @service ||= Locomotive::ContentAssetService.new(current_site)
70
+ @service ||= Locomotive::ContentAssetService.new(current_site, current_locomotive_account)
71
71
  end
72
72
 
73
73
  def content_asset_params
@@ -69,12 +69,12 @@ module Locomotive
69
69
  def sort
70
70
  authorize ContentEntry, :update?
71
71
  service.sort(params[:entries])
72
- respond_with @content_type
72
+ respond_with @content_type, location: content_entries_path(current_site, @content_type.slug)
73
73
  end
74
74
 
75
75
  def destroy
76
76
  authorize @content_entry
77
- @content_entry.destroy
77
+ service.destroy(@content_entry)
78
78
  respond_with @content_entry, location: content_entries_path(current_site, @content_type.slug)
79
79
  end
80
80
 
@@ -18,7 +18,7 @@ module Locomotive
18
18
 
19
19
  def update
20
20
  authorize @site
21
- @site.update_attributes(site_params)
21
+ service.update(@site, site_params)
22
22
  respond_with @site, location: -> { edit_current_site_path(current_site) }
23
23
  end
24
24
 
@@ -54,6 +54,10 @@ module Locomotive
54
54
  params.require(:site).permit(*policy(@site || Site).permitted_attributes)
55
55
  end
56
56
 
57
+ def service
58
+ @service ||= Locomotive::SiteService.new(current_locomotive_account)
59
+ end
60
+
57
61
  def ensure_domains_list
58
62
  params[:site][:domains] = [] unless params[:site][:domains]
59
63
  end
@@ -38,7 +38,7 @@ module Locomotive
38
38
  end
39
39
 
40
40
  def options_params
41
- params.require(:select_options).map { |p| p.permit(:_id, :name, :_destroyed) }
41
+ params.require(:select_options).map { |p| p.permit(:_id, :name, :_destroy) }
42
42
  end
43
43
 
44
44
  def option_name_param
@@ -4,6 +4,8 @@ module Locomotive
4
4
  account_required & within_site
5
5
 
6
6
  def show
7
+ @activities = current_site.activities.order_by(:created_at.desc).page(params[:page]).per(Locomotive.config.ui[:per_page])
8
+ respond_with @activities, layout: !request.xhr?
7
9
  end
8
10
 
9
11
  end
@@ -0,0 +1,11 @@
1
+ module Locomotive
2
+ class DevelopersDocumentationController < BaseController
3
+
4
+ account_required & within_site
5
+
6
+ def show
7
+ authorize(current_site, :show_developers_documentation?)
8
+ end
9
+
10
+ end
11
+ end
@@ -41,19 +41,12 @@ module Locomotive
41
41
  end
42
42
 
43
43
  def page_params
44
- params.require(:page).permit(editable_elements_attributes: [:id, :page_id, :source, :remove_source, :remote_source_url, :content])
45
- end
46
-
47
- def parsing_service
48
- @parsing_service ||= Locomotive::PageParsingService.new(current_site, current_content_locale)
49
- end
50
-
51
- def persisting_service
52
- @persisting_service ||= Locomotive::EditableElementService.new(current_site, current_locomotive_account)
44
+ params.require(:page).permit(editable_elements_attributes: [:id, :_id, :page_id, :source, :remove_source, :remote_source_url, :content])
53
45
  end
54
46
 
55
47
  def render_index
56
- @editable_elements_by_block = @editable_elements.group_by { |(_, e)| e.block }
48
+ @editable_elements_by_block = parsing_service.group_and_sort_editable_elements(@editable_elements)
49
+ @blocks = parsing_service.blocks_from_grouped_editable_elements(@editable_elements_by_block)
57
50
 
58
51
  @content_entry = @page.content_type.entries.find(params[:content_entry_id]) if params[:content_entry_id]
59
52
 
@@ -64,6 +57,14 @@ module Locomotive
64
57
  end
65
58
  end
66
59
 
60
+ def parsing_service
61
+ @parsing_service ||= Locomotive::PageParsingService.new(current_site, current_content_locale)
62
+ end
63
+
64
+ def persisting_service
65
+ @persisting_service ||= Locomotive::EditableElementService.new(current_site, current_locomotive_account)
66
+ end
67
+
67
68
  def store_location_if_content_entry
68
69
  store_location if @content_entry
69
70
  end
@@ -0,0 +1,15 @@
1
+ module Locomotive
2
+ class ErrorsController < ApplicationController
3
+
4
+ layout '/locomotive/layouts/error'
5
+
6
+ def error_404
7
+ render '404', status: :not_found
8
+ end
9
+
10
+ def error_500
11
+ render '500', status: :internal_server_error
12
+ end
13
+
14
+ end
15
+ end
@@ -36,13 +36,13 @@ module Locomotive
36
36
 
37
37
  def destroy
38
38
  authorize @page
39
- @page.destroy
39
+ service.destroy(@page)
40
40
  respond_with @page, location: editable_elements_path(current_site, current_site.pages.root.first)
41
41
  end
42
42
 
43
43
  def sort
44
44
  authorize @page, :update?
45
- @page.sort_children!(params.require(:children))
45
+ service.sort(@page, params.require(:children))
46
46
  respond_with @page, location: edit_page_path(current_site, @page)
47
47
  end
48
48
 
@@ -57,7 +57,7 @@ module Locomotive
57
57
  end
58
58
 
59
59
  def service
60
- @service ||= Locomotive::PageService.new(current_site)
60
+ @service ||= Locomotive::PageService.new(current_site, current_locomotive_account)
61
61
  end
62
62
 
63
63
  end
@@ -0,0 +1,42 @@
1
+ module Locomotive
2
+ class PublicSubmissionAccountsController < BaseController
3
+
4
+ account_required & within_site
5
+
6
+ before_filter :load_content_type
7
+
8
+ def edit
9
+ authorize @content_type
10
+ respond_with @content_type
11
+ end
12
+
13
+ def update
14
+ authorize @content_type
15
+ service.update(@content_type, content_type_params)
16
+ respond_with @content_type, location: content_entries_path(current_site, @content_type.slug)
17
+ end
18
+
19
+ def new_account
20
+ if params[:public_submission_account].present?
21
+ render partial: 'account', locals: { public_submission_account: params[:public_submission_account] }
22
+ else
23
+ head :unprocessable_entity
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def load_content_type
30
+ @content_type ||= current_site.content_types.where(slug: params[:slug]).first
31
+ end
32
+
33
+ def service
34
+ @service ||= Locomotive::ContentTypeService.new(current_site)
35
+ end
36
+
37
+ def content_type_params
38
+ params.require(:content_type).permit(public_submission_accounts: [])
39
+ end
40
+
41
+ end
42
+ end
@@ -3,26 +3,14 @@ module Locomotive
3
3
 
4
4
  account_required & within_site
5
5
 
6
- before_filter :load_translation, only: [:edit, :update, :destroy]
6
+ before_filter :load_translation, only: [:edit, :update]
7
7
 
8
8
  def index
9
9
  authorize ThemeAsset
10
- @translations = current_site.translations.ordered.page(params[:page]).per(Locomotive.config.ui[:per_page])
10
+ @translations = service.all(params.slice(:page, :per_page, :q, :filter_by))
11
11
  respond_with @translations
12
12
  end
13
13
 
14
- def new
15
- authorize ThemeAsset
16
- @translation = current_site.translations.build
17
- respond_with @translation
18
- end
19
-
20
- def create
21
- authorize ThemeAsset
22
- @translation = current_site.translations.create(translation_params)
23
- respond_with @translation, location: translations_path(current_site)
24
- end
25
-
26
14
  def edit
27
15
  authorize @translation
28
16
  respond_with @translation
@@ -30,14 +18,8 @@ module Locomotive
30
18
 
31
19
  def update
32
20
  authorize @translation
33
- @translation.update_attributes(translation_params)
34
- respond_with @translation, location: translations_path(current_site)
35
- end
36
-
37
- def destroy
38
- authorize @translation
39
- @translation.destroy
40
- respond_with @translation, location: translations_path(current_site)
21
+ service.update(@translation, translation_params[:values])
22
+ respond_with @translation, location: translations_path(current_site, params[:_location])
41
23
  end
42
24
 
43
25
  private
@@ -47,7 +29,11 @@ module Locomotive
47
29
  end
48
30
 
49
31
  def translation_params
50
- params.require(:translation).permit(:key, :values)
32
+ params.require(:translation).permit(values: current_site.locales)
33
+ end
34
+
35
+ def service
36
+ @service ||= Locomotive::TranslationService.new(current_site, current_locomotive_account)
51
37
  end
52
38
 
53
39
  end
@@ -59,22 +59,6 @@ module Locomotive
59
59
  content_tag :i, '', class: ['fa', name].join(' ')
60
60
  end
61
61
 
62
- # Like link_to but instead of passing a label, we
63
- # pass the name of an Font Awesome icon.
64
- # If the name is a Symbol, we append "icon-" to the
65
- # dasherized version of the name.
66
- #
67
- # @param [ String / Symbol ] name The class name or a symbol
68
- # @param [ Array ] *args
69
- #
70
- # @return [ String ] The HTML <a> tag
71
- #
72
- def link_to_icon(name, *args, &block)
73
- name = name.is_a?(Symbol) ? "icon-#{name.to_s.dasherize}" : name
74
- icon = content_tag(:i, '', class: name)
75
- link_to(icon, *args, &block).html_safe
76
- end
77
-
78
62
  # Execute the code only once during the request time. It avoids duplicated
79
63
  # dom elements in the rendered rails page.
80
64
  #
@@ -89,13 +73,10 @@ module Locomotive
89
73
  end
90
74
  end
91
75
 
92
- # def locale_picker_link
93
- # if current_site.locales.size > 1 && localized?
94
- # content_tag :div, render('locomotive/shared/locale_picker_link'), class: 'action'
95
- # else
96
- # nil
97
- # end
98
- # end
76
+ def locale_picker_link
77
+ return '' if current_site.locales.size == 1
78
+ render 'locomotive/shared/locale_picker_link'
79
+ end
99
80
 
100
81
  def flash_message
101
82
  if not flash.empty?
@@ -218,5 +199,26 @@ module Locomotive
218
199
  end
219
200
  end
220
201
 
202
+ # Display the name of the account (+ avatar) who created or updated the document
203
+ # (content_entry, translation, ...etc) as well as the date when it occured.
204
+ #
205
+ # @param [ Object ] document The model
206
+ #
207
+ # @return [ String ] The html output
208
+ #
209
+ def document_stamp(document)
210
+ distance = distance_of_time_in_words_to_now(document.updated_at)
211
+ update = document.updated_at && document.updated_at != document.created_at
212
+
213
+ if account = (document.updated_by || document.created_by)
214
+ profile = account_avatar_and_name(account, '40x40#')
215
+ key = update ? :updated_by : :created_by
216
+ t(key, scope: 'locomotive.shared.list', distance: distance, who: profile)
217
+ else
218
+ key = update ? :updated_at : :created_at
219
+ t(key, scope: 'locomotive.shared.list', distance: distance)
220
+ end
221
+ end
222
+
221
223
  end
222
224
  end
@@ -22,6 +22,14 @@ module Locomotive
22
22
  value.blank? ? '?' : value
23
23
  end
24
24
 
25
+ def human_asset_size(asset)
26
+ if asset.image?
27
+ "#{asset.width} X #{asset.height} px"
28
+ else
29
+ number_to_human_size(asset.size)
30
+ end
31
+ end
32
+
25
33
  end
26
34
 
27
35
  class ImageResizeForm
@@ -1,23 +1,13 @@
1
1
  module Locomotive
2
2
  module ContentEntriesHelper
3
3
 
4
- # Display the name of the account (+ avatar) who created or updated the content entry
5
- # as well as the date when it happened.
6
- #
7
- # @param [ Object ] entry The content entry instance
8
- #
9
- # @return [ String ] The html output
10
- #
11
- def content_entry_stamp(entry)
12
- distance = time_ago_in_words(entry.updated_at)
4
+ # Tell if the tab specified by the name argument should
5
+ # be displayed or not. It is based on the display_settings
6
+ # property of the content type.
7
+ def display_content_entry_tab?(content_type, name)
8
+ return true if content_type.display_settings.blank?
13
9
 
14
- if account = entry.updated_by || entry.created_by
15
- profile = account_avatar_and_name(account, '40x40#')
16
- key = entry.updated_by ? :updated_by : :created_by
17
- t(key, scope: 'locomotive.content_entries.index', distance: distance, who: profile)
18
- else
19
- t('locomotive.content_entries.index.updated_at', distance: distance)
20
- end
10
+ content_type.display_settings[name.to_s] != false
21
11
  end
22
12
 
23
13
  # Display the label related to a field of a content entry.
@@ -34,9 +24,9 @@ module Locomotive
34
24
  if field.localized?
35
25
  translated_css = entry.translated_field?(field) ? '' : 'untranslated'
36
26
 
37
- icon = content_tag(:i, '', class: 'icon-flag')
38
- tag = content_tag(:span, icon, class: "localized-icon #{translated_css}")
39
- "#{tag}#{field.label}"
27
+ icon = content_tag(:i, '', class: "fa fa-globe #{translated_css}")
28
+
29
+ "#{icon}&nbsp;#{field.label}".html_safe
40
30
  else
41
31
  field.label
42
32
  end
@@ -67,5 +57,9 @@ module Locomotive
67
57
  end
68
58
  end
69
59
 
60
+ def can_edit_public_submission_accounts?(content_type)
61
+ policy(content_type).update? && content_type.public_submission_enabled?
62
+ end
63
+
70
64
  end
71
65
  end