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
@@ -27,65 +27,11 @@ module Models
27
27
  alias :descendants :hacked_descendants
28
28
  end
29
29
 
30
- module ClassMethods
31
-
32
- # Warning: used only in read-only
33
- def quick_tree(site)
34
- pages = site.pages.minimal_attributes.order_by([[:depth, :asc], [:position, :asc]]).to_a
35
-
36
- tmp = []
37
-
38
- while !pages.empty?
39
- tmp << _quick_tree(pages.delete_at(0), pages)
40
- end
41
-
42
- tmp
43
- end
44
-
45
- def _quick_tree(current_page, pages)
46
- i, children = 0, []
47
-
48
- while !pages.empty?
49
- page = pages[i]
50
-
51
- break if page.nil?
52
-
53
- if page.parent_id == current_page.id
54
- page = pages.delete_at(i)
55
-
56
- children << _quick_tree(page, pages)
57
- else
58
- i += 1
59
- end
60
- end
61
-
62
- current_page.instance_eval do
63
- def children=(list); @children = list; end
64
- def children; @children || []; end
65
- end
66
-
67
- current_page.children = children
68
-
69
- current_page
70
- end
71
-
72
- end
73
-
74
30
  module InstanceMethods
75
31
 
76
- def children?
77
- self.class.where(self.parent_id_field => self.id).count
78
- end
79
-
80
- def children_with_minimal_attributes
81
- self.class.where(self.parent_id_field => self.id).
82
- order_by(self.tree_order).
83
- minimal_attributes
84
- end
85
-
86
32
  def sort_children!(ids)
87
33
  ids.each_with_index do |id, position|
88
- child = self.children.detect { |p| p._id == BSON::ObjectId(id) }
34
+ child = self.children.detect { |p| p._id == id }
89
35
  child.position = position
90
36
  child.save
91
37
  end
@@ -98,7 +44,10 @@ module Models
98
44
  end
99
45
 
100
46
  def hacked_descendants
101
- return [] if new_record?
47
+ # workorund for mongoid unexpected behavior
48
+ _new_record_var = self.instance_variable_get(:@new_record)
49
+ _new_record = _new_record_var != false
50
+ return [] if _new_record
102
51
  self.class.all_in(path_field => [self._id]).order_by tree_order
103
52
  end
104
53
 
@@ -107,12 +56,7 @@ module Models
107
56
  def change_parent
108
57
  if self.parent_id_changed?
109
58
  self.fix_position(false)
110
-
111
- unless self.parent_id_was.nil?
112
- self.position = nil # make it move to bottom
113
- self.add_to_list_bottom
114
- end
115
-
59
+ self.add_to_list_bottom
116
60
  self.instance_variable_set :@_will_move, true
117
61
  end
118
62
  end
@@ -137,7 +81,7 @@ module Models
137
81
  end
138
82
 
139
83
  def add_to_list_bottom
140
- self.position ||= (::Page.where(:_id.ne => self._id).and(:parent_id => self.parent_id).max(:position) || 0) + 1
84
+ self.position = (::Page.where(:_id.ne => self._id).and(:parent_id => self.parent_id).max(:position) || 0) + 1
141
85
  end
142
86
 
143
87
  def remove_from_list
@@ -40,8 +40,6 @@ class Page
40
40
  scope :index, :where => { :slug => 'index', :depth => 0 }
41
41
  scope :not_found, :where => { :slug => '404', :depth => 0 }
42
42
  scope :published, :where => { :published => true }
43
- scope :fullpath, lambda { |fullpath| { :where => { :fullpath => fullpath } } }
44
- scope :minimal_attributes, :only => %w(title slug fullpath position depth published templatized parent_id created_at updated_at)
45
43
 
46
44
  ## methods ##
47
45
 
@@ -40,14 +40,6 @@ class Site
40
40
 
41
41
  ## methods ##
42
42
 
43
- def all_pages_in_once
44
- Page.quick_tree(self)
45
- end
46
-
47
- def domains=(array)
48
- array = [] if array.blank?; super(array)
49
- end
50
-
51
43
  def accounts
52
44
  Account.criteria.in(:_id => self.memberships.collect(&:account_id))
53
45
  end
@@ -58,19 +50,15 @@ class Site
58
50
 
59
51
  def add_subdomain_to_domains
60
52
  self.domains ||= []
61
- (self.domains << self.full_subdomain).uniq!
53
+ (self.domains << "#{self.subdomain}.#{Locomotive.config.default_domain}").uniq!
62
54
  end
63
55
 
64
56
  def domains_without_subdomain
65
- (self.domains || []) - [self.full_subdomain]
57
+ (self.domains || []) - ["#{self.subdomain}.#{Locomotive.config.default_domain}"]
66
58
  end
67
59
 
68
60
  def domains_with_subdomain
69
- ((self.domains || []) + [self.full_subdomain]).uniq
70
- end
71
-
72
- def full_subdomain
73
- "#{self.subdomain}.#{Locomotive.config.default_domain}"
61
+ ((self.domains || []) + ["#{self.subdomain}.#{Locomotive.config.default_domain}"]).uniq
74
62
  end
75
63
 
76
64
  def to_liquid
@@ -60,7 +60,7 @@ class AssetUploader < CarrierWave::Uploader::Base
60
60
 
61
61
  def self.content_types
62
62
  {
63
- :image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg', 'image/x-icon'],
63
+ :image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg'],
64
64
  :video => [/^video/, 'application/x-shockwave-flash', 'application/x-swf'],
65
65
  :audio => [/^audio/, 'application/ogg', 'application/x-mp3'],
66
66
  :pdf => ['application/pdf', 'application/x-pdf'],
@@ -15,18 +15,7 @@ class ThemeAssetUploader < AssetUploader
15
15
  end
16
16
 
17
17
  def extension_white_list
18
- %w(jpg jpeg gif png css js swf flv eot svg ttf woff otf ico)
19
- end
20
-
21
- def self.url_for(site, path)
22
- build(site, path).url
23
- end
24
-
25
- def self.build(site, path)
26
- asset = ThemeAsset.new(:site => site, :folder => File.dirname(path))
27
- uploader = ThemeAssetUploader.new(asset)
28
- uploader.retrieve_from_store!(File.basename(path))
29
- uploader
18
+ %w(jpg jpeg gif png css js swf flv eot svg ttf woff)
30
19
  end
31
20
 
32
21
  end
@@ -1,8 +1,8 @@
1
1
  - title link_to(@asset_collection.name.blank? ? @asset_collection.name_was : @asset_collection.name, '#', :rel => 'asset_collection_name', :title => t('.ask_for_name'), :class => 'editable')
2
2
 
3
3
  - content_for :head do
4
- = include_javascripts :asset_collections
5
- = include_stylesheets :fancybox
4
+ = javascript_include_tag 'admin/plugins/fancybox', 'admin/asset_collections', 'admin/custom_fields'
5
+ = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
6
6
 
7
7
  - content_for :submenu do
8
8
  = render 'admin/shared/menu/assets'
@@ -1,7 +1,7 @@
1
1
  - title t('.title')
2
2
 
3
3
  - content_for :head do
4
- = include_javascripts :asset_collections
4
+ = javascript_include_tag 'admin/asset_collections.js'
5
5
 
6
6
  - content_for :submenu do
7
7
  = render 'admin/shared/menu/assets'
@@ -1,6 +1,6 @@
1
1
  - content_for :head do
2
- = include_javascripts :edit_custom_fields, :assets
3
- = include_stylesheets :custom_fields
2
+ = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/json2', 'admin/plugins/fancybox', 'admin/custom_fields/category', 'admin/assets'
3
+ = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/box'
4
4
 
5
5
  = f.inputs :name => :information do
6
6
  = f.input :name
@@ -1,6 +1,6 @@
1
1
  - content_for :head do
2
- = include_javascripts :custom_fields
3
- = include_stylesheets :fancybox
2
+ = javascript_include_tag 'admin/plugins/fancybox', 'admin/custom_fields'
3
+ = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
4
4
 
5
5
  = f.inputs :name => :information do
6
6
  = f.input :name
@@ -1,7 +1,7 @@
1
1
  - title t('.title')
2
2
 
3
3
  - content_for :head do
4
- = include_javascripts :content_types
4
+ = javascript_include_tag 'admin/content_types.js'
5
5
 
6
6
  - content_for :submenu do
7
7
  = render 'admin/shared/menu/contents'
@@ -1,5 +1,5 @@
1
1
  - content_for :head do
2
- = include_javascripts :edit_custom_fields, :contents
3
- = include_stylesheets :fancybox
2
+ = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/json2', 'admin/plugins/fancybox', 'admin/custom_fields/category', 'admin/contents'
3
+ = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
4
4
 
5
5
  = render 'admin/custom_fields/custom_form', :form => f, :title => :attributes, :parent => @content_type
@@ -4,7 +4,7 @@
4
4
  = render 'admin/shared/menu/contents'
5
5
 
6
6
  - content_for :head do
7
- = include_javascripts :contents
7
+ = javascript_include_tag 'admin/contents'
8
8
 
9
9
  - content_for :buttons do
10
10
  = admin_button_tag :edit, edit_admin_content_type_url(@content_type), :class => 'edit'
@@ -8,7 +8,7 @@
8
8
  %p.notice= t('.notice')
9
9
 
10
10
  .footer
11
- = box_button_tag t('admin.buttons.switch_to_site')
11
+ = login_button_tag t('admin.buttons.switch_to_site')
12
12
 
13
13
  :javascript
14
14
  $(document).ready(function() { $('form').submit(); });
@@ -1,5 +1,5 @@
1
1
  - content_for :head do
2
- = include_javascripts :site
2
+ = javascript_include_tag 'admin/site'
3
3
 
4
4
  = f.foldable_inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do
5
5
  = f.input :name, :required => false
@@ -23,7 +23,7 @@
23
23
  %li{ :class => "item added #{'last' if index == @site.domains.size - 1}"}
24
24
  %em
25
25
  http://
26
- = text_field_tag 'site[domains][]', name, :class => 'string label void domain'
26
+ = text_field_tag 'current_site[domains][]', name
27
27
  &nbsp;
28
28
  = error_on_domain(@site, name)
29
29
  %span.actions
@@ -32,7 +32,7 @@
32
32
  %li.item.template
33
33
  %em
34
34
  http://
35
- = text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void domain'
35
+ = text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void'
36
36
  &nbsp;
37
37
  %span.actions
38
38
  = link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('admin.messages.confirm')
@@ -9,7 +9,7 @@
9
9
 
10
10
  %p!= t('.help')
11
11
 
12
- = semantic_form_for @site, :url => admin_current_site_url, :html => { :class => 'save-with-shortcut' } do |f|
12
+ = semantic_form_for @site, :as => :current_site, :url => admin_current_site_url, :html => { :class => 'save-with-shortcut' } do |f|
13
13
 
14
14
  = render 'form', :f => f
15
15
 
@@ -18,15 +18,4 @@
18
18
  %p.inline-errors= @error
19
19
  %p.inline-hints= t('formtastic.hints.import.source')
20
20
 
21
- %li.input.toggle
22
- = label_tag 'samples', t('formtastic.labels.import.new.samples')
23
- = check_box_tag 'samples'
24
- %p.inline-hints= t('formtastic.hints.import.samples')
25
-
26
- %li.input.toggle
27
- = label_tag 'reset', t('formtastic.labels.import.new.reset')
28
- = check_box_tag 'reset'
29
- %p.inline-hints= t('formtastic.hints.import.reset')
30
-
31
-
32
21
  = render 'admin/shared/form_actions', :button_label => :send
@@ -1,5 +1,5 @@
1
1
  - content_for :head do
2
- = include_javascripts :import
2
+ = javascript_include_tag 'admin/plugins/json2', 'admin/plugins/smartupdater', 'admin/import'
3
3
 
4
4
  - title t('.title')
5
5
 
@@ -1,7 +1,7 @@
1
1
  - title link_to(@account.name.blank? ? @account.name_was : @account.name, '#', :rel => 'my_account_name', :title => t('.ask_for_name'), :class => 'editable')
2
2
 
3
3
  - content_for :head do
4
- = include_javascripts :account
4
+ = javascript_include_tag 'admin/account'
5
5
 
6
6
  - content_for :submenu do
7
7
  = render 'admin/shared/menu/settings'
@@ -1,6 +1,7 @@
1
1
  - content_for :head do
2
- = include_javascripts :image_picker, :edit_page
3
- = include_stylesheets :editable_elements, :fancybox
2
+ = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/codemirror/codemirror', 'admin/pages', 'admin/editable_elements'
3
+ = stylesheet_link_tag 'admin/editable_elements'
4
+ = image_picker_include_tags
4
5
 
5
6
  = f.foldable_inputs :name => :information do
6
7
 
@@ -1,7 +1,5 @@
1
1
  %li{ :id => "item-#{page.id}", :class => "#{'not-found' if page.not_found? } #{'templatized' if page.templatized?}"}
2
- - with_children = !page.children.empty?
3
-
4
- - if not page.index? and with_children
2
+ - if not page.index? and not page.children.empty?
5
3
  = image_tag 'admin/list/icons/node_closed.png', :class => 'toggler'
6
4
  %em
7
5
  %strong= link_to truncate(page.title, :length => 80), edit_admin_page_url(page)
@@ -13,6 +11,6 @@
13
11
  - if not page.index? and not page.not_found?
14
12
  = link_to image_tag('admin/list/icons/trash.png'), admin_page_url(page), :class => 'remove', :confirm => t('admin.messages.confirm'), :method => :delete
15
13
 
16
- - if with_children
14
+ - if not page.children.empty?
17
15
  %ul{ :id => "folder-#{page._id}", :class => "folder depth-#{(page.depth || 0) + 1}", :data_url => sort_admin_page_url(page), :style => "display: #{cookies["folder-#{page._id}"] || 'block'}" }
18
16
  = render page.children
@@ -1,7 +1,7 @@
1
1
  - title t('.title')
2
2
 
3
3
  - content_for :head do
4
- = include_javascripts :pages
4
+ = javascript_include_tag 'admin/pages'
5
5
 
6
6
  - content_for :submenu do
7
7
  = render 'admin/shared/menu/contents'
@@ -5,7 +5,7 @@
5
5
  = f.hidden_field :reset_password_token
6
6
 
7
7
  .inner
8
- = box_flash_message
8
+ = login_flash_message
9
9
 
10
10
  = f.inputs do
11
11
  = f.input :password, :label => t('.password'), :required => false
@@ -15,4 +15,4 @@
15
15
  = link_to preserve(t('.link')), new_admin_session_path
16
16
 
17
17
  .footer
18
- = box_button_tag t('admin.buttons.change_password')
18
+ = login_button_tag t('admin.buttons.change_password')
@@ -5,7 +5,7 @@
5
5
  = f.hidden_field :reset_password_token
6
6
 
7
7
  .inner
8
- = box_flash_message
8
+ = login_flash_message
9
9
 
10
10
  = f.inputs do
11
11
  = f.input :email, :label => t('.email'), :required => false
@@ -14,4 +14,4 @@
14
14
  = link_to preserve(t('.link')), new_admin_session_path
15
15
 
16
16
  .footer
17
- = box_button_tag t('admin.buttons.send_password')
17
+ = login_button_tag t('admin.buttons.send_password')
@@ -4,7 +4,7 @@
4
4
  = f.hidden_field :remember_me, :value => 'true'
5
5
 
6
6
  .inner
7
- = box_flash_message
7
+ = login_flash_message
8
8
 
9
9
  = f.inputs do
10
10
  = f.input :email, :label => t('.email'), :required => false
@@ -14,4 +14,4 @@
14
14
  = link_to t('.link'), new_admin_password_path
15
15
 
16
16
  .footer
17
- = box_button_tag t('admin.buttons.login')
17
+ = login_button_tag t('admin.buttons.login')
@@ -4,12 +4,13 @@
4
4
 
5
5
  %meta{ :name => 'locale', :content => I18n.locale }
6
6
 
7
- = include_javascripts :common
7
+ = stylesheet_link_tag 'admin/blueprint/screen', :media => 'screen'
8
+ / [if IE]
9
+ = stylesheet_link_tag 'admin/blueprint/ie', :media => 'screen'
8
10
 
9
- = include_stylesheets :common, :media => 'screen'
11
+ = stylesheet_link_tag 'admin/layout', 'admin/jquery/ui', 'admin/plugins/toggle', 'admin/plugins/selectmenu', 'admin/menu', 'admin/plugins/toggle','admin/buttons', 'admin/formtastic', 'admin/formtastic_changes', 'admin/application', :media => 'screen', :cache => Rails.env.production? && !Locomotive.heroku?
10
12
 
11
- / [if IE]
12
- = include_stylesheets :ie, :media => 'screen'
13
+ = javascript_include_tag 'admin/jquery', 'admin/jquery.ui', 'admin/rails', 'admin/utils', 'admin/plugins/subscribe', 'admin/plugins/shortcut', 'admin/plugins/toggle', 'admin/plugins/growl', 'admin/plugins/cookie', 'admin/plugins/selectmenu', 'admin/application', 'admin/locales/datepicker_fr', :cache => Rails.env.production? && !Locomotive.heroku?
13
14
 
14
15
  %script{ :type => 'text/javascript' }
15
16
  = find_and_preserve(growl_message)
@@ -5,7 +5,7 @@
5
5
  .inner
6
6
  %h2!= t('admin.pages.index.lastest_items')
7
7
  %ul
8
- - current_site.pages.latest_updated.minimal_attributes.each do |page|
8
+ - current_site.pages.latest_updated.each do |page|
9
9
  %li
10
10
  = link_to truncate(page.title, :length => 25), edit_admin_page_url(page)
11
11
  %span= time_ago_in_words(page.updated_at)
@@ -1,5 +1,5 @@
1
1
  - content_for :head do
2
- = include_javascripts :site
2
+ = javascript_include_tag 'admin/site'
3
3
 
4
4
  = f.foldable_inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do
5
5
  = f.input :name, :required => false
@@ -18,7 +18,7 @@
18
18
  %li{ :class => "item added #{'last' if index == @site.domains.size - 1}"}
19
19
  %em
20
20
  http://
21
- = text_field_tag 'site[domains][]', name, :class => 'string label void domain'
21
+ = text_field_tag 'site[domains][]', name
22
22
  &nbsp;
23
23
  = error_on_domain(@site, name)
24
24
  %span.actions
@@ -27,7 +27,7 @@
27
27
  %li.item.template
28
28
  %em
29
29
  http://
30
- = text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void domain'
30
+ = text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void'
31
31
  &nbsp;
32
32
  %span.actions
33
33
  = link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('admin.messages.confirm')