locomotive_cms 0.0.4 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/Gemfile +15 -13
  2. data/README.textile +5 -4
  3. data/app/controllers/admin/api_contents_controller.rb +10 -1
  4. data/app/controllers/admin/base_controller.rb +2 -2
  5. data/app/controllers/admin/cross_domain_sessions_controller.rb +7 -4
  6. data/app/controllers/admin/current_sites_controller.rb +2 -0
  7. data/app/controllers/admin/imports_controller.rb +13 -19
  8. data/app/controllers/admin/installation_controller.rb +79 -0
  9. data/app/controllers/admin/pages_controller.rb +1 -1
  10. data/app/controllers/admin/passwords_controller.rb +2 -2
  11. data/app/controllers/admin/sessions_controller.rb +2 -2
  12. data/app/controllers/admin/sites_controller.rb +2 -0
  13. data/app/controllers/admin/theme_assets_controller.rb +1 -1
  14. data/app/controllers/application_controller.rb +1 -1
  15. data/app/helpers/admin/assets_helper.rb +0 -6
  16. data/app/helpers/admin/{login_helper.rb → box_helper.rb} +7 -3
  17. data/app/helpers/admin/custom_fields_helper.rb +2 -2
  18. data/app/models/asset_collection.rb +15 -3
  19. data/app/models/content_instance.rb +19 -0
  20. data/app/models/content_type.rb +21 -3
  21. data/app/models/extensions/page/tree.rb +63 -7
  22. data/app/models/page.rb +2 -0
  23. data/app/models/site.rb +15 -3
  24. data/app/uploaders/asset_uploader.rb +1 -1
  25. data/app/uploaders/theme_asset_uploader.rb +12 -1
  26. data/app/uploaders/theme_uploader.rb +19 -0
  27. data/app/views/admin/asset_collections/edit.html.haml +2 -2
  28. data/app/views/admin/asset_collections/new.html.haml +1 -1
  29. data/app/views/admin/assets/_form.html.haml +2 -2
  30. data/app/views/admin/content_types/_form.html.haml +2 -2
  31. data/app/views/admin/content_types/new.html.haml +1 -1
  32. data/app/views/admin/contents/_form.html.haml +2 -2
  33. data/app/views/admin/contents/index.html.haml +1 -1
  34. data/app/views/admin/cross_domain_sessions/new.html.haml +1 -1
  35. data/app/views/admin/current_sites/_form.html.haml +3 -3
  36. data/app/views/admin/current_sites/edit.html.haml +1 -1
  37. data/app/views/admin/errors/no_page.html.haml +1 -0
  38. data/app/views/admin/errors/no_site.html.haml +1 -0
  39. data/app/views/admin/imports/new.html.haml +11 -0
  40. data/app/views/admin/imports/show.html.haml +1 -1
  41. data/app/views/admin/installation/step_1.html.haml +24 -0
  42. data/app/views/admin/installation/step_2.html.haml +26 -0
  43. data/app/views/admin/installation/step_3.html.haml +23 -0
  44. data/app/views/{layouts/admin → admin/layouts}/application.html.haml +0 -0
  45. data/app/views/admin/layouts/box.html.haml +21 -0
  46. data/app/views/admin/layouts/error.html.haml +1 -0
  47. data/app/views/admin/my_accounts/edit.html.haml +1 -1
  48. data/app/views/admin/pages/_form.html.haml +2 -3
  49. data/app/views/admin/pages/_page.html.haml +4 -2
  50. data/app/views/admin/pages/index.html.haml +1 -1
  51. data/app/views/admin/passwords/edit.html.haml +2 -2
  52. data/app/views/admin/passwords/new.html.haml +2 -2
  53. data/app/views/admin/sessions/new.html.haml +2 -2
  54. data/app/views/admin/shared/_head.html.haml +4 -5
  55. data/app/views/admin/shared/menu/_contents.html.haml +1 -1
  56. data/app/views/admin/sites/_form.html.haml +3 -3
  57. data/app/views/admin/snippets/_form.html.haml +2 -2
  58. data/app/views/admin/theme_assets/_form.html.haml +2 -2
  59. data/app/views/admin/theme_assets/index.html.haml +1 -1
  60. data/config/application.rb +1 -3
  61. data/config/assets.yml +96 -0
  62. data/config/environments/development.rb +1 -6
  63. data/config/environments/production.rb +1 -1
  64. data/config/environments/test.rb +1 -5
  65. data/config/initializers/carrierwave.rb +17 -0
  66. data/config/initializers/locomotive.rb +14 -0
  67. data/config/locales/admin_ui_en.yml +33 -1
  68. data/config/locales/admin_ui_fr.yml +34 -1
  69. data/config/locales/default_en.yml +1 -0
  70. data/config/locales/default_fr.yml +1 -0
  71. data/config/locales/flash.en.yml +1 -0
  72. data/config/locales/flash.fr.yml +1 -0
  73. data/config/mongoid.yml +13 -5
  74. data/config/routes.rb +6 -1
  75. data/lib/generators/locomotive/install/install_generator.rb +18 -10
  76. data/lib/generators/locomotive/install/templates/README +23 -13
  77. data/lib/generators/locomotive/install/templates/locomotive.rb +15 -1
  78. data/lib/locomotive/carrierwave.rb +1 -0
  79. data/lib/locomotive/configuration.rb +3 -1
  80. data/lib/locomotive/custom_fields.rb +0 -1
  81. data/lib/locomotive/delayed_job.rb +1 -2
  82. data/lib/locomotive/engine.rb +24 -7
  83. data/lib/locomotive/heroku.rb +1 -0
  84. data/lib/locomotive/httparty/webservice.rb +12 -1
  85. data/lib/locomotive/import.rb +2 -0
  86. data/lib/locomotive/import/asset_collections.rb +40 -8
  87. data/lib/locomotive/import/assets.rb +20 -12
  88. data/lib/locomotive/import/base.rb +46 -0
  89. data/lib/locomotive/import/content_types.rb +51 -15
  90. data/lib/locomotive/import/job.rb +106 -11
  91. data/lib/locomotive/import/logger.rb +13 -0
  92. data/lib/locomotive/import/pages.rb +79 -26
  93. data/lib/locomotive/import/site.rb +3 -5
  94. data/lib/locomotive/import/snippets.rb +6 -8
  95. data/lib/locomotive/inherited_resources.rb +1 -0
  96. data/lib/locomotive/liquid/drops/asset_collections.rb +4 -4
  97. data/lib/locomotive/liquid/drops/contents.rb +21 -16
  98. data/lib/locomotive/liquid/drops/page.rb +4 -0
  99. data/lib/locomotive/liquid/filters/html.rb +15 -29
  100. data/lib/locomotive/liquid/tags/consume.rb +1 -1
  101. data/lib/locomotive/liquid/tags/nav.rb +48 -17
  102. data/lib/locomotive/liquid/tags/paginate.rb +3 -3
  103. data/lib/locomotive/middlewares/fonts.rb +3 -11
  104. data/lib/locomotive/misc_form_builder.rb +2 -7
  105. data/lib/locomotive/railties/tasks.rake +16 -0
  106. data/lib/locomotive/regexps.rb +1 -1
  107. data/lib/locomotive/render.rb +9 -3
  108. data/lib/locomotive/routing/site_dispatcher.rb +10 -6
  109. data/lib/locomotive/version.rb +1 -1
  110. data/public/images/admin/box/buttons/right_bg.png +0 -0
  111. data/public/javascripts/admin/aloha/VERSION.txt +1 -1
  112. data/public/javascripts/admin/aloha/aloha-nodeps.js +140 -101
  113. data/public/javascripts/admin/aloha/aloha.js +193 -105
  114. data/public/javascripts/admin/aloha/css/aloha.css +65 -4
  115. data/public/javascripts/admin/aloha/deps/prettyPhoto/resources/css/prettyPhoto.css +2 -2
  116. data/public/javascripts/admin/aloha/i18n/de.dict +2 -0
  117. data/public/javascripts/admin/aloha/i18n/en.dict +2 -0
  118. data/public/javascripts/admin/aloha/i18n/pl.dict +5 -0
  119. data/public/javascripts/admin/aloha/images/base.png +0 -0
  120. data/public/javascripts/admin/aloha/images/base_big.png +0 -0
  121. data/public/javascripts/admin/aloha/images/base_multi.png +0 -0
  122. data/public/javascripts/admin/aloha/images/fade_in.png +0 -0
  123. data/public/javascripts/admin/aloha/images/fade_out.png +0 -0
  124. data/public/javascripts/admin/aloha/images/gentics_logo.png +0 -0
  125. data/public/javascripts/admin/aloha/images/grabhandle.png +0 -0
  126. data/public/javascripts/admin/aloha/images/maximize.png +0 -0
  127. data/public/javascripts/admin/aloha/images/pin.png +0 -0
  128. data/public/javascripts/admin/aloha/images/removeformat.png +0 -0
  129. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.css +86 -0
  130. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.html +44 -0
  131. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/de.dict +4 -0
  132. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/en.dict +4 -0
  133. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/fr.dict +4 -0
  134. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/plugin.js +1 -0
  135. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/product.js +1 -0
  136. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/2xu-wetsuit.jpg +0 -0
  137. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/asics-noosa.jpg +0 -0
  138. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/fivefingers-kso.jpg +0 -0
  139. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/kuota-kueen-k.jpg +0 -0
  140. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/mizuno-wave-musha2.jpg +0 -0
  141. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product.css +69 -0
  142. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product_button.gif +0 -0
  143. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/simplon-mrt.jpg +0 -0
  144. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trek-fuel-ex.jpg +0 -0
  145. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trisports.jpg +0 -0
  146. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/zoggs-predator.jpg +0 -0
  147. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/de.dict +0 -0
  148. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/en.dict +0 -0
  149. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fi.dict +0 -0
  150. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fr.dict +0 -0
  151. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/it.dict +0 -0
  152. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/plugin.js +0 -0
  153. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.css +48 -0
  154. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.html +69 -0
  155. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/de.dict +4 -0
  156. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/en.dict +4 -0
  157. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/plugin.js +7 -0
  158. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/i18n/pl.dict +30 -0
  159. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js +1 -1
  160. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js +1 -1
  161. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js +7 -0
  162. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/delicious.js +7 -0
  163. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/i18n/pl.dict +4 -0
  164. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js +1 -1
  165. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/css/LinkChecker.css +14 -0
  166. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.css +49 -0
  167. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.html +82 -0
  168. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/i18n/en.dict +27 -0
  169. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/plugin.js +7 -0
  170. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php +235 -0
  171. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js +1 -1
  172. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/plugin.js +7 -0
  173. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js +7 -0
  174. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/de.dict +1 -0
  175. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/en.dict +1 -0
  176. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/plugin.js +1 -1
  177. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/de.dict +2 -0
  178. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/en.dict +2 -0
  179. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/pl.dict +12 -0
  180. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js +1 -1
  181. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css +28 -110
  182. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png +0 -0
  183. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png +0 -0
  184. data/public/javascripts/admin/asset_collections.js +11 -7
  185. data/public/javascripts/admin/contents.js +3 -1
  186. data/public/javascripts/admin/site.js +9 -3
  187. data/public/javascripts/admin/snippets.js +1 -1
  188. data/public/javascripts/admin/utils.js +5 -3
  189. data/public/stylesheets/admin/application.css +1 -1
  190. data/public/stylesheets/admin/box.css +5 -5
  191. data/public/stylesheets/admin/buttons.css +0 -5
  192. data/public/stylesheets/admin/formtastic_changes.css +5 -12
  193. data/public/stylesheets/admin/inline_editor.css +22 -5
  194. data/public/stylesheets/admin/installation.css +50 -0
  195. data/public/stylesheets/admin/layout.css +9 -4
  196. data/public/stylesheets/admin/safari.css +15 -0
  197. metadata +188 -131
  198. data/app/controllers/home_controller.rb +0 -7
  199. data/app/views/admin/snippets/index.html.haml +0 -15
  200. data/app/views/home/show.html.haml +0 -4
  201. data/app/views/layouts/admin/box.html.haml +0 -19
  202. data/app/views/layouts/application.html.haml +0 -7
  203. data/lib/generators/locomotive/copy_assets/copy_assets_generator.rb +0 -14
  204. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/de.dict +0 -2
  205. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/en.dict +0 -2
  206. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/eo.dict +0 -2
  207. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fi.dict +0 -2
  208. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fr.dict +0 -2
  209. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/it.dict +0 -2
  210. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/plugin.js +0 -7
  211. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/de.dict +0 -20
  212. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/en.dict +0 -20
  213. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/eo.dict +0 -16
  214. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fi.dict +0 -20
  215. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fr.dict +0 -16
  216. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/it.dict +0 -20
  217. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/plugin.js +0 -7
  218. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/css/jquery.autocomplete.css +0 -48
  219. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/deps/jquery.autocomplete.js +0 -1
  220. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressource.js +0 -7
  221. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourcedummy.js +0 -7
  222. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourceregistry.js +0 -7
  223. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Loader/plugin.js +0 -1
  224. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/en.dict +0 -2
  225. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fi.dict +0 -2
  226. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fr.dict +0 -2
  227. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/person.css +0 -3
  228. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/plugin.js +0 -1
  229. data/public/javascripts/admin/aloha/plugins/simpletable/plugin.js.deactivated +0 -2330
@@ -174,7 +174,7 @@ fr:
174
174
  help: "Vous avez le choix de soit uploader n'importe quel fichier ou bien soit de copier/coller du code css ou javascript."
175
175
  edit:
176
176
  title: "Edition %{file}"
177
- help: "Vous pouvez insérer le raccourci suivant dans vos feuilles de style: <strong>%{shortcut_url}</strong> OU utiliser directement l'url : %{url}"
177
+ help: "L'url du fichier est <a href='%{url}'>%{url}</a>"
178
178
  form:
179
179
  choose_file: Choisir fichier
180
180
  choose_plain_text: Passer en mode texte
@@ -219,6 +219,7 @@ fr:
219
219
  new_item: nouvel élément
220
220
  form:
221
221
  order_by:
222
+ created_at: 'Par date création'
222
223
  updated_at: 'Par date de mise à jour'
223
224
  position_in_list: Manuellement
224
225
 
@@ -265,6 +266,34 @@ fr:
265
266
  success: "Votre site a été mis à jour avec succès."
266
267
  failure: "L'import n'a pas fonctionné."
267
268
 
269
+ installation:
270
+ common:
271
+ title: Première installation de Locomotive
272
+ next: Suivant
273
+ step_1:
274
+ title: "Étape 1/3"
275
+ explanations: "Voici la première étape de l'installation de Locomotive. Veuillez lire attentivement ce qui est écrit ci-dessous."
276
+ database:
277
+ label: "Nom base de données: <em>%{name}</em>"
278
+ notes: "Les paramètres de la connection à MongoDB se trouvent dans le fichier <b>config/mongoid.yml</b> de votre application."
279
+ default_domain:
280
+ label: "Nom du domaine par défaut: <em>%{name}</em>"
281
+ notes:
282
+ "Locomotive est une plate-forme multi-sites. Chaque instance de site a une entrée par défaut appelée aussi sous-domaine et qui est aussi fonction du nom de domaine par défaut. Evidemment, vous êtes libres d'associer d'autres noms de domaines, sortes d'alias.
283
+ <br/>La valeur du nom de domaine par défaut se trouve dans le fichier <b>config/initializers/locomotive.rb</b>."
284
+ step_2:
285
+ title: "Étape 2/3 &mdash; Créer un compte"
286
+ name: Nom du compte
287
+ email: E-mail
288
+ password: Mot de passe
289
+ password_confirmation: Confirmation mot de passe
290
+ done: "Vous avez déjà ajouté un compte:<br/><strong>%{name}</strong>, <em>%{email}</em>"
291
+ next: Créer compte
292
+ step_3:
293
+ title: "Étape 3/3 &mdash; Créer premier site"
294
+ explanations: "C'est la dernière étape de l'installation. Vous pouvez uploader un theme sous forme d'un fichier zip. Nous avons quelques themes disponibles <a href=\"http://www.locomotivecms.com/support/themes\">ici</a>."
295
+ next: Créer site
296
+
268
297
  formtastic:
269
298
  titles:
270
299
  information: Informations générales
@@ -297,6 +326,8 @@ fr:
297
326
  import:
298
327
  new:
299
328
  source: Fichier
329
+ samples: Copier contenu
330
+ reset: Remettre à zéro
300
331
 
301
332
  hints:
302
333
  page:
@@ -319,3 +350,5 @@ fr:
319
350
  hint: "Texte affiché dans le formulaire de l'élément juste en dessous du champ."
320
351
  import:
321
352
  source: "Un fichier zip contenant database.yml, les fichiers du thème et les templates de page"
353
+ samples: "Si activé, les contenus et les média seront aussi copiés lors de l'import"
354
+ reset: "Si activé, toutes les données de votre site seront détruites avant l'import du nouveau site"
@@ -13,6 +13,7 @@ en:
13
13
  array_too_short: "is too small (minimum element number is %{count})"
14
14
  liquid_syntax: "Liquid Syntax error, please check the syntax"
15
15
  liquid_extend: "The page extends a template which does not exist"
16
+ invalid_theme_file: "can't be blank or isn't a zip file"
16
17
 
17
18
  attributes:
18
19
  defaults:
@@ -34,6 +34,7 @@ fr:
34
34
  array_too_short: "est trop petit (le nombre minimum d'éléments est %{count})"
35
35
  liquid_syntax: "Erreur de syntaxe dans les sections de page, veuillez vérifier la syntaxe"
36
36
  liquid_extend: "La page étend le contenu d'une page qui n'existe pas"
37
+ invalid_theme_file: "doit être rempli ou n'est pas un fichier zip"
37
38
 
38
39
  attributes:
39
40
  defaults:
@@ -111,5 +111,6 @@ en:
111
111
 
112
112
  imports:
113
113
  create:
114
+ done: "Your site was successfully updated."
114
115
  notice: "Your site is being updated."
115
116
  alert: "The import was not done."
@@ -111,5 +111,6 @@ fr:
111
111
 
112
112
  imports:
113
113
  create:
114
+ done: "Votre site a été mis à jour"
114
115
  notice: "Votre site est en train d'être mis à jour"
115
116
  alert: "L'import n'a pas pu se faire"
@@ -17,8 +17,16 @@ test:
17
17
  # set these environment variables on your prod server
18
18
  production:
19
19
  <<: *defaults
20
- host: <%= ENV['MONGOID_HOST'] %>
21
- port: <%= ENV['MONGOID_PORT'] %>
22
- username: <%= ENV['MONGOID_USERNAME'] %>
23
- password: <%= ENV['MONGOID_PASSWORD'] %>
24
- database: <%= ENV['MONGOID_DATABASE'] %>
20
+ database: locomotive_prod
21
+
22
+ # other settings for production
23
+
24
+ # host: <%= ENV['MONGOID_HOST'] %>
25
+ # port: <%= ENV['MONGOID_PORT'] %>
26
+ # username: <%= ENV['MONGOID_USERNAME'] %>
27
+ # password: <%= ENV['MONGOID_PASSWORD'] %>
28
+ # database: <%= ENV['MONGOID_DATABASE'] %>
29
+
30
+ # heroku
31
+ # uri: <%= ENV['MONGOHQ_URL'] %>
32
+
@@ -2,7 +2,7 @@
2
2
  Rails.application.routes.draw do
3
3
 
4
4
  constraints(Locomotive::Routing::DefaultConstraint) do
5
- root :to => 'home#show'
5
+ root :to => 'admin/sessions#new'
6
6
  end
7
7
 
8
8
  # admin authentication
@@ -52,6 +52,11 @@ Rails.application.routes.draw do
52
52
  resources :cross_domain_sessions, :only => [:new, :create]
53
53
 
54
54
  resource :import, :only => [:new, :show, :create]
55
+
56
+ # installation guide
57
+ match '/installation' => 'installation#show', :defaults => { :step => 1 }, :as => :installation
58
+ match '/installation/:step' => 'installation#show', :as => :installation_step
59
+
55
60
  end
56
61
 
57
62
  # sitemap
@@ -1,21 +1,29 @@
1
1
  module Locomotive
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
 
4
- def self.source_root
5
- @_locomotive_source_root ||= File.expand_path('../templates', __FILE__)
4
+ source_root File.expand_path('../../../../../', __FILE__)
5
+
6
+ def copy_mongoid_config
7
+ copy_file 'config/mongoid.yml', 'config/mongoid.yml'
8
+ end
9
+
10
+ def copy_assets
11
+ directory 'public', 'public', :recursive => true
12
+ copy_file 'config/assets.yml', 'config/assets.yml'
6
13
  end
7
14
 
8
- def copy_initializer
15
+ def copy_initializers
16
+ copy_file 'config/initializers/carrierwave.rb', 'config/initializers/carrierwave.rb'
17
+
18
+ @source_paths = nil # reset it for the find_in_source_paths method
19
+
20
+ Locomotive::InstallGenerator.source_root(File.expand_path('../templates', __FILE__))
21
+
9
22
  template 'locomotive.rb', 'config/initializers/locomotive.rb'
10
23
  end
11
24
 
12
- def seed_db
13
- append_file 'db/seeds.rb', %{
14
- # Uncomment the following lines if you want to create the first website / account
15
- #account = Account.create! :name => 'Admin', :email => 'admin@example.com', :password => 'locomotive', :password_confirmation => 'locomotive'
16
- #site = Site.new :name => 'Locomotive test website', :subdomain => 'test'
17
- #site.memberships.build :account => account, :admin => true
18
- #site.save!}
25
+ def remove_index_html
26
+ remove_file 'public/index.html'
19
27
  end
20
28
 
21
29
  def show_readme
@@ -1,17 +1,27 @@
1
1
  ===============================================================================
2
2
 
3
- Locomotive initializer has been added to your application. Your db/seeds.rb file has also been updated.
4
-
5
- 1. Take a look at this to match your environment.
6
-
7
- 2. Uncomment added code in db/seeds.rb if necessary
8
-
9
- Note: do not forget to run rake db:seed if you modify your db/seeds.rb file.
10
-
11
- Once it is done, the next step is to install assets:
12
-
13
- bundle exec rails g locomotive:copy_assets
14
-
15
- Fire your application server and launch a browser !
3
+ The Locomotive Engine has been correctly installed in your Rails application.
4
+
5
+ 1. Edit the main config files:
6
+
7
+ - config/initializers/locomotive.rb
8
+ - config/initializers/carrierwave.rb
9
+ - config/mongoid.yml
10
+
11
+ 2. Launch the server
12
+
13
+ > unicorn_rails
14
+
15
+ 3. Open your browser
16
+
17
+ > open localhost:8080
18
+
19
+ 4. Follow the installation wizzard steps
20
+
21
+ 5. Enjoy !
22
+
23
+ Note: If you want to use DelayedJob, be sure to launch it:
24
+
25
+ > rake jobs:work
16
26
 
17
27
  ===============================================================================
@@ -2,7 +2,13 @@ Locomotive.configure do |config|
2
2
  # if not defined, locomotive will use example.com as main domain name. Remove prefix www from your domain name.
3
3
  # Ex:
4
4
  # config.default_domain = Rails.env.production? ? 'mydomain.com' : 'example.com'
5
- config.default_domain = 'mydomain.com'
5
+ #
6
+ # If you use locomotive for a single site in Heroku, use "heroku.com" as default domain name.
7
+ # Your heroku app name (<app_name>.heroku.name) will be used as the sub domain name in Locomotive
8
+ # during the installation wizzard.
9
+ # Ex:
10
+ # config.default_domain = Rails.env.production? ? 'heroku.com' : 'example.com'
11
+ config.default_domain = 'example.com'
6
12
 
7
13
  # configure how many items we display in sub menu in the "Contents" section.
8
14
  config.lastest_items_nb = 5
@@ -23,4 +29,12 @@ Locomotive.configure do |config|
23
29
  # Ex:
24
30
  # config.heroku = { :name => '<my heroku app name>', :login => 'john@doe.net', :password => 'easy' }
25
31
  config.heroku = false
32
+
33
+ # Locomotive uses the DelayedJob gem for the theme import module.
34
+ # In case you want to deploy to Heroku, you will have to pay for an extra dyno.
35
+ # If you do not mind about importing theme without DelayedJob, disable it.
36
+ config.delayed_job = false
37
+
38
+ # default locale (for now, only en and fr are supported)
39
+ config.default_locale = :en
26
40
  end
@@ -5,3 +5,4 @@ require 'locomotive/carrierwave/patches'
5
5
  # register missing mime types
6
6
  EXTENSIONS[:eot] = 'application/vnd.ms-fontobject'
7
7
  EXTENSIONS[:woff] = 'application/x-woff'
8
+ EXTENSIONS[:otf] = 'application/octet-stream'
@@ -10,7 +10,9 @@ module Locomotive
10
10
  :locales => %w{en fr},
11
11
  :cookie_key => '_locomotive_session',
12
12
  :enable_logs => false,
13
- :heroku => false
13
+ :heroku => false,
14
+ :delayed_job => true,
15
+ :default_locale => :en
14
16
  }
15
17
 
16
18
  cattr_accessor :settings
@@ -5,7 +5,6 @@ module CustomFields
5
5
  class FileUploader < ::CarrierWave::Uploader::Base
6
6
 
7
7
  def store_dir
8
- puts
9
8
  "sites/#{model.site_id}/contents/#{model.class.model_name.underscore}/#{model.id}/files"
10
9
  end
11
10
 
@@ -1,5 +1,4 @@
1
- require 'delayed_job'
2
- require 'delayed/backend/mongoid'
1
+ require 'delayed_job_mongoid'
3
2
 
4
3
  module Delayed
5
4
  module Backend
@@ -1,20 +1,37 @@
1
- puts "...Locomotive engine loaded"
1
+ puts "...loading Locomotive engine"
2
2
 
3
- require 'mimetype_fu'
4
- require 'liquid'
3
+ require 'rails'
5
4
  require 'devise'
6
- require 'carrierwave'
7
- require 'formtastic'
8
5
  require 'mongoid'
9
6
  require 'mongoid_acts_as_tree'
7
+ require 'will_paginate'
8
+ require 'haml'
9
+ require 'liquid'
10
+ require 'formtastic'
11
+ require 'inherited_resources'
12
+ require 'carrierwave'
13
+ require 'custom_fields'
14
+ require 'mimetype_fu'
15
+ require 'actionmailer_with_request'
16
+ require 'heroku'
10
17
  require 'httparty'
11
18
  require 'redcloth'
12
- require 'actionmailer_with_request'
19
+ require 'delayed_job_mongoid'
13
20
  require 'zip/zipfilesystem'
14
- require 'custom_fields'
21
+ require 'jammit-s3'
22
+
23
+ $:.unshift File.dirname(__FILE__)
15
24
 
16
25
  module Locomotive
17
26
  class Engine < Rails::Engine
18
27
 
28
+ rake_tasks do
29
+ load "railties/tasks.rake"
30
+ end
31
+
32
+ initializer "serving fonts" do |app|
33
+ app.middleware.insert_after Rack::Lock, '::Locomotive::Middlewares::Fonts', :path => %r{^/fonts}
34
+ end
35
+
19
36
  end
20
37
  end
@@ -1,4 +1,5 @@
1
1
  require 'heroku'
2
+ require 'heroku/client'
2
3
  require 'locomotive/heroku/custom_domain'
3
4
 
4
5
  module Locomotive
@@ -17,7 +17,18 @@ module Locomotive
17
17
 
18
18
  # puts "[WebService] consuming #{path}, #{options.inspect}"
19
19
 
20
- self.get(path, options).try(:underscore_keys)
20
+ response = self.get(path, options)
21
+
22
+ if response.code == 200
23
+ if response.respond_to?(:underscore_keys)
24
+ response.underscore_keys
25
+ else
26
+ response.collect(&:underscore_keys)
27
+ end
28
+ else
29
+ nil
30
+ end
31
+
21
32
  end
22
33
 
23
34
  end
@@ -1,3 +1,5 @@
1
+ require 'locomotive/import/logger'
2
+ require 'locomotive/import/base'
1
3
  require 'locomotive/import/job'
2
4
  require 'locomotive/import/site'
3
5
  require 'locomotive/import/assets'
@@ -1,30 +1,34 @@
1
1
  module Locomotive
2
2
  module Import
3
- module AssetCollections
4
-
5
- def self.process(context)
6
- site, database = context[:site], context[:database]
3
+ class AssetCollections < Base
7
4
 
5
+ def process
8
6
  asset_collections = database['site']['asset_collections']
9
7
 
10
8
  return if asset_collections.nil?
11
9
 
12
10
  asset_collections.each do |name, attributes|
13
- puts "....asset_collection = #{attributes['slug']}"
11
+ self.log "slug = #{attributes['slug']}"
14
12
 
15
13
  asset_collection = site.asset_collections.where(:slug => attributes['slug']).first
16
14
 
17
- asset_collection ||= self.build_asset_collection(site, attributes.merge(:name => name))
15
+ asset_collection ||= self.build_asset_collection(attributes.merge(:name => name))
18
16
 
19
17
  self.add_or_update_fields(asset_collection, attributes['fields'])
20
18
 
19
+ if options[:samples] && attributes['assets']
20
+ self.insert_samples(asset_collection, attributes['assets'])
21
+ end
22
+
21
23
  asset_collection.save!
22
24
 
23
25
  site.reload
24
26
  end
25
27
  end
26
28
 
27
- def self.build_asset_collection(site, data)
29
+ protected
30
+
31
+ def build_asset_collection(data)
28
32
  attributes = { :internal => false }.merge(data)
29
33
 
30
34
  attributes.delete_if { |name, value| %w{fields assets}.include?(name) }
@@ -32,7 +36,7 @@ module Locomotive
32
36
  site.asset_collections.build(attributes)
33
37
  end
34
38
 
35
- def self.add_or_update_fields(asset_collection, fields)
39
+ def add_or_update_fields(asset_collection, fields)
36
40
  fields.each_with_index do |data, position|
37
41
  name, data = data.keys.first, data.values.first
38
42
 
@@ -48,6 +52,34 @@ module Locomotive
48
52
  end
49
53
  end
50
54
 
55
+ def insert_samples(asset_collection, assets)
56
+ assets.each_with_index do |data, position|
57
+ value, attributes = data.is_a?(Array) ? [data.first, data.last] : [data.keys.first, data.values.first]
58
+
59
+ url = attributes.delete('url')
60
+
61
+ # build with default attributes
62
+ asset = asset_collection.assets.build(:name => value, :position => position, :source => self.open_sample_asset(url))
63
+
64
+ attributes.each do |name, value|
65
+ field = asset_collection.asset_custom_fields.detect { |f| f._alias == name }
66
+
67
+ value = (case field.kind.downcase
68
+ when 'file' then self.open_sample_asset(value)
69
+ when 'boolean' then Boolean.set(value)
70
+ else
71
+ value
72
+ end)
73
+
74
+ asset.send("#{name}=", value)
75
+ end
76
+
77
+ asset.save
78
+
79
+ self.log "insert asset '#{asset.name}'"
80
+ end
81
+ end
82
+
51
83
  end
52
84
  end
53
85
  end