locomotivecms 4.1.1 → 4.2.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (301) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +4 -3
  4. data/Rakefile +4 -0
  5. data/app/api/locomotive/api.rb +1 -1
  6. data/app/assets/config/locomotive_manifest.js +2 -0
  7. data/app/assets/javascripts/locomotive.js +2 -2
  8. data/app/assets/stylesheets/locomotive/account.scss +0 -1
  9. data/app/assets/stylesheets/locomotive/application.scss +0 -1
  10. data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
  11. data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
  12. data/app/controllers/locomotive/base_controller.rb +1 -1
  13. data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
  14. data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
  15. data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
  16. data/app/controllers/locomotive/errors_controller.rb +1 -1
  17. data/app/controllers/locomotive/my_account_controller.rb +1 -1
  18. data/app/controllers/locomotive/passwords_controller.rb +3 -1
  19. data/app/controllers/locomotive/registrations_controller.rb +3 -1
  20. data/app/controllers/locomotive/sessions_controller.rb +3 -1
  21. data/app/controllers/locomotive/sites_controller.rb +1 -1
  22. data/app/helpers/locomotive/base_helper.rb +2 -2
  23. data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
  24. data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
  25. data/app/inputs/locomotive/api_key_input.rb +1 -1
  26. data/app/mailers/locomotive/notifications.rb +1 -1
  27. data/app/models/locomotive/account.rb +1 -1
  28. data/app/models/locomotive/concerns/account/api_key.rb +1 -1
  29. data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
  30. data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
  31. data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
  32. data/app/models/locomotive/concerns/page/templatized.rb +1 -1
  33. data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
  34. data/app/models/locomotive/concerns/site/routes.rb +1 -1
  35. data/app/models/locomotive/content_entry.rb +2 -2
  36. data/app/models/locomotive/page.rb +3 -3
  37. data/app/models/locomotive/section.rb +1 -1
  38. data/app/models/locomotive/snippet.rb +1 -1
  39. data/app/models/locomotive/translation.rb +1 -1
  40. data/app/services/locomotive/content_entry_import_service.rb +1 -1
  41. data/app/services/locomotive/content_entry_service.rb +2 -2
  42. data/app/services/locomotive/content_type_service.rb +13 -3
  43. data/app/services/locomotive/custom_field_service.rb +2 -2
  44. data/app/services/locomotive/editor_service.rb +1 -1
  45. data/app/uploaders/locomotive/base_uploader.rb +0 -10
  46. data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
  47. data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
  48. data/app/views/locomotive/page_content/edit.html.erb +1 -1
  49. data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
  50. data/config/initializers/devise.rb +5 -2
  51. data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
  52. data/lib/locomotive/action_controller/responder.rb +1 -1
  53. data/lib/locomotive/configuration.rb +2 -2
  54. data/lib/locomotive/dependencies.rb +0 -2
  55. data/lib/locomotive/engine.rb +14 -2
  56. data/lib/locomotive/mongoid/patches.rb +25 -65
  57. data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
  58. data/lib/locomotive/version.rb +1 -1
  59. data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
  60. data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
  61. data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
  62. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
  63. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
  64. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
  65. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
  66. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
  67. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
  68. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
  69. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
  70. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
  71. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
  72. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
  73. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
  74. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
  75. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
  76. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
  77. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
  78. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
  79. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
  80. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
  81. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
  82. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
  83. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
  84. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
  85. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
  86. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
  87. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
  88. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
  89. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
  90. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
  91. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
  92. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
  93. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
  94. data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
  95. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
  96. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
  97. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
  98. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
  99. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
  100. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
  101. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
  102. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
  103. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
  104. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
  105. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
  106. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
  107. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
  108. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
  109. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
  110. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
  111. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
  112. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
  113. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
  114. data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
  115. data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
  116. data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
  117. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
  118. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
  119. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
  120. data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
  121. data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
  122. data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
  123. data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
  124. data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
  125. data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
  126. data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
  127. data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
  128. data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
  129. data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
  130. data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
  131. data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
  132. data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
  133. data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
  134. data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
  135. data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
  136. data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
  137. data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
  138. data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
  139. data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
  140. data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
  141. data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
  142. data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
  143. data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
  144. data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
  145. data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
  146. data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
  147. data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
  148. data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
  149. data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
  150. data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
  151. data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
  152. data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
  153. data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
  154. data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
  155. data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
  156. data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
  157. data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
  158. data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
  159. data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
  160. data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
  161. data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
  162. data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
  163. data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
  164. data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
  165. data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
  166. data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
  167. data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
  168. data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
  169. data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
  170. data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
  171. data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
  172. data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
  173. data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
  174. data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
  175. data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
  176. data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
  177. data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
  178. data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
  179. data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
  180. data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
  181. data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
  182. data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
  183. data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
  184. data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
  185. data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
  186. data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
  187. data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
  188. data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
  189. data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
  190. data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
  191. data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
  192. data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
  193. data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
  194. data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
  195. data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
  196. data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
  197. data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
  198. data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
  199. data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
  200. data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
  201. data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
  202. data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
  203. data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
  204. data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
  205. data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
  206. data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
  207. data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
  208. data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
  209. data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
  210. data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
  211. data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
  212. data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
  213. data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
  214. data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
  215. data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
  216. data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
  217. data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
  218. data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
  219. data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
  220. data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
  221. data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
  222. data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
  223. data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
  224. data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
  225. data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
  226. data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
  227. data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
  228. data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
  229. data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
  230. data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
  231. data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
  232. data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
  233. data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
  234. data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
  235. data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
  236. data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
  237. data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
  238. data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
  239. data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
  240. data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
  241. data/vendor/assets/javascripts/locomotive/select2.js +436 -175
  242. data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
  243. data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
  244. data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
  245. data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
  246. data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
  247. data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
  248. data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
  249. data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
  250. data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
  251. data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
  252. data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
  253. data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
  254. data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
  255. data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
  256. data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
  257. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
  258. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
  259. data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
  260. data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
  261. data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
  262. data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
  263. data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
  264. data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
  265. data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
  266. data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
  267. data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
  268. data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
  269. data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
  270. data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
  271. data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
  272. data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
  273. data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
  274. data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
  275. data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
  276. data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
  277. data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
  278. data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
  279. data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
  280. data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
  281. data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
  282. data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
  283. data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
  284. data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
  285. data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
  286. data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
  287. data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
  288. data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
  289. data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
  290. data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
  291. data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
  292. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
  293. data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
  294. data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
  295. data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
  296. data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
  297. data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
  298. data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
  299. data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
  300. data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
  301. metadata +349 -128
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70460310fb05f52fee938829d69cdbd5a93224226d82f0c9610efb49ae7a1e1f
4
- data.tar.gz: 403506af7c828c918b2149e70ec330ba7e458d15d662d9c86a73f0c9d816276f
3
+ metadata.gz: 125c005edc4d73f9bcf75bf02e36e36786d47d27a55e3d858afce33ec04eef34
4
+ data.tar.gz: e337583e4f49f352c4ff5b1b94cb417cc4845e5483e2e2b184f4164a29ef5d46
5
5
  SHA512:
6
- metadata.gz: 6c1cb4955784a9469695e2040f4ad8f5959b9217e5731eb7390df6838cab6c157cccedc4e97df96be1ca7deffea84acc787d02d2f005076194c26f6e702069cc
7
- data.tar.gz: ae5118f9354d2715d9a49e239dd283463aa8a37aa33947c3213e9f9f2ea8ea6e7e2465937b65fdff37cb996f61d9205256a316cc0488be210038cda3c1bed652
6
+ metadata.gz: 6ff8971a009e04c1fa4ed523e85a9b940a89c8b5acfef33ab9c5b11d9c69180f8d1ede1c992463e55f14cff967eb575d40d48f92856225fc0b06290168187a94
7
+ data.tar.gz: c9b63ae75baa1ede9821cb8b62cf6e27e0a5f7b1b2f4b0350f7a9be932abbfa6fa563251742b3b682f4436e88a672c13aa9e4ebe227d0ca2047f9c02e7ca486a
data/MIT-LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  == MIT License
2
2
 
3
- Copyright (c) 2010-2020, NoCoffee.
3
+ Copyright (c) 2010-2023, NoCoffee.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -39,9 +39,10 @@ Have a look at our [Trello](https://trello.com/b/kRiy1dZu/locomotive-v3) board t
39
39
 
40
40
  Here is a list of the main gems used to power the Locomotive platform:
41
41
 
42
- - Rails 5 - *web framework*
42
+ - Ruby 3+
43
+ - Rails 7 - *web framework*
43
44
  - Bootstrap - *UI framework*
44
- - Mongoid 6 - *Object-Document-Mapper for MongoDB 3*
45
+ - Mongoid 7 - *Object-Document-Mapper for MongoDB 6*
45
46
  - Devise 4 - *Authentication*
46
47
  - Carrierwave - *Upload*
47
48
  - Pundit - *Permissions*
@@ -71,4 +72,4 @@ Locomotive is an open source project, we encourage contributions. If you have fo
71
72
 
72
73
  Feel free to contact me at didier at nocoffee dot fr.
73
74
 
74
- Copyright (c) 2020 NoCoffee, released under the MIT license
75
+ Copyright (c) 2010-2024 NoCoffee, released under the MIT license
data/Rakefile CHANGED
@@ -14,6 +14,8 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
18
+ load 'rails/tasks/engine.rake'
17
19
  load 'rails/tasks/statistics.rake'
18
20
 
19
21
  require 'bundler/gem_tasks'
@@ -24,6 +26,8 @@ begin
24
26
  rescue LoadError
25
27
  end
26
28
 
29
+ # load './lib/tasks/development_tasks.rake'
30
+
27
31
  require 'webdrivers'
28
32
  load 'webdrivers/Rakefile'
29
33
 
@@ -19,7 +19,7 @@ module Locomotive
19
19
 
20
20
  class Dispatch < Grape::API
21
21
 
22
- helpers Pundit
22
+ helpers Pundit::Authorization
23
23
  helpers API::Helpers::AuthenticationHelper
24
24
  helpers API::Helpers::ParamsHelper
25
25
  helpers API::Helpers::PersistenceHelper
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link locomotive/application.css
@@ -8,8 +8,8 @@
8
8
  //= require jquery-ui
9
9
  //= require jquery_ujs
10
10
  //= require bootstrap-sprockets
11
- //= require codemirror
12
- //= require codemirror/modes/markdown
11
+ //= require locomotive/codemirror
12
+ //= require locomotive/codemirror/modes/markdown
13
13
  //= require locomotive/vendor
14
14
  //= require ./locomotive/application
15
15
 
@@ -16,7 +16,6 @@
16
16
  // Reset and dependencies
17
17
 
18
18
  @import "bootstrap/normalize";
19
- @import "font-awesome-sprockets";
20
19
  @import "font-awesome";
21
20
 
22
21
  // Core CSS
@@ -20,7 +20,6 @@
20
20
  // Reset and dependencies
21
21
 
22
22
  @import "bootstrap/normalize";
23
- @import "font-awesome-sprockets";
24
23
  @import "font-awesome";
25
24
 
26
25
  // Core CSS
@@ -6,7 +6,6 @@
6
6
  // Reset and dependencies
7
7
 
8
8
  @import "bootstrap/normalize";
9
- @import "font-awesome-sprockets";
10
9
  @import "font-awesome";
11
10
 
12
11
  // Core CSS
@@ -1,4 +1,3 @@
1
- @import "font-awesome-sprockets";
2
1
  @import "font-awesome";
3
2
 
4
3
  $button-background: #1c77c3;
@@ -9,7 +9,7 @@ module Locomotive
9
9
  include Locomotive::Concerns::StoreLocationController
10
10
  include Locomotive::Concerns::WithinSiteController
11
11
 
12
- layout '/locomotive/layouts/application'
12
+ layout 'locomotive/layouts/application'
13
13
 
14
14
  helper Locomotive::BaseHelper, Locomotive::ErrorsHelper
15
15
 
@@ -3,7 +3,7 @@ module Locomotive
3
3
  module AuthorizationController
4
4
 
5
5
  extend ActiveSupport::Concern
6
- include Pundit
6
+ include Pundit::Authorization
7
7
 
8
8
  included do
9
9
  rescue_from Pundit::NotAuthorizedError, with: :render_access_denied
@@ -19,7 +19,7 @@ module Locomotive
19
19
  options = { host: Locomotive.config.host }
20
20
  options[:port] = request.port if request.port != 80
21
21
 
22
- redirect_to root_url(options)
22
+ redirect_to(root_url(**options), allow_other_host: true)
23
23
  end
24
24
  end
25
25
 
@@ -29,7 +29,7 @@ module Locomotive
29
29
  def render_no_site_error
30
30
  respond_to do |format|
31
31
  format.html do
32
- redirect_to sites_path
32
+ redirect_to locomotive.sites_path
33
33
  end
34
34
  format.json do
35
35
  render json: { error: 'No site found' }, status: :not_found
@@ -1,7 +1,7 @@
1
1
  module Locomotive
2
2
  class ErrorsController < ApplicationController
3
3
 
4
- layout '/locomotive/layouts/error'
4
+ layout 'locomotive/layouts/error'
5
5
 
6
6
  helper Locomotive::BaseHelper
7
7
 
@@ -7,7 +7,7 @@ module Locomotive
7
7
 
8
8
  before_action :load_account
9
9
 
10
- layout '/locomotive/layouts/account'
10
+ layout 'locomotive/layouts/account'
11
11
 
12
12
  def edit
13
13
  authorize @account
@@ -7,10 +7,12 @@ module Locomotive
7
7
 
8
8
  within_site_only_if_existing true
9
9
 
10
- layout '/locomotive/layouts/account'
10
+ layout 'locomotive/layouts/account'
11
11
 
12
12
  helper Locomotive::BaseHelper
13
13
 
14
+ respond_to :html, :json
15
+
14
16
  before_action :set_locale
15
17
 
16
18
  def update
@@ -4,12 +4,14 @@ module Locomotive
4
4
  include Locomotive::Concerns::SslController
5
5
  include Locomotive::Concerns::RedirectToMainHostController
6
6
 
7
- layout '/locomotive/layouts/account'
7
+ layout 'locomotive/layouts/account'
8
8
 
9
9
  before_action :configure_permitted_parameters
10
10
 
11
11
  helper Locomotive::BaseHelper
12
12
 
13
+ respond_to :html, :json
14
+
13
15
  before_action :set_locale
14
16
 
15
17
  private
@@ -7,10 +7,12 @@ module Locomotive
7
7
 
8
8
  within_site_only_if_existing true # Note: do not validate the membership
9
9
 
10
- layout '/locomotive/layouts/account'
10
+ layout 'locomotive/layouts/account'
11
11
 
12
12
  before_action :set_locale
13
13
 
14
+ respond_to :html, :json
15
+
14
16
  helper Locomotive::BaseHelper
15
17
 
16
18
  private
@@ -3,7 +3,7 @@ module Locomotive
3
3
 
4
4
  account_required
5
5
 
6
- layout '/locomotive/layouts/account'
6
+ layout 'locomotive/layouts/account'
7
7
 
8
8
  def index
9
9
  authorize Site
@@ -276,13 +276,13 @@ module Locomotive
276
276
 
277
277
  def cache_key_for_sidebar_pages
278
278
  count = current_site.pages.count
279
- max_updated_at = current_site.pages.max(:updated_at).try(:utc).try(:to_s, :number).to_i
279
+ max_updated_at = current_site.pages.max(:updated_at).try(:utc).try(:to_fs, :number).to_i
280
280
  base_cache_key_for_sidebar + ['pages', count, max_updated_at, current_content_locale]
281
281
  end
282
282
 
283
283
  def cache_key_for_sidebar_content_types
284
284
  count = current_site.content_types.count
285
- max_updated_at = current_site.content_types.max(:updated_at).try(:utc).try(:to_s, :number).to_i
285
+ max_updated_at = current_site.content_types.max(:updated_at).try(:utc).try(:to_fs, :number).to_i
286
286
  base_cache_key_for_sidebar + ['content_types', count, max_updated_at]
287
287
  end
288
288
 
@@ -55,7 +55,7 @@ module Locomotive
55
55
  {
56
56
  name: field.name,
57
57
  label: label_for_custom_field(form.object, field),
58
- hint: field.hint,
58
+ hint: raw(field.hint),
59
59
  required: field.required,
60
60
  input_html: {
61
61
  class: "#{'input-lg' if highlighted}"
@@ -225,7 +225,7 @@ module Locomotive
225
225
  end
226
226
 
227
227
  def custom_field_t(name, type, interpolation = {})
228
- t(name, { scope: ['locomotive.custom_fields.types', type] }.merge(interpolation))
228
+ t(name, **{ scope: ['locomotive.custom_fields.types', type] }.merge(interpolation))
229
229
  end
230
230
 
231
231
  end
@@ -42,7 +42,7 @@ module Locomotive
42
42
  end
43
43
 
44
44
  def activity_key_to_sentence(key, options = nil)
45
- I18n.t(key, (options || {}).merge(scope: 'locomotive.activity')).html_safe
45
+ I18n.t(key, **(options || {}).merge(scope: 'locomotive.activity')).html_safe
46
46
  end
47
47
 
48
48
  def activity_emphasize(text)
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
- class ApiKeyInput < ::SimpleForm::Inputs::Base
2
+ class APIKeyInput < ::SimpleForm::Inputs::Base
3
3
 
4
4
  include Locomotive::SimpleForm::Inputs::FasterTranslate
5
5
 
@@ -31,7 +31,7 @@ module Locomotive
31
31
 
32
32
  def new_content_entry_subject(entry, options)
33
33
  if entry.content_type.public_submission_title_template.blank?
34
- t('locomotive.notifications.new_content_entry.subject', options)
34
+ t('locomotive.notifications.new_content_entry.subject', **options)
35
35
  else
36
36
  entry.content_type.public_submission_title(entry, options)
37
37
  end
@@ -4,7 +4,7 @@ module Locomotive
4
4
  include Locomotive::Mongoid::Document
5
5
  devise *Locomotive.config.devise_modules
6
6
  acts_as_token_authenticatable
7
- include Locomotive::Concerns::Account::ApiKey
7
+ include Locomotive::Concerns::Account::APIKey
8
8
 
9
9
  ## devise fields (need to be declared since 2.x) ##
10
10
  field :remember_created_at, type: Time
@@ -3,7 +3,7 @@ module Locomotive
3
3
  module Account
4
4
 
5
5
  # More information here: https://github.com/mongoid/mongoid/issues/3626
6
- module ApiKey
6
+ module APIKey
7
7
 
8
8
  extend ActiveSupport::Concern
9
9
 
@@ -68,7 +68,7 @@ module Locomotive
68
68
  fields = content_type.ordered_entries_custom_fields
69
69
  labels = fields.map(&:label) << I18n.t('mongoid.attributes.locomotive/content_entry.created_at')
70
70
 
71
- CSV.generate(csv_options) do |csv|
71
+ CSV.generate(**csv_options) do |csv|
72
72
  # header
73
73
  csv << labels
74
74
  # body
@@ -67,14 +67,14 @@ module Locomotive
67
67
  end
68
68
 
69
69
  def similar_slug(slug)
70
- _last = self.class.where(_slug: /^#{slug}-?\d*$/i)
70
+ _last_slug = self.class.where(_slug: /^#{slug}-?\d*$/i)
71
71
  .excludes(_id: self._id)
72
- .only(:_slug)
73
- .order_by(:_id.desc)
72
+ .order_by(:created_at.desc)
73
+ .pluck(:_slug)
74
74
  .first
75
75
 
76
- if _last
77
- _last['_slug'][::Mongoid::Fields::I18n.locale.to_s]
76
+ if _last_slug
77
+ _last_slug[::Mongoid::Fields::I18n.locale.to_s]
78
78
  else
79
79
  nil
80
80
  end
@@ -27,9 +27,9 @@ module Locomotive
27
27
 
28
28
  steam_repositories.content_entry.with(to_steam).build(entry_attributes).tap do |entity|
29
29
  # copy error messages
30
- entry.errors.each do |name, message|
31
- next if name == :_slug
32
- entity.errors.add(name, message)
30
+ entry.errors.each do |error|
31
+ next if error.attribute == :_slug
32
+ entity.errors.add(error.attribute, error.message)
33
33
  end
34
34
  end
35
35
  end
@@ -188,7 +188,7 @@ module Locomotive
188
188
  # attribute got changed.
189
189
  #
190
190
  def propagate_templatized
191
- return unless self.templatized_changed?
191
+ return unless self.templatized_previously_changed?
192
192
 
193
193
  selector = { 'parent_ids' => { '$in' => [self._id] } }
194
194
  operations = {
@@ -9,7 +9,10 @@ module Locomotive
9
9
 
10
10
  def json_attribute(name)
11
11
  validate { |record| record.send(:json_attribute_must_be_valid, name) }
12
- before_validation { |record| record.send(:add_json_parsing_error, name) }
12
+ before_validation do |record|
13
+ record.send(:add_json_uncastable_values_error, name)
14
+ record.send(:add_json_parsing_error, name)
15
+ end
13
16
 
14
17
  define_method(:"#{name}=") do |json|
15
18
  super(decode_json(name, json))
@@ -22,7 +25,7 @@ module Locomotive
22
25
 
23
26
  def decode_json(name, json)
24
27
  begin
25
- value = json.is_a?(String) ? ActiveSupport::JSON.decode(URI.unescape(json)) : json
28
+ value = json.is_a?(String) ? ActiveSupport::JSON.decode(CGI.unescape(json)) : json
26
29
  instance_variable_set(:"@#{name}_json_parsing_error", nil)
27
30
  value
28
31
  rescue ActiveSupport::JSON.parse_error
@@ -44,6 +47,22 @@ module Locomotive
44
47
  end
45
48
  end
46
49
 
50
+ # https://www.mongodb.com/docs/mongoid/current/reference/fields/#uncastable-values
51
+ def add_json_uncastable_values_error(name)
52
+ value_before = attributes_before_type_cast[name.to_s]
53
+ value_now = self.send(name)
54
+
55
+ return if value_now
56
+
57
+ # if the field is localized, take the translated value (current locale)
58
+ if value_before && fields[name.to_s].try(:localized?) && value_before.respond_to?(:key?)
59
+ value_before = value_before[::Mongoid::Fields::I18n.locale]
60
+ end
61
+
62
+ # Uncastable value detected!
63
+ self.errors.add(name, 'has a wrong object type') if !value_before.nil?
64
+ end
65
+
47
66
  def add_json_parsing_error(name)
48
67
  error = instance_variable_get(:"@#{name}_json_parsing_error")
49
68
 
@@ -12,7 +12,7 @@ module Locomotive
12
12
  field :routes, type: Array, default: []
13
13
 
14
14
  ## behaviours ##
15
- json_attribute :routes
15
+ json_attribute :routes
16
16
  end
17
17
 
18
18
  private
@@ -38,8 +38,8 @@ module Locomotive
38
38
  scope :latest_updated, -> { order_by(updated_at: :desc).limit(Locomotive.config.ui[:latest_entries_nb]) }
39
39
  scope :next_or_previous,
40
40
  ->(condition, order_by) { where({ _visible: true }.merge(condition)).limit(1).order_by(order_by) }
41
- scope :by_id_or_slug, ->(id_or_slug) { all.or({ _id: id_or_slug }, { _slug: id_or_slug }) }
42
- scope :by_ids_or_slugs, ->(ids_or_slugs) { all.any_of({ :_slug.in => [*ids_or_slugs] }, { :_id.in => [*ids_or_slugs] }) }
41
+ scope :by_id_or_slug, ->(id_or_slug) { where('$or' => [{ _id: id_or_slug }, { _slug: id_or_slug }]) }
42
+ scope :by_ids_or_slugs, ->(ids_or_slugs) { where('$or' => [{ :_slug.in => [*ids_or_slugs] }, { :_id.in => [*ids_or_slugs] }]) }
43
43
 
44
44
  ## indexes ##
45
45
  index _type: 1
@@ -64,7 +64,7 @@ module Locomotive
64
64
  scope :handle, ->(handle) { where(handle: handle) }
65
65
  scope :minimal_attributes, -> { without(:raw_template, :template) }
66
66
  scope :dependent_from, ->(id) { where(:template_dependencies.in => [id]) }
67
- scope :by_id_or_fullpath, ->(id_or_fullpath) { all.or({ _id: id_or_fullpath }, { fullpath: id_or_fullpath }) }
67
+ scope :by_id_or_fullpath, ->(id_or_fullpath) { any_of({ _id: id_or_fullpath }, { fullpath: id_or_fullpath }) }
68
68
 
69
69
  delegate :fullpath, to: :parent, prefix: true
70
70
 
@@ -111,7 +111,7 @@ module Locomotive
111
111
  end
112
112
 
113
113
  def touch_site_attribute
114
- self.raw_template_changed? ? :template_version : :content_version
114
+ self.raw_template_previously_changed? ? :template_version : :content_version
115
115
  end
116
116
 
117
117
  protected
@@ -145,7 +145,7 @@ module Locomotive
145
145
  end
146
146
 
147
147
  def update_children
148
- self.children.map(&:save) if self.slug_changed? or self.fullpath_changed?
148
+ self.children.map(&:save) if self.slug_previously_changed? or self.fullpath_previously_changed?
149
149
  end
150
150
 
151
151
  def record_current_locale
@@ -17,7 +17,7 @@ module Locomotive
17
17
  validates_uniqueness_of :slug, scope: :site_id
18
18
 
19
19
  ## named scopes ##
20
- scope :by_id_or_slug, ->(id_or_slug) { all.or({ _id: id_or_slug }, { slug: id_or_slug }) }
20
+ scope :by_id_or_slug, ->(id_or_slug) { where('$or' => [{ _id: id_or_slug }, { slug: id_or_slug }]) }
21
21
 
22
22
  ## behaviours ##
23
23
  slugify_from :name
@@ -15,7 +15,7 @@ module Locomotive
15
15
  validates_uniqueness_of :slug, scope: :site_id
16
16
 
17
17
  ## named scopes ##
18
- scope :by_id_or_slug, ->(id_or_slug) { all.or({ _id: id_or_slug }, { slug: id_or_slug }) }
18
+ scope :by_id_or_slug, ->(id_or_slug) { where('$or' => [{ _id: id_or_slug }, { slug: id_or_slug }]) }
19
19
 
20
20
  ## behaviours ##
21
21
  slugify_from :name
@@ -16,7 +16,7 @@ module Locomotive
16
16
 
17
17
  ## named scopes ##
18
18
  scope :ordered, -> { order_by(key: :asc) }
19
- scope :by_id_or_key, ->(id_or_key) { all.or({ _id: id_or_key }, { key: id_or_key }) }
19
+ scope :by_id_or_key, ->(id_or_key) { where('$or' => [{ _id: id_or_key }, { key: id_or_key }]) }
20
20
 
21
21
  ## callbacks ##
22
22
  before_validation :underscore_key
@@ -71,7 +71,7 @@ module Locomotive
71
71
  csv_options = { headers: true, col_sep: ';', quote_char: "\"" }.merge(csv_options || {})
72
72
  asset = content_assets.where(id: csv_asset_id).first
73
73
  raise 'The CSV file doesn\'t exist anymore' unless asset
74
- CSV.parse(asset.source.read, csv_options)
74
+ CSV.parse(asset.source.read, **csv_options)
75
75
  rescue Exception => e
76
76
  raise WrongImportFileException.new e.message
77
77
  end
@@ -169,10 +169,10 @@ module Locomotive
169
169
  def send_notifications(entry, emails = nil)
170
170
  return unless self.content_type.public_submission_enabled?
171
171
 
172
- Locomotive::Account.any_of(
172
+ Locomotive::Account.where('$or' => [
173
173
  { :_id.in => self.content_type.public_submission_accounts || [] },
174
174
  { :email.in => emails || [] }
175
- ).each do |account|
175
+ ]).each do |account|
176
176
  Locomotive::Notifications.new_content_entry(site, account, entry).deliver
177
177
  end
178
178
  end
@@ -2,9 +2,19 @@ module Locomotive
2
2
  class ContentTypeService < Struct.new(:site)
3
3
 
4
4
  def list
5
- site.content_types
6
- .only(:_id, :name, :slug, :number_of_entries, :display_settings)
7
- .order_by(:'display_settings.position'.asc, :name.asc).to_a
5
+ site
6
+ .content_types
7
+ .order_by(:'display_settings.position'.asc, :name.asc)
8
+ .pluck(:_id, :name, :slug, :number_of_entries, :display_settings)
9
+ .map do |(_id, name, slug, number_of_entries, display_settings)|
10
+ Locomotive::ContentType.new(
11
+ _id: _id,
12
+ name: name,
13
+ slug: slug,
14
+ number_of_entries: number_of_entries,
15
+ display_settings: display_settings
16
+ )
17
+ end
8
18
  end
9
19
 
10
20
  def find_by_slug(slug)
@@ -27,10 +27,10 @@ module Locomotive
27
27
  if include_new_options && locale != default_locale
28
28
  ::Mongoid::Fields::I18n.with_locale(default_locale) do
29
29
  self.field.reload.select_options.each do |option|
30
- next unless option.attributes[:name][default_locale].blank?
30
+ next unless option.attributes['name'][default_locale.to_s].blank?
31
31
 
32
32
  # force the name in the default locale
33
- option.name = option.attributes[:name].values.first
33
+ option.name = option.attributes['name'].values.first
34
34
  end
35
35
  end
36
36
 
@@ -38,7 +38,7 @@ module Locomotive
38
38
  site.pages
39
39
  .only(:_id, :title, :sections_dropzone_content, :sections_content)
40
40
  .where(is_layout: false, target_klass_name: nil, :slug.ne => '404')
41
- .or({ title: /#{query}/i }, { _id: query })
41
+ .and(Locomotive::Page.or({ title: /#{query}/i }, { _id: query }))
42
42
  .limit(max_results)
43
43
  .sort(title: 1).map do |page|
44
44
  {
@@ -2,15 +2,5 @@
2
2
 
3
3
  module Locomotive
4
4
  class BaseUploader < ::CarrierWave::Uploader::Base
5
- include ::CarrierWave::ImageOptim
6
-
7
- if Locomotive.config.optimize_uploaded_files
8
- process optimize: [{
9
- gifsicle: true,
10
- jpegoptim: { allow_lossy: true, max_quality: 75 },
11
- optipng: { level: 4 }
12
- }]
13
- end
14
-
15
5
  end
16
6
  end
@@ -12,7 +12,7 @@ ul.activity-feed
12
12
  | &nbsp;
13
13
  | &middot;
14
14
  | &nbsp;
15
- span.time= activity.created_at.to_s(:humanized_ago)
15
+ span.time= activity.created_at.to_fs(:humanized_ago)
16
16
  | &nbsp;
17
17
  | &middot;
18
18
  | &nbsp;