alchemy_cms 2.5.0.b5 → 2.5.0.b9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/README.md +1 -1
  2. data/alchemy_cms.gemspec +2 -2
  3. data/app/assets/javascripts/alchemy/alchemy.base.js +0 -24
  4. data/app/assets/javascripts/alchemy/alchemy.growler.js +2 -4
  5. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +0 -1
  6. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +1 -1
  7. data/app/assets/stylesheets/alchemy/base.scss +4 -20
  8. data/app/assets/stylesheets/alchemy/elements.scss +19 -31
  9. data/app/assets/stylesheets/alchemy/flash.scss +11 -0
  10. data/app/assets/stylesheets/alchemy/form_elements.scss +2 -14
  11. data/app/assets/stylesheets/alchemy/menubar.css.scss +1 -0
  12. data/app/assets/stylesheets/alchemy/mixins.scss +37 -2
  13. data/app/assets/stylesheets/alchemy/notices.scss +1 -0
  14. data/app/assets/stylesheets/alchemy/sitemap.scss +30 -0
  15. data/app/assets/stylesheets/alchemy/tables.scss +20 -27
  16. data/app/controllers/alchemy/admin/attachments_controller.rb +3 -3
  17. data/app/controllers/alchemy/admin/base_controller.rb +1 -1
  18. data/app/controllers/alchemy/admin/contents_controller.rb +2 -2
  19. data/app/controllers/alchemy/admin/elements_controller.rb +3 -3
  20. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +2 -2
  21. data/app/controllers/alchemy/admin/pages_controller.rb +16 -9
  22. data/app/controllers/alchemy/admin/pictures_controller.rb +8 -8
  23. data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
  24. data/app/controllers/alchemy/admin/tags_controller.rb +4 -4
  25. data/app/controllers/alchemy/admin/users_controller.rb +3 -3
  26. data/app/controllers/alchemy/base_controller.rb +10 -12
  27. data/app/controllers/alchemy/messages_controller.rb +2 -2
  28. data/app/controllers/alchemy/pages_controller.rb +4 -1
  29. data/app/controllers/alchemy/pictures_controller.rb +1 -4
  30. data/app/controllers/alchemy/user_sessions_controller.rb +5 -5
  31. data/app/helpers/alchemy/admin/attachments_helper.rb +1 -1
  32. data/app/helpers/alchemy/admin/base_helper.rb +13 -13
  33. data/app/helpers/alchemy/admin/contents_helper.rb +6 -6
  34. data/app/helpers/alchemy/admin/elements_helper.rb +2 -2
  35. data/app/helpers/alchemy/admin/essences_helper.rb +8 -8
  36. data/app/helpers/alchemy/admin/pages_helper.rb +13 -7
  37. data/app/helpers/alchemy/base_helper.rb +20 -5
  38. data/app/helpers/alchemy/elements_helper.rb +2 -2
  39. data/app/helpers/alchemy/essences_helper.rb +2 -2
  40. data/app/helpers/alchemy/pages_helper.rb +2 -3
  41. data/app/models/alchemy/cell.rb +11 -3
  42. data/app/models/alchemy/content.rb +17 -17
  43. data/app/models/alchemy/element.rb +49 -26
  44. data/app/models/alchemy/legacy_page_url.rb +6 -0
  45. data/app/models/alchemy/page.rb +24 -45
  46. data/app/models/alchemy/picture.rb +1 -2
  47. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +3 -3
  48. data/app/views/alchemy/admin/attachments/_attachment.html.erb +6 -6
  49. data/app/views/alchemy/admin/attachments/_files_list.html.erb +2 -2
  50. data/app/views/alchemy/admin/attachments/edit.html.erb +5 -3
  51. data/app/views/alchemy/admin/attachments/index.html.erb +3 -3
  52. data/app/views/alchemy/admin/attachments/new.html.erb +2 -2
  53. data/app/views/alchemy/admin/clipboard/clear.js.erb +1 -1
  54. data/app/views/alchemy/admin/clipboard/index.html.erb +3 -3
  55. data/app/views/alchemy/admin/clipboard/insert.js.erb +2 -2
  56. data/app/views/alchemy/admin/clipboard/remove.js.erb +4 -4
  57. data/app/views/alchemy/admin/contents/_missing.html.erb +2 -2
  58. data/app/views/alchemy/admin/contents/create.js.erb +1 -1
  59. data/app/views/alchemy/admin/contents/new.html.erb +3 -3
  60. data/app/views/alchemy/admin/dashboard/index.html.erb +12 -12
  61. data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
  62. data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
  63. data/app/views/alchemy/admin/elements/_element_foot.html.erb +5 -5
  64. data/app/views/alchemy/admin/elements/_element_head.html.erb +6 -6
  65. data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -2
  66. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -4
  67. data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +1 -1
  68. data/app/views/alchemy/admin/elements/create.js.erb +2 -2
  69. data/app/views/alchemy/admin/elements/index.html.erb +2 -2
  70. data/app/views/alchemy/admin/elements/list.js.erb +1 -1
  71. data/app/views/alchemy/admin/elements/new.html.erb +4 -4
  72. data/app/views/alchemy/admin/elements/order.js.erb +1 -1
  73. data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
  74. data/app/views/alchemy/admin/elements/update.js.erb +1 -1
  75. data/app/views/alchemy/admin/essence_files/edit.html.erb +5 -5
  76. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +4 -4
  77. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +4 -4
  78. data/app/views/alchemy/admin/languages/_form.html.erb +6 -10
  79. data/app/views/alchemy/admin/languages/_language.html.erb +4 -4
  80. data/app/views/alchemy/admin/languages/_table.html.erb +1 -1
  81. data/app/views/alchemy/admin/languages/index.html.erb +1 -1
  82. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +6 -6
  83. data/app/views/alchemy/admin/layoutpages/index.html.erb +8 -8
  84. data/app/views/alchemy/admin/pages/_contactform_links.html.erb +7 -7
  85. data/app/views/alchemy/admin/pages/_create_language_form.html.erb +10 -9
  86. data/app/views/alchemy/admin/pages/_external_link.html.erb +7 -7
  87. data/app/views/alchemy/admin/pages/_file_link.html.erb +6 -6
  88. data/app/views/alchemy/admin/pages/_internal_link.html.erb +5 -5
  89. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
  90. data/app/views/alchemy/admin/pages/_page.html.erb +28 -28
  91. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +5 -5
  92. data/app/views/alchemy/admin/pages/_page_infos.html.erb +3 -3
  93. data/app/views/alchemy/admin/pages/_page_status.html.erb +3 -3
  94. data/app/views/alchemy/admin/pages/_sitemap.html.erb +1 -1
  95. data/app/views/alchemy/admin/pages/configure.html.erb +11 -11
  96. data/app/views/alchemy/admin/pages/configure_external.html.erb +4 -4
  97. data/app/views/alchemy/admin/pages/destroy.js.erb +0 -1
  98. data/app/views/alchemy/admin/pages/edit.html.erb +35 -35
  99. data/app/views/alchemy/admin/pages/flush.js.erb +1 -1
  100. data/app/views/alchemy/admin/pages/fold.js.erb +0 -1
  101. data/app/views/alchemy/admin/pages/index.html.erb +14 -14
  102. data/app/views/alchemy/admin/pages/link.html.erb +4 -4
  103. data/app/views/alchemy/admin/pages/locked.html.erb +1 -1
  104. data/app/views/alchemy/admin/pages/new.html.erb +4 -4
  105. data/app/views/alchemy/admin/pages/update.js.erb +2 -2
  106. data/app/views/alchemy/admin/partials/_autocomplete_tag_list.html.erb +1 -1
  107. data/app/views/alchemy/admin/partials/_flash_notices.html.erb +3 -3
  108. data/app/views/alchemy/admin/partials/_flash_upload.html.erb +8 -8
  109. data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +1 -1
  110. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +1 -1
  111. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -2
  112. data/app/views/alchemy/admin/partials/_search_form.html.erb +2 -2
  113. data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +1 -1
  114. data/app/views/alchemy/admin/partials/_upload_form.html.erb +11 -11
  115. data/app/views/alchemy/admin/pictures/_archive.html.erb +13 -13
  116. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +7 -7
  117. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +4 -4
  118. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
  119. data/app/views/alchemy/admin/pictures/_picture.html.erb +7 -7
  120. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  121. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +2 -2
  122. data/app/views/alchemy/admin/pictures/edit.html.erb +2 -2
  123. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +6 -6
  124. data/app/views/alchemy/admin/pictures/index.html.erb +10 -10
  125. data/app/views/alchemy/admin/pictures/info.html.erb +2 -2
  126. data/app/views/alchemy/admin/pictures/new.html.erb +2 -2
  127. data/app/views/alchemy/admin/resources/_boolean.html.erb +5 -0
  128. data/app/views/alchemy/admin/resources/_datetime.html.erb +2 -0
  129. data/app/views/alchemy/admin/resources/_form.html.erb +17 -28
  130. data/app/views/alchemy/admin/resources/_resource.html.erb +4 -4
  131. data/app/views/alchemy/admin/resources/_string.html.erb +5 -0
  132. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  133. data/app/views/alchemy/admin/resources/_text.html.erb +5 -0
  134. data/app/views/alchemy/admin/resources/index.html.erb +1 -1
  135. data/app/views/alchemy/admin/tags/_tag.html.erb +4 -4
  136. data/app/views/alchemy/admin/tags/edit.html.erb +4 -4
  137. data/app/views/alchemy/admin/tags/index.html.erb +5 -5
  138. data/app/views/alchemy/admin/tags/new.html.erb +2 -2
  139. data/app/views/alchemy/admin/trash/clear.js.coffee +1 -1
  140. data/app/views/alchemy/admin/trash/index.html.erb +3 -3
  141. data/app/views/alchemy/admin/users/_table.html.erb +3 -3
  142. data/app/views/alchemy/admin/users/_user.html.erb +6 -6
  143. data/app/views/alchemy/admin/users/index.html.erb +4 -4
  144. data/app/views/alchemy/base/error_notice.html.erb +1 -4
  145. data/app/views/alchemy/elements/_editor_not_found.html.erb +2 -2
  146. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -1
  147. data/app/views/alchemy/essences/_essence_file_editor.html.erb +7 -7
  148. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +5 -5
  149. data/app/views/alchemy/essences/_essence_picture_tools.html.erb +8 -8
  150. data/app/views/alchemy/essences/_linkable_essence_tools.html.erb +2 -2
  151. data/app/views/alchemy/search/_form.html.erb +2 -2
  152. data/app/views/alchemy/search/_result.html.erb +1 -1
  153. data/app/views/alchemy/search/_results.html.erb +3 -3
  154. data/app/views/alchemy/user_sessions/leave.html.erb +5 -5
  155. data/app/views/alchemy/user_sessions/login.html.erb +1 -1
  156. data/app/views/alchemy/user_sessions/signup.html.erb +2 -2
  157. data/app/views/kaminari/_gap.html.erb +1 -1
  158. data/app/views/kaminari/_next_page.html.erb +2 -2
  159. data/app/views/kaminari/_prev_page.html.erb +2 -2
  160. data/app/views/layouts/alchemy/admin.html.erb +7 -7
  161. data/bin/alchemy +1 -1
  162. data/config/authorization_rules.rb +1 -3
  163. data/config/locales/alchemy.de.yml +33 -23
  164. data/config/locales/alchemy.en.yml +31 -6
  165. data/db/migrate/{20121026100815_alchemy_two_point_three.rb → 20121118000000_alchemy_two_point_four.rb} +51 -28
  166. data/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +11 -0
  167. data/lib/alchemy/capistrano.rb +22 -30
  168. data/lib/alchemy/errors.rb +45 -0
  169. data/lib/alchemy/i18n.rb +7 -5
  170. data/lib/alchemy/logger.rb +16 -0
  171. data/lib/alchemy/page_layout.rb +3 -3
  172. data/lib/alchemy/resource.rb +17 -1
  173. data/lib/alchemy/resources_helper.rb +8 -1
  174. data/lib/alchemy/upgrader.rb +9 -0
  175. data/lib/alchemy/version.rb +1 -1
  176. data/lib/alchemy_cms.rb +1 -6
  177. data/lib/rails/generators/alchemy/scaffold/files/elements.yml +41 -19
  178. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +13 -0
  179. data/lib/tasks/alchemy/db.rake +5 -11
  180. data/lib/tasks/alchemy/install.rake +7 -7
  181. data/spec/controllers/admin/pages_controller_spec.rb +14 -2
  182. data/spec/controllers/pages_controller_spec.rb +50 -17
  183. data/spec/dummy/config/application.rb +1 -1
  184. data/spec/dummy/db/migrate/{20121026100815_alchemy_two_point_three.rb → 20121118000000_alchemy_two_point_four.rb} +51 -28
  185. data/spec/dummy/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +11 -0
  186. data/spec/dummy/db/schema.rb +10 -1
  187. data/spec/factories.rb +1 -0
  188. data/spec/integration/admin/picture_library_integration_spec.rb +8 -2
  189. data/spec/integration/security_spec.rb +2 -2
  190. data/spec/integration/translation_integration_spec.rb +20 -4
  191. data/spec/libraries/resources_helper_spec.rb +1 -1
  192. data/spec/models/cell_spec.rb +45 -0
  193. data/spec/models/page_spec.rb +19 -2
  194. data/spec/models/picture_spec.rb +12 -0
  195. data/spec/routing_spec.rb +115 -115
  196. data/spec/spec_helper.rb +3 -0
  197. data/spec/support/alchemy/specs_helpers.rb +6 -2
  198. data/spec/support/image.png +0 -0
  199. data/spec/support/image2.PNG +0 -0
  200. data/spec/support/image3.jpeg +0 -0
  201. metadata +27 -23
  202. data/db/migrate/20121113115120_create_alchemy_essence_links.rb +0 -13
  203. data/db/migrate/20121115100736_add_cached_tag_list_to_elements_pages_and_users.rb +0 -7
  204. data/db/migrate/20121116140636_add_cached_tag_list_to_alchemy_attachments.rb +0 -5
  205. data/db/migrate/20121116141016_change_alchemy_pictures_tag_list_column.rb +0 -9
  206. data/spec/dummy/db/migrate/20121113115120_create_alchemy_essence_links.rb +0 -13
  207. data/spec/dummy/db/migrate/20121115100736_add_cached_tag_list_to_elements_pages_and_users.rb +0 -7
  208. data/spec/dummy/db/migrate/20121116140636_add_cached_tag_list_to_alchemy_attachments.rb +0 -5
  209. data/spec/dummy/db/migrate/20121116141016_change_alchemy_pictures_tag_list_column.rb +0 -9
@@ -72,7 +72,22 @@ en:
72
72
  contactform:
73
73
  success_page: 'Followup page'
74
74
 
75
+ # Translations for content validations
76
+ #
77
+ content_validations:
78
+ contactform:
79
+ success_page:
80
+ blank: 'Please choose a follow up page'
81
+ errors:
82
+ blank: "%{field} can't be blank"
83
+ invalid: '%{field} has wrong format'
84
+ taken: '%{field} has already been taken'
85
+
75
86
  # == Translations for the build in full text search.
87
+ search_form:
88
+ placeholder: 'Search query'
89
+ submit: 'Search'
90
+
76
91
  search_result_page:
77
92
  result_page: Page
78
93
  no_results: "Your search for '%{query}' offers no result"
@@ -177,7 +192,7 @@ en:
177
192
  assign_file: "Assign a file"
178
193
  assign_file_from_archive: "assign a file from your archive"
179
194
  assign_image: "Assign an image"
180
- attachment_filename_notice: "*) Please do not use any special characters for the filename."
195
+ attachment_filename_notice: "* Please do not use any special characters for the filename."
181
196
  auto_play: "Play movie after load"
182
197
  big_thumbnails: "Big thumbnails"
183
198
  cannot_delete_picture_notice: "Cannot delete Picture %{name}, because it's still in use."
@@ -191,6 +206,7 @@ en:
191
206
  confirm_to_delete_images_from_server: "Do you really want to delete these images from the server?"
192
207
  confirm_to_delete_user: "Do you really want to delete this user?"
193
208
  contactform_body: "Message Template"
209
+ content_description_missing: "Warning: Content is missing its description. Please check the elements.yml"
194
210
  content_essence_not_found: "Content essence not found"
195
211
  content_not_found: "Field for content not present."
196
212
  content_validations_headline: "Please check marked fields below"
@@ -225,6 +241,7 @@ en:
225
241
  edit_page_properties: "Edit the page´s properties."
226
242
  edit_selected_pictures: "Edit selected pictures"
227
243
  edit_user: "Edit the user´s properties."
244
+ element_description_missing: "WARNING! Missing description. Please check your elements.yml file."
228
245
  element_dirty_notice: "This element has unsaved changes. Do you really want to fold it?"
229
246
  element_dirty_close_window_notice: "You have unsaved elements. Do you really want to close the elements window?"
230
247
  element_dirty_page_leave_warning: "You have unsaved elements on this page. Do you really want to continue?"
@@ -304,16 +321,24 @@ en:
304
321
  page_for_links:
305
322
  choose_page: "Choose %{name}"
306
323
  page_layout_changed_notice: "Page type was changed. Elements not usable anymore have been moved into the trash."
307
- page_locked: "This page is locked by another user."
308
324
  page_properties: "Page properties"
309
325
  page_public: "published"
310
326
  page_published: "Published page"
311
327
  page_restricted: "restricted"
328
+ page_states:
329
+ visible:
330
+ "true": "Page is visible in navigation."
331
+ "false": "Page is not visible in navigation."
332
+ public:
333
+ "true": "Page is published."
334
+ "false": "Page is unpublished."
335
+ locked:
336
+ "true": "Page is being edited at the moment."
337
+ "false": ""
338
+ restricted:
339
+ "true": "Page is restricted."
340
+ "false": ""
312
341
  page_status: "Status"
313
- page_status_invisible_public: "Page is invisible in navigation but public."
314
- page_status_invisible_unpublic: "Page is invisible in navigation and unpublic."
315
- page_status_visible_public: "Page is visible in navigation and public."
316
- page_status_visible_unpublic: "Page is visible in navigation but unpublic."
317
342
  page_title: "Title"
318
343
  page_type: "Type"
319
344
  page_visible_in_navigation: "visible in the navigation"
@@ -1,11 +1,11 @@
1
- # This is a compressed migration for creating all Alchemy 2.3 tables at once.
1
+ # This is a compressed migration for creating all Alchemy 2.4 tables at once.
2
2
  #
3
3
  # === Notice
4
4
  #
5
5
  # In order to upgrade from an old version of Alchemy, you have to run all migrations from
6
6
  # each version you missed up to the version you want to upgrade to, before running this migration.
7
7
  #
8
- class AlchemyTwoPointThree < ActiveRecord::Migration
8
+ class AlchemyTwoPointFour < ActiveRecord::Migration
9
9
  def up
10
10
  # Do not run if Alchemy tables are already present
11
11
  return if table_exists?(:alchemy_pages)
@@ -17,8 +17,9 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
17
17
  t.integer "size"
18
18
  t.integer "creator_id"
19
19
  t.integer "updater_id"
20
- t.datetime "created_at", :null => false
21
- t.datetime "updated_at", :null => false
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ t.text "cached_tag_list"
22
23
  end
23
24
 
24
25
  create_table "alchemy_cells", :force => true do |t|
@@ -46,14 +47,15 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
46
47
  t.string "name"
47
48
  t.integer "position"
48
49
  t.integer "page_id"
49
- t.boolean "public", :default => true
50
- t.boolean "folded", :default => false
51
- t.boolean "unique", :default => false
52
- t.datetime "created_at", :null => false
53
- t.datetime "updated_at", :null => false
50
+ t.boolean "public", :default => true
51
+ t.boolean "folded", :default => false
52
+ t.boolean "unique", :default => false
53
+ t.datetime "created_at", :null => false
54
+ t.datetime "updated_at", :null => false
54
55
  t.integer "creator_id"
55
56
  t.integer "updater_id"
56
57
  t.integer "cell_id"
58
+ t.text "cached_tag_list"
57
59
  end
58
60
 
59
61
  add_index "alchemy_elements", ["page_id", "position"], :name => "index_elements_on_page_id_and_position"
@@ -99,6 +101,17 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
99
101
  t.datetime "updated_at", :null => false
100
102
  end
101
103
 
104
+ create_table "alchemy_essence_links", :force => true do |t|
105
+ t.string "link"
106
+ t.string "link_title"
107
+ t.string "link_target"
108
+ t.string "link_class_name"
109
+ t.datetime "created_at", :null => false
110
+ t.datetime "updated_at", :null => false
111
+ t.integer "creator_id"
112
+ t.integer "updater_id"
113
+ end
114
+
102
115
  create_table "alchemy_essence_pictures", :force => true do |t|
103
116
  t.integer "picture_id"
104
117
  t.string "caption"
@@ -203,6 +216,7 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
203
216
  t.integer "creator_id"
204
217
  t.integer "updater_id"
205
218
  t.integer "language_id"
219
+ t.text "cached_tag_list"
206
220
  end
207
221
 
208
222
  add_index "alchemy_pages", ["language_id"], :name => "index_pages_on_language_id"
@@ -219,7 +233,7 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
219
233
  t.integer "creator_id"
220
234
  t.integer "updater_id"
221
235
  t.string "upload_hash"
222
- t.string "cached_tag_list"
236
+ t.text "cached_tag_list"
223
237
  end
224
238
 
225
239
  create_table "alchemy_users", :force => true do |t|
@@ -246,31 +260,40 @@ class AlchemyTwoPointThree < ActiveRecord::Migration
246
260
  t.datetime "updated_at", :null => false
247
261
  t.integer "creator_id"
248
262
  t.integer "updater_id"
263
+ t.text "cached_tag_list"
249
264
  end
250
265
 
251
266
  add_index "alchemy_users", ["perishable_token"], :name => "index_users_on_perishable_token"
252
267
 
253
- # Skip migrations for acts-as-taggable-on, if the tables are already present
254
- unless table_exists?(:taggings)
255
- create_table "taggings", :force => true do |t|
256
- t.integer "tag_id"
257
- t.integer "taggable_id"
258
- t.string "taggable_type"
259
- t.integer "tagger_id"
260
- t.string "tagger_type"
261
- t.string "context"
262
- t.datetime "created_at"
263
- end
264
-
265
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
266
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
268
+ create_table "events", :force => true do |t|
269
+ t.string "name"
270
+ t.string "hidden_name"
271
+ t.datetime "starts_at"
272
+ t.datetime "ends_at"
273
+ t.text "description"
274
+ t.decimal "entrance_fee", :precision => 6, :scale => 2
275
+ t.boolean "published"
276
+ t.integer "location_id"
277
+ t.integer "organizer_id"
278
+ t.datetime "created_at", :null => false
279
+ t.datetime "updated_at", :null => false
267
280
  end
268
281
 
269
- unless table_exists?(:tags)
270
- create_table "tags", :force => true do |t|
271
- t.string "name"
272
- end
282
+ create_table "taggings", :force => true do |t|
283
+ t.integer "tag_id"
284
+ t.integer "taggable_id"
285
+ t.string "taggable_type"
286
+ t.integer "tagger_id"
287
+ t.string "tagger_type"
288
+ t.string "context"
289
+ t.datetime "created_at"
273
290
  end
274
291
 
292
+ add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
293
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
294
+
295
+ create_table "tags", :force => true do |t|
296
+ t.string "name"
297
+ end
275
298
  end
276
299
  end
@@ -0,0 +1,11 @@
1
+ class CreateAlchemyLegacyPageUrls < ActiveRecord::Migration
2
+ def change
3
+ create_table :alchemy_legacy_page_urls do |t|
4
+ t.string :urlname, null: false
5
+ t.integer :page_id, null: false
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :alchemy_legacy_page_urls, :urlname
10
+ end
11
+ end
@@ -98,48 +98,40 @@ EOF
98
98
  end
99
99
 
100
100
  desc "Imports the database into your local development machine."
101
- task :database, :roles => [:db] do
102
- filename = "#{fetch(:application, 'dump')}-#{timestamp}.sql"
103
- run "cd #{current_path} && RAILS_ENV=#{fetch(:rails_env, 'production')} DUMP_FILENAME=#{filename} #{rake} alchemy:db:dump"
104
- FileUtils.mkdir_p "./db/dumps"
105
- download "#{current_path}/db/dumps/#{filename}", "db/dumps/#{filename}"
106
- run_locally "mysql -u#{database_config['username']}#{database_config['password'] ? ' -p"' + database_config['password'] + '"' : nil} #{database_config['database']} < ./db/dumps/#{filename}"
101
+ task :database, :roles => [:db], :only => {:primary => true} do
102
+ server = find_servers_for_task(current_task).first
103
+ dump_cmd = "cd #{current_path} && RAILS_ENV=#{fetch(:rails_env, 'production')} #{rake} alchemy:db:dump"
104
+ sql_stream = "ssh -p #{fetch(:port, 22)} #{user}@#{server} '#{dump_cmd}'"
105
+ mysql_credentials = ["--user='#{database_config['username']}'"]
106
+ if database_config['password']
107
+ mysql_credentials << "--password='#{database_config['password']}'"
108
+ end
109
+ system "#{sql_stream} | mysql #{mysql_credentials.join(' ')} #{database_config['database']}"
107
110
  end
108
111
 
109
- desc "Imports attachments into your local machine."
112
+ desc "Imports attachments into your local machine using rsync."
110
113
  task :attachments, :roles => [:app] do
111
- filename = zip_files('attachments')
112
- FileUtils.mkdir_p "./uploads"
113
- download "#{shared_path}/uploads/#{filename}", "./uploads/#{filename}"
114
- unzip_files('attachments', filename)
114
+ get_files :attachments
115
115
  end
116
116
 
117
- desc "Imports pictures into your local machine."
117
+ desc "Imports pictures into your local machine using rsync."
118
118
  task :pictures, :roles => [:app] do
119
- filename = zip_files('pictures')
120
- FileUtils.mkdir_p "./uploads"
121
- download "#{shared_path}/uploads/#{filename}", "./uploads/#{filename}"
122
- unzip_files('pictures', filename)
123
- end
124
-
125
- def zip_files(type)
126
- filename = "#{type}-#{timestamp}.tar.gz"
127
- run "cd #{shared_path}/uploads && tar cvfz #{filename} #{type}/"
128
- filename
119
+ get_files :pictures
129
120
  end
130
121
 
131
- def timestamp
132
- timestamp ||= Time.now.strftime('%Y-%m-%d-%H-%M')
133
- end
134
-
135
- def unzip_files(type, filename)
136
- FileUtils.rm_rf "./uploads/#{type}"
137
- run_locally "cd ./uploads && tar xvzf #{filename}"
122
+ def get_files(type)
123
+ FileUtils.mkdir_p "./uploads"
124
+ server = find_servers_for_task(current_task).first
125
+ if server
126
+ system "rsync --progress -rue 'ssh -p #{fetch(:port, 22)}' #{user}@#{server}:#{shared_path}/uploads/#{type} ./uploads/"
127
+ else
128
+ raise "No server found"
129
+ end
138
130
  end
139
131
 
140
132
  def database_config
141
133
  raise "database.yml not found!" if !File.exists?("./config/database.yml")
142
- YAML.load_file("./config/database.yml")['development']
134
+ YAML.load_file("./config/database.yml").fetch(ENV['RAILS_ENV'] || 'development')
143
135
  end
144
136
 
145
137
  end
@@ -0,0 +1,45 @@
1
+ # Custom error classes.
2
+ #
3
+ module Alchemy
4
+
5
+ class CellDefinitionError < StandardError
6
+ # Raised if no cell definition can be found.
7
+ end
8
+
9
+ class ContentDefinitionError < StandardError
10
+ # Raised if no content definition can be found.
11
+ end
12
+
13
+ class DefaultLanguageNotFoundError < StandardError
14
+ # Raised if no default language can be found.
15
+ def message
16
+ "No default language found. Have you run the rake alchemy:db:seed task?"
17
+ end
18
+ end
19
+
20
+ class ElementDefinitionError < StandardError
21
+ # Raised if element definition can not be found.
22
+ end
23
+
24
+ class EssenceMissingError < StandardError
25
+ # Raised if a content misses its essence.
26
+ def message
27
+ "Essence not found"
28
+ end
29
+ end
30
+
31
+ class MissingImageFileError < StandardError
32
+ # Raised if calling +image_file+ on a Picture object returns nil.
33
+ end
34
+
35
+ class PageLayoutDefinitionError < StandardError
36
+ # Raised if page_layout definition can not be found.
37
+ end
38
+
39
+ class PictureInUseError < StandardError
40
+ # Raised if the picture is still in use and can not be deleted.
41
+ end
42
+
43
+ class TinymceError < StandardError; end
44
+
45
+ end
data/lib/alchemy/i18n.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Alchemy
2
- class I18n
2
+ module I18n
3
3
 
4
- # A I18n Proxy for Alchemy translations
4
+ # Alchemy translation methods
5
5
  #
6
6
  # Instead of having to translate strings and defining a default value:
7
7
  #
@@ -15,12 +15,14 @@ module Alchemy
15
15
  #
16
16
  # Alchemy::I18n.t("Hello %{world}!", :world => @world)
17
17
  #
18
+ # It offers a shortcut method and view helper called _t
19
+ #
18
20
  # === Notes
19
21
  #
20
22
  # All translations are scoped into the +alchemy+ namespace.
21
23
  # Even scopes are scoped into the +alchemy+ namespace.
22
24
  #
23
- # So a call for t('hello', :scope => :world) has to be translated like this:
25
+ # So a call for _t('hello', :scope => :world) has to be translated like this:
24
26
  #
25
27
  # de:
26
28
  # alchemy:
@@ -43,11 +45,11 @@ module Alchemy
43
45
  end
44
46
 
45
47
  def self.available_locales
46
- translation_files.collect { |f| f.match(/.{2}\.yml$/).to_s.gsub(/\.yml/, '') }.uniq
48
+ translation_files.collect { |f| f.match(/.{2}\.yml$/).to_s.gsub(/\.yml/, '') }
47
49
  end
48
50
 
49
51
  def self.translation_files
50
- Rails.application.config.i18n.load_path.select { |p| p.split('/').last.match(/alchemy/) }
52
+ Dir.glob(File.join(File.dirname(__FILE__), '../../config/locales/alchemy.*.yml'))
51
53
  end
52
54
 
53
55
  end
@@ -0,0 +1,16 @@
1
+ module Alchemy
2
+ module Logger
3
+
4
+ # Logs a warning to the Rails standard logger and adds some nicer formatting
5
+ def self.warn(message, caller_string)
6
+ Rails.logger.warn %(\n++++ WARNING: #{message}\nCalled from: #{caller_string}\n)
7
+ return nil
8
+ end
9
+
10
+ def warn(message)
11
+ Alchemy::Logger.warn(message, caller.first)
12
+ end
13
+ alias_method :warning, :warn
14
+
15
+ end
16
+ end
@@ -14,7 +14,7 @@ module Alchemy
14
14
 
15
15
  # Returns all layouts defined in +config/alchemy/page_layout.yml+.
16
16
  def all
17
- @@definitions ||= read_layouts_file
17
+ @@definitions = read_layouts_file
18
18
  end
19
19
 
20
20
  # Add additional pagelayout definitions. I.E. from your module.
@@ -100,11 +100,11 @@ module Alchemy
100
100
  def read_layouts_file
101
101
  if File.exists? "#{Rails.root}/config/alchemy/page_layouts.yml"
102
102
  layouts = YAML.load_file "#{Rails.root}/config/alchemy/page_layouts.yml"
103
+ # Since YAML returns false for an empty file, we have to normalize it here.
104
+ layouts || []
103
105
  else
104
106
  raise LoadError, "Could not find page_layouts.yml file! Please run: rails generate alchemy:scaffold"
105
107
  end
106
- # Since YAML returns false for an empty file, we have to normalize it here.
107
- layouts || []
108
108
  end
109
109
 
110
110
  end
@@ -69,7 +69,23 @@ module Alchemy
69
69
  @module_definition and @module_definition['engine_name']
70
70
  end
71
71
 
72
- protected
72
+ # Returns a help text for resource's form
73
+ #
74
+ # === Example:
75
+ #
76
+ # de:
77
+ # alchemy:
78
+ # resource_help_texts:
79
+ # my_resource_model_name:
80
+ # attribute_name: This is the fancy help text
81
+ #
82
+ def help_text_for(attribute)
83
+ ::I18n.translate!(attribute[:name], :scope => [:alchemy, :resource_help_texts, model_name])
84
+ rescue ::I18n::MissingTranslationData
85
+ false
86
+ end
87
+
88
+ protected
73
89
 
74
90
  def controller_path_array
75
91
  @controller_path.split('/')