locomotive_cms 0.0.4.beta12 → 0.0.4

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 +13 -15
  2. data/README.textile +4 -5
  3. data/app/controllers/admin/api_contents_controller.rb +1 -10
  4. data/app/controllers/admin/base_controller.rb +2 -2
  5. data/app/controllers/admin/cross_domain_sessions_controller.rb +4 -7
  6. data/app/controllers/admin/current_sites_controller.rb +0 -2
  7. data/app/controllers/admin/imports_controller.rb +19 -13
  8. data/app/controllers/admin/pages_controller.rb +1 -1
  9. data/app/controllers/admin/passwords_controller.rb +2 -2
  10. data/app/controllers/admin/sessions_controller.rb +2 -2
  11. data/app/controllers/admin/sites_controller.rb +0 -2
  12. data/app/controllers/admin/theme_assets_controller.rb +1 -1
  13. data/app/controllers/application_controller.rb +1 -1
  14. data/app/controllers/home_controller.rb +7 -0
  15. data/app/helpers/admin/assets_helper.rb +6 -0
  16. data/app/helpers/admin/custom_fields_helper.rb +2 -2
  17. data/app/helpers/admin/{box_helper.rb → login_helper.rb} +3 -7
  18. data/app/models/asset_collection.rb +3 -15
  19. data/app/models/content_instance.rb +0 -19
  20. data/app/models/content_type.rb +3 -21
  21. data/app/models/extensions/page/tree.rb +7 -63
  22. data/app/models/page.rb +0 -2
  23. data/app/models/site.rb +3 -15
  24. data/app/uploaders/asset_uploader.rb +1 -1
  25. data/app/uploaders/theme_asset_uploader.rb +1 -12
  26. data/app/views/admin/asset_collections/edit.html.haml +2 -2
  27. data/app/views/admin/asset_collections/new.html.haml +1 -1
  28. data/app/views/admin/assets/_form.html.haml +2 -2
  29. data/app/views/admin/content_types/_form.html.haml +2 -2
  30. data/app/views/admin/content_types/new.html.haml +1 -1
  31. data/app/views/admin/contents/_form.html.haml +2 -2
  32. data/app/views/admin/contents/index.html.haml +1 -1
  33. data/app/views/admin/cross_domain_sessions/new.html.haml +1 -1
  34. data/app/views/admin/current_sites/_form.html.haml +3 -3
  35. data/app/views/admin/current_sites/edit.html.haml +1 -1
  36. data/app/views/admin/imports/new.html.haml +0 -11
  37. data/app/views/admin/imports/show.html.haml +1 -1
  38. data/app/views/admin/my_accounts/edit.html.haml +1 -1
  39. data/app/views/admin/pages/_form.html.haml +3 -2
  40. data/app/views/admin/pages/_page.html.haml +2 -4
  41. data/app/views/admin/pages/index.html.haml +1 -1
  42. data/app/views/admin/passwords/edit.html.haml +2 -2
  43. data/app/views/admin/passwords/new.html.haml +2 -2
  44. data/app/views/admin/sessions/new.html.haml +2 -2
  45. data/app/views/admin/shared/_head.html.haml +5 -4
  46. data/app/views/admin/shared/menu/_contents.html.haml +1 -1
  47. data/app/views/admin/sites/_form.html.haml +3 -3
  48. data/app/views/admin/snippets/_form.html.haml +2 -2
  49. data/app/views/admin/snippets/index.html.haml +15 -0
  50. data/app/views/admin/theme_assets/_form.html.haml +2 -2
  51. data/app/views/admin/theme_assets/index.html.haml +1 -1
  52. data/app/views/home/show.html.haml +4 -0
  53. data/app/views/{admin/layouts → layouts/admin}/application.html.haml +0 -0
  54. data/app/views/layouts/admin/box.html.haml +19 -0
  55. data/app/views/layouts/application.html.haml +7 -0
  56. data/config/application.rb +3 -1
  57. data/config/environments/development.rb +6 -1
  58. data/config/environments/production.rb +1 -1
  59. data/config/environments/test.rb +5 -1
  60. data/config/initializers/locomotive.rb +0 -14
  61. data/config/locales/admin_ui_en.yml +1 -33
  62. data/config/locales/admin_ui_fr.yml +1 -34
  63. data/config/locales/default_en.yml +0 -1
  64. data/config/locales/default_fr.yml +0 -1
  65. data/config/locales/flash.en.yml +0 -1
  66. data/config/locales/flash.fr.yml +0 -1
  67. data/config/mongoid.yml +5 -13
  68. data/config/routes.rb +1 -6
  69. data/lib/generators/locomotive/copy_assets/copy_assets_generator.rb +14 -0
  70. data/lib/generators/locomotive/install/install_generator.rb +10 -18
  71. data/lib/generators/locomotive/install/templates/README +13 -23
  72. data/lib/generators/locomotive/install/templates/locomotive.rb +1 -15
  73. data/lib/locomotive/carrierwave.rb +0 -1
  74. data/lib/locomotive/configuration.rb +1 -3
  75. data/lib/locomotive/custom_fields.rb +1 -0
  76. data/lib/locomotive/delayed_job.rb +2 -1
  77. data/lib/locomotive/engine.rb +7 -24
  78. data/lib/locomotive/heroku.rb +0 -1
  79. data/lib/locomotive/httparty/webservice.rb +1 -12
  80. data/lib/locomotive/import.rb +0 -2
  81. data/lib/locomotive/import/asset_collections.rb +8 -40
  82. data/lib/locomotive/import/assets.rb +12 -20
  83. data/lib/locomotive/import/content_types.rb +15 -51
  84. data/lib/locomotive/import/job.rb +11 -106
  85. data/lib/locomotive/import/pages.rb +26 -79
  86. data/lib/locomotive/import/site.rb +5 -3
  87. data/lib/locomotive/import/snippets.rb +8 -6
  88. data/lib/locomotive/inherited_resources.rb +0 -1
  89. data/lib/locomotive/liquid/drops/asset_collections.rb +4 -4
  90. data/lib/locomotive/liquid/drops/contents.rb +16 -21
  91. data/lib/locomotive/liquid/drops/page.rb +0 -4
  92. data/lib/locomotive/liquid/filters/html.rb +29 -15
  93. data/lib/locomotive/liquid/tags/consume.rb +1 -1
  94. data/lib/locomotive/liquid/tags/nav.rb +17 -48
  95. data/lib/locomotive/liquid/tags/paginate.rb +3 -3
  96. data/lib/locomotive/middlewares/fonts.rb +11 -3
  97. data/lib/locomotive/misc_form_builder.rb +7 -2
  98. data/lib/locomotive/regexps.rb +1 -1
  99. data/lib/locomotive/render.rb +3 -9
  100. data/lib/locomotive/routing/site_dispatcher.rb +6 -10
  101. data/lib/locomotive/version.rb +1 -2
  102. data/public/images/admin/box/buttons/right_bg.png +0 -0
  103. data/public/javascripts/admin/aloha/VERSION.txt +1 -1
  104. data/public/javascripts/admin/aloha/aloha-nodeps.js +101 -140
  105. data/public/javascripts/admin/aloha/aloha.js +105 -193
  106. data/public/javascripts/admin/aloha/css/aloha.css +4 -65
  107. data/public/javascripts/admin/aloha/deps/prettyPhoto/resources/css/prettyPhoto.css +2 -2
  108. data/public/javascripts/admin/aloha/i18n/de.dict +0 -2
  109. data/public/javascripts/admin/aloha/i18n/en.dict +0 -2
  110. data/public/javascripts/admin/aloha/images/base.png +0 -0
  111. data/public/javascripts/admin/aloha/images/base_multi.png +0 -0
  112. data/public/javascripts/admin/aloha/images/fade_in.png +0 -0
  113. data/public/javascripts/admin/aloha/images/fade_out.png +0 -0
  114. data/public/javascripts/admin/aloha/images/gentics_logo.png +0 -0
  115. data/public/javascripts/admin/aloha/images/grabhandle.png +0 -0
  116. data/public/javascripts/admin/aloha/images/maximize.png +0 -0
  117. data/public/javascripts/admin/aloha/images/pin.png +0 -0
  118. data/public/javascripts/admin/aloha/images/removeformat.png +0 -0
  119. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/de.dict +2 -0
  120. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/en.dict +2 -0
  121. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/eo.dict +2 -0
  122. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fi.dict +2 -0
  123. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fr.dict +2 -0
  124. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/it.dict +2 -0
  125. data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/plugin.js +7 -0
  126. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/i18n/de.dict +0 -0
  127. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/i18n/en.dict +0 -0
  128. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/i18n/fi.dict +0 -0
  129. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/i18n/fr.dict +0 -0
  130. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/i18n/it.dict +0 -0
  131. data/public/javascripts/admin/aloha/plugins/{com.example.aloha.plugins.Save → com.example.aloha.DummySave}/plugin.js +0 -0
  132. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js +1 -1
  133. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/de.dict +20 -0
  134. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/en.dict +20 -0
  135. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/eo.dict +16 -0
  136. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fi.dict +20 -0
  137. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fr.dict +16 -0
  138. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/it.dict +20 -0
  139. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/plugin.js +7 -0
  140. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js +1 -1
  141. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/css/jquery.autocomplete.css +48 -0
  142. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/deps/jquery.autocomplete.js +1 -0
  143. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js +1 -1
  144. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressource.js +7 -0
  145. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourcedummy.js +7 -0
  146. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourceregistry.js +7 -0
  147. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js +1 -1
  148. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/plugin.js +1 -1
  149. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/de.dict +0 -2
  150. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/en.dict +0 -2
  151. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js +1 -1
  152. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css +110 -28
  153. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Loader/plugin.js +1 -0
  154. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/en.dict +2 -0
  155. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fi.dict +2 -0
  156. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fr.dict +2 -0
  157. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/person.css +3 -0
  158. data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/plugin.js +1 -0
  159. data/public/javascripts/admin/aloha/plugins/simpletable/plugin.js.deactivated +2330 -0
  160. data/public/javascripts/admin/asset_collections.js +7 -11
  161. data/public/javascripts/admin/contents.js +1 -3
  162. data/public/javascripts/admin/site.js +3 -9
  163. data/public/javascripts/admin/snippets.js +1 -1
  164. data/public/javascripts/admin/utils.js +3 -5
  165. data/public/stylesheets/admin/application.css +1 -1
  166. data/public/stylesheets/admin/box.css +5 -5
  167. data/public/stylesheets/admin/buttons.css +5 -0
  168. data/public/stylesheets/admin/formtastic_changes.css +12 -5
  169. data/public/stylesheets/admin/inline_editor.css +5 -22
  170. data/public/stylesheets/admin/layout.css +4 -9
  171. metadata +130 -187
  172. data/app/controllers/admin/installation_controller.rb +0 -79
  173. data/app/uploaders/theme_uploader.rb +0 -19
  174. data/app/views/admin/errors/no_page.html.haml +0 -1
  175. data/app/views/admin/errors/no_site.html.haml +0 -1
  176. data/app/views/admin/installation/step_1.html.haml +0 -24
  177. data/app/views/admin/installation/step_2.html.haml +0 -26
  178. data/app/views/admin/installation/step_3.html.haml +0 -23
  179. data/app/views/admin/layouts/box.html.haml +0 -21
  180. data/app/views/admin/layouts/error.html.haml +0 -1
  181. data/config/assets.yml +0 -96
  182. data/config/initializers/carrierwave.rb +0 -17
  183. data/lib/locomotive/import/base.rb +0 -46
  184. data/lib/locomotive/import/logger.rb +0 -13
  185. data/lib/locomotive/railties/tasks.rake +0 -16
  186. data/public/javascripts/admin/aloha/i18n/pl.dict +0 -5
  187. data/public/javascripts/admin/aloha/images/base_big.png +0 -0
  188. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.css +0 -86
  189. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.html +0 -44
  190. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/de.dict +0 -4
  191. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/en.dict +0 -4
  192. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/fr.dict +0 -4
  193. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/plugin.js +0 -1
  194. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/product.js +0 -1
  195. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/2xu-wetsuit.jpg +0 -0
  196. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/asics-noosa.jpg +0 -0
  197. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/fivefingers-kso.jpg +0 -0
  198. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/kuota-kueen-k.jpg +0 -0
  199. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/mizuno-wave-musha2.jpg +0 -0
  200. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product.css +0 -69
  201. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product_button.gif +0 -0
  202. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/simplon-mrt.jpg +0 -0
  203. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trek-fuel-ex.jpg +0 -0
  204. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trisports.jpg +0 -0
  205. data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/zoggs-predator.jpg +0 -0
  206. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.css +0 -48
  207. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.html +0 -69
  208. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/de.dict +0 -4
  209. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/en.dict +0 -4
  210. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/plugin.js +0 -7
  211. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/i18n/pl.dict +0 -30
  212. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js +0 -7
  213. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/delicious.js +0 -7
  214. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/i18n/pl.dict +0 -4
  215. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/css/LinkChecker.css +0 -14
  216. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.css +0 -49
  217. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.html +0 -82
  218. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/i18n/en.dict +0 -27
  219. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/plugin.js +0 -7
  220. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php +0 -235
  221. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/plugin.js +0 -7
  222. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js +0 -7
  223. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/de.dict +0 -1
  224. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/en.dict +0 -1
  225. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/pl.dict +0 -12
  226. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png +0 -0
  227. data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png +0 -0
  228. data/public/stylesheets/admin/installation.css +0 -50
  229. data/public/stylesheets/admin/safari.css +0 -15
data/Gemfile CHANGED
@@ -8,9 +8,8 @@ gem 'warden'
8
8
  gem 'devise', '= 1.1.3'
9
9
 
10
10
  gem 'mongoid', '2.0.0.beta.19'
11
- gem 'bson_ext', '1.1.5'
11
+ gem 'bson_ext', '1.1.1'
12
12
  gem 'locomotive_mongoid_acts_as_tree', '0.1.5.1', :require => 'mongoid_acts_as_tree'
13
- gem 'will_paginate'
14
13
 
15
14
  gem 'haml', '= 3.0.18'
16
15
  gem 'locomotive_liquid', '2.2.2', :require => 'liquid'
@@ -18,39 +17,38 @@ gem 'formtastic', '>= 1.1.0'
18
17
  gem 'inherited_resources', '>= 1.1.2'
19
18
 
20
19
  gem 'rmagick', '= 2.12.2'
21
- gem 'locomotive_carrierwave', '0.5.0.1.beta2', :require => 'carrierwave'
20
+ gem 'locomotive_carrierwave', :require => 'carrierwave'
22
21
 
23
- gem 'custom_fields', '1.0.0.beta2'
24
- gem 'fog', '0.3.7'
22
+ gem 'custom_fields', '1.0.0.beta'
23
+ gem 'fog'
25
24
  gem 'mimetype-fu'
26
25
  gem 'actionmailer-with-request'
27
26
  gem 'heroku'
28
27
  gem 'httparty', '>= 0.6.1'
29
28
  gem 'RedCloth'
30
- gem 'delayed_job', '2.1.2'
31
- gem 'delayed_job_mongoid', '1.0.1'
29
+ gem 'delayed_job', '2.1.0.pre2'
30
+ gem 'delayed_job_mongoid', '1.0.0.rc'
32
31
  gem 'rubyzip'
33
- gem 'locomotive_jammit-s3', :require => 'jammit-s3'
34
32
 
35
33
  # The rest of the dependencies are for use when in the locomotive dev environment
36
34
 
37
35
  group :development do
38
- # Using unicorn_rails instead of webrick (default server)
39
- gem 'unicorn'
36
+ # Using mongrel instead of webrick (default server)
37
+ gem 'mongrel'
38
+ gem 'cgi_multipart_eof_fix'
39
+ gem 'fastthread'
40
40
  end
41
41
 
42
42
  group :test, :development do
43
- gem "ruby-debug", :platforms => :mri_18
44
- gem "ruby-debug19", :platforms => :mri_19
43
+ gem 'ruby-debug'
45
44
  end
46
45
 
47
46
  group :test do
48
47
  gem 'autotest'
49
- gem 'ZenTest'
50
48
  gem 'growl-glue'
51
- gem 'rspec-rails', '2.3.1'
49
+ gem 'rspec-rails', '>= 2.0.0.beta.18'
52
50
  gem 'factory_girl_rails'
53
- gem 'pickle'
51
+ gem 'pickle', :git => 'http://github.com/ianwhite/pickle.git'
54
52
  gem 'capybara'
55
53
 
56
54
  gem 'database_cleaner'
@@ -5,7 +5,7 @@ Locomotive is a simple but powerful CMS based on liquid templates and mongodb da
5
5
  If we have to give only 5 main features to describe our application, there will be:
6
6
 
7
7
  * managing as many websites as you want with one application instance
8
- * nice looking UI (see http://www.locomotivecms.com for some screenshots)
8
+ * nice looking UI (see http://www.locomotiveapp.org for some screenshots)
9
9
  * flexible content types
10
10
  * playing smoothly with Heroku and MongoHQ
11
11
  * inline editing (beta)
@@ -19,18 +19,17 @@ h2. Gems
19
19
 
20
20
  Here is a short list of main gems used in the application.
21
21
 
22
- * Rails 3.0.3
23
- * Mongoid 2.0.0.beta 19 (with MongoDB 1.6)
22
+ * Rails 3.0
23
+ * Mongoid 2.0.0.beta 17 (with MongoDB 1.6)
24
24
  * Liquid
25
25
  * Devise
26
26
  * Carrierwave
27
27
  * Haml
28
28
  * Delayed job
29
- * Jammit-s3
30
29
 
31
30
  h2. Installation
32
31
 
33
- See the "official website":http://www.locomotivecms.com
32
+ See the "official website":http://www.locomotiveapp.org
34
33
 
35
34
  h2. Team
36
35
 
@@ -13,17 +13,8 @@ module Admin
13
13
  respond_to do |format|
14
14
  if @content.save
15
15
  format.json { render :json => { :content => @content } }
16
- format.html do
17
- flash[@content_type.slug.singularize] = @content.aliased_attributes
18
- redirect_to params[:success_callback]
19
- end
20
16
  else
21
17
  format.json { render :json => { :content => @content, :errors => @content.errors } }
22
- format.html do
23
- flash[@content_type.slug.singularize] = @content.aliased_attributes
24
- flash['errors'] = @content.errors_to_hash
25
- redirect_to params[:error_callback]
26
- end
27
18
  end
28
19
  end
29
20
  end
@@ -32,7 +23,7 @@ module Admin
32
23
 
33
24
  def set_content_type
34
25
  @content_type = current_site.content_types.where(:slug => params[:slug]).first
35
- render :json => { :error => 'Api not enabled' } and return false unless @content_type.api_enabled
26
+ render :json => { :error => 'Api not enabled'} and return false unless @content_type.api_enabled
36
27
  end
37
28
 
38
29
  end
@@ -3,7 +3,7 @@ module Admin
3
3
 
4
4
  include Locomotive::Routing::SiteDispatcher
5
5
 
6
- layout '/admin/layouts/application'
6
+ layout 'admin/application'
7
7
 
8
8
  before_filter :authenticate_admin!
9
9
 
@@ -49,7 +49,7 @@ module Admin
49
49
  end
50
50
 
51
51
  def set_locale
52
- I18n.locale = current_admin.locale rescue Locomotive.config.default_locale
52
+ I18n.locale = current_admin.locale
53
53
  end
54
54
 
55
55
  end
@@ -1,22 +1,19 @@
1
1
  module Admin
2
2
  class CrossDomainSessionsController < BaseController
3
3
 
4
- layout '/admin/layouts/box'
4
+ layout 'admin/box'
5
5
 
6
6
  skip_before_filter :verify_authenticity_token
7
7
 
8
8
  skip_before_filter :validate_site_membership
9
9
 
10
+ skip_before_filter :set_locale, :only => :create
11
+
10
12
  before_filter :authenticate_admin!, :only => :new
11
13
 
12
14
  def new
13
15
  if site = current_admin.sites.detect { |s| s._id.to_s == params[:target_id] }
14
- if Rails.env == 'development'
15
- @target = site.full_subdomain
16
- else
17
- @target = site.domains_without_subdomain.first || site.full_subdomain
18
- end
19
-
16
+ @target = site.domains_without_subdomain.first || site.domains_with_subdomain.first
20
17
  current_admin.reset_switch_site_token!
21
18
  else
22
19
  redirect_to admin_pages_path
@@ -1,8 +1,6 @@
1
1
  module Admin
2
2
  class CurrentSitesController < BaseController
3
3
 
4
- defaults :instance_name => 'site'
5
-
6
4
  sections 'settings', 'site'
7
5
 
8
6
  actions :edit, :update
@@ -17,29 +17,35 @@ module Admin
17
17
  :failed => @job && @job.last_error.present?
18
18
  } }
19
19
  end
20
+
20
21
  end
21
22
 
22
23
  def new; end
23
24
 
24
25
  def create
25
- begin
26
- Locomotive::Import::Job.run!(params[:zipfile], current_site, {
27
- :samples => Boolean.set(params[:samples]),
28
- :reset => Boolean.set(params[:reset])
29
- })
30
-
31
- flash[:notice] = t("flash.admin.imports.create.#{Locomotive.config.delayed_job ? 'notice' : 'done'}")
26
+ if params[:zipfile].blank?
27
+ @error = t('errors.messages.blank')
28
+ flash[:alert] = t('flash.admin.imports.create.alert')
29
+ render 'new'
30
+ else
31
+ path = self.store_zipfile!
32
32
 
33
- redirect_to Locomotive.config.delayed_job ? admin_import_url : new_admin_import_url
34
- rescue Exception => e
35
- logger.error "[Locomotive import] #{e.message}"
33
+ job = Locomotive::Import::Job.new(path, current_site)
34
+ Delayed::Job.enqueue job, { :site => current_site, :job_type => 'import' }
36
35
 
37
- @error = t('errors.messages.invalid_theme_file')
38
- flash[:alert] = t('flash.admin.imports.create.alert')
36
+ flash[:notice] = t('flash.admin.imports.create.notice')
39
37
 
40
- render 'new'
38
+ redirect_to admin_import_url
41
39
  end
42
40
  end
43
41
 
42
+ protected
43
+
44
+ def store_zipfile!
45
+ file = CarrierWave::SanitizedFile.new(params[:zipfile])
46
+ file.move_to(File.join(Rails.root, 'tmp', 'files', current_site.id.to_s))
47
+ file.path
48
+ end
49
+
44
50
  end
45
51
  end
@@ -6,7 +6,7 @@ module Admin
6
6
  respond_to :json, :only => [:update, :sort, :get_path]
7
7
 
8
8
  def index
9
- @pages = current_site.all_pages_in_once
9
+ @pages = current_site.pages.roots
10
10
  end
11
11
 
12
12
  def new
@@ -3,11 +3,11 @@ module Admin
3
3
 
4
4
  include Locomotive::Routing::SiteDispatcher
5
5
 
6
- layout '/admin/layouts/box'
6
+ layout 'admin/box'
7
7
 
8
8
  before_filter :require_site
9
9
 
10
- helper 'admin/base', 'admin/box'
10
+ helper 'admin/base', 'admin/login'
11
11
 
12
12
  end
13
13
  end
@@ -3,11 +3,11 @@ module Admin
3
3
 
4
4
  include Locomotive::Routing::SiteDispatcher
5
5
 
6
- layout '/admin/layouts/box'
6
+ layout 'admin/box'
7
7
 
8
8
  before_filter :require_site
9
9
 
10
- helper 'admin/base', 'admin/box'
10
+ helper 'admin/base', 'admin/login'
11
11
 
12
12
  protected
13
13
 
@@ -1,8 +1,6 @@
1
1
  module Admin
2
2
  class SitesController < BaseController
3
3
 
4
- defaults :instance_name => 'site'
5
-
6
4
  sections 'settings'
7
5
 
8
6
  def create
@@ -16,7 +16,7 @@ module Admin
16
16
  @js_and_css_assets = (@assets[:javascripts] || []) + (@assets[:stylesheets] || [])
17
17
 
18
18
  if request.xhr?
19
- @images = @assets[:images] || []
19
+ @images = @assets[:images]
20
20
  render :action => 'images', :layout => false and return
21
21
  else
22
22
  @snippets = current_site.snippets.order_by([[:name, :asc]]).all.to_a
@@ -6,6 +6,6 @@ class ApplicationController < ActionController::Base
6
6
  # rescue_from Exception, :with => :render_error
7
7
  #
8
8
  # def render_error
9
- # render :template => "/admin/errors/500", :layout => '/admin/layouts/box', :status => 500
9
+ # render :template => "/admin/errors/500", :layout => 'admin/box', :status => 500
10
10
  # end
11
11
  end
@@ -0,0 +1,7 @@
1
+ class HomeController < ApplicationController
2
+
3
+ def show; end
4
+
5
+ def unknown; end
6
+
7
+ end
@@ -12,4 +12,10 @@ module Admin::AssetsHelper
12
12
  asset.new_record? || asset.stylesheet? || asset.javascript?
13
13
  end
14
14
 
15
+ def image_picker_include_tags
16
+ html = javascript_include_tag 'admin/plugins/json2', 'admin/plugins/scrollTo', 'admin/plugins/codemirror/codemirror', 'admin/plugins/fancybox', 'admin/plugins/plupload/plupload.full', 'admin/plugins/imagepicker'
17
+ html += stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
18
+ html
19
+ end
20
+
15
21
  end
@@ -7,7 +7,7 @@ module Admin::CustomFieldsHelper
7
7
  end
8
8
 
9
9
  def options_for_order_by(content_type, collection_name)
10
- options = %w{created_at updated_at _position_in_list}.map do |type|
10
+ options = %w{updated_at _position_in_list}.map do |type|
11
11
  [t("admin.content_types.form.order_by.#{type.gsub(/^_/, '')}"), type]
12
12
  end
13
13
  options + options_for_highlighted_field(content_type, collection_name)
@@ -16,7 +16,7 @@ module Admin::CustomFieldsHelper
16
16
  def options_for_highlighted_field(content_type, collection_name)
17
17
  custom_fields_collection_name = "ordered_#{collection_name.singularize}_custom_fields".to_sym
18
18
  collection = content_type.send(custom_fields_collection_name)
19
- collection.delete_if { |f| f.label == 'field name' || f.kind == 'file' }
19
+ collection.delete_if { |f| f.label == 'field name' }
20
20
  collection.map { |field| [field.label, field._name] }
21
21
  end
22
22
 
@@ -1,6 +1,6 @@
1
- module Admin::BoxHelper
1
+ module Admin::LoginHelper
2
2
 
3
- def box_flash_message
3
+ def login_flash_message
4
4
  if not flash.empty?
5
5
  content_tag :div, flash.values.first,
6
6
  :id => "flash-#{flash.keys.first}",
@@ -10,12 +10,8 @@ module Admin::BoxHelper
10
10
  end
11
11
  end
12
12
 
13
- def box_button_tag(label)
13
+ def login_button_tag(label)
14
14
  content_tag(:button, content_tag(:span, label), :type => 'submit', :class => 'button')
15
15
  end
16
16
 
17
- def next_installation_step_link(step = 1, label = nil)
18
- link_to(content_tag(:span, label || t('admin.installation.common.next')), admin_installation_step_url(step), :class => 'button')
19
- end
20
-
21
17
  end
@@ -18,7 +18,6 @@ class AssetCollection
18
18
  ## callbacks ##
19
19
  before_validation :normalize_slug
20
20
  before_save :store_asset_positions!
21
- after_destroy :remove_uploaded_files
22
21
 
23
22
  ## validations ##
24
23
  validates_presence_of :site, :name, :slug
@@ -54,28 +53,17 @@ class AssetCollection
54
53
  end
55
54
 
56
55
  def store_asset_positions!
57
- return if @assets_order.blank?
56
+ return if @assets_order.nil?
58
57
 
59
- ids = @assets_order.split(',').collect { |id| BSON::ObjectId(id) }
60
-
61
- ids.each_with_index do |asset_id, index|
58
+ @assets_order.split(',').each_with_index do |asset_id, index|
62
59
  self.assets.find(asset_id).position = index
63
60
  end
64
61
 
65
62
  self.assets.clone.each do |asset|
66
- if !ids.include?(asset._id)
63
+ if !@assets_order.split(',').include?(asset._id)
67
64
  self.assets.delete(asset)
68
65
  asset.send(:delete)
69
66
  end
70
67
  end
71
68
  end
72
-
73
- def remove_uploaded_files # callbacks are not called on each asset so we do it manually
74
- self.assets.each do |asset|
75
- self.asset_custom_fields.each do |field|
76
- asset.send(:"remove_#{field._name}!") if field.kind == 'file'
77
- end
78
- end
79
- end
80
-
81
69
  end
@@ -28,7 +28,6 @@ class ContentInstance
28
28
  ## methods ##
29
29
 
30
30
  alias :visible? :_visible?
31
- alias :_permalink :_slug
32
31
 
33
32
  def site_id # needed by the uploader of custom fields
34
33
  self.content_type.site_id
@@ -38,24 +37,6 @@ class ContentInstance
38
37
  self._visible || self._visible.nil?
39
38
  end
40
39
 
41
- def aliased_attributes # TODO: move it to the custom_fields gem
42
- hash = { :created_at => self.created_at, :updated_at => self.updated_at }
43
-
44
- self.custom_fields.each do |field|
45
- case field.kind
46
- when 'file' then hash[field._alias] = self.send(field._name.to_sym).url
47
- else
48
- hash[field._alias] = self.send(field._name.to_sym)
49
- end
50
- end
51
-
52
- hash
53
- end
54
-
55
- def errors_to_hash
56
- Hash.new.replace(self.errors)
57
- end
58
-
59
40
  def to_liquid
60
41
  Locomotive::Liquid::Drops::Content.new(self)
61
42
  end
@@ -25,7 +25,6 @@ class ContentType
25
25
  ## callbacks ##
26
26
  before_validation :normalize_slug
27
27
  before_save :set_default_values
28
- after_destroy :remove_uploaded_files
29
28
 
30
29
  ## validations ##
31
30
  validates_presence_of :site, :name, :slug
@@ -63,22 +62,13 @@ class ContentType
63
62
  (if conditions.nil? || conditions.empty?
64
63
  self.contents
65
64
  else
66
- conditions_with_names = {}
67
-
68
- conditions.each do |key, value|
69
- # convert alias (key) to name
70
- field = self.content_custom_fields.detect { |f| f._alias == key }
71
-
72
- conditions_with_names[field._name.to_sym] = value
73
- end
74
-
75
- self.contents.where(conditions_with_names)
65
+ self.contents.where(conditions)
76
66
  end).sort { |a, b| (a.send(column) || 0) <=> (b.send(column) || 0) }
77
67
  end
78
68
 
79
69
  def sort_contents!(order)
80
70
  order.split(',').each_with_index do |id, position|
81
- self.contents.find(BSON::ObjectId(id))._position_in_list = position
71
+ self.contents.find(id)._position_in_list = position
82
72
  end
83
73
  self.save
84
74
  end
@@ -94,7 +84,7 @@ class ContentType
94
84
  protected
95
85
 
96
86
  def set_default_values
97
- self.order_by ||= 'created_at'
87
+ self.order_by ||= 'updated_at'
98
88
  self.highlighted_field_name ||= self.content_custom_fields.first._name
99
89
  end
100
90
 
@@ -103,12 +93,4 @@ class ContentType
103
93
  self.slug.slugify! if self.slug.present?
104
94
  end
105
95
 
106
- def remove_uploaded_files # callbacks are not called on each content so we do it manually
107
- self.contents.each do |content|
108
- self.content_custom_fields.each do |field|
109
- content.send(:"remove_#{field._name}!") if field.kind == 'file'
110
- end
111
- end
112
- end
113
-
114
96
  end