alchemy_cms 2.5.0.b5 → 2.5.0.b9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -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
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20121220102223) do
14
+ ActiveRecord::Schema.define(:version => 20130110212411) do
15
15
 
16
16
  create_table "alchemy_attachments", :force => true do |t|
17
17
  t.string "name"
@@ -194,6 +194,15 @@ ActiveRecord::Schema.define(:version => 20121220102223) do
194
194
  add_index "alchemy_languages", ["language_code"], :name => "index_alchemy_languages_on_language_code"
195
195
  add_index "alchemy_languages", ["site_id"], :name => "index_alchemy_languages_on_site_id"
196
196
 
197
+ create_table "alchemy_legacy_page_urls", :force => true do |t|
198
+ t.string "urlname", :null => false
199
+ t.integer "page_id", :null => false
200
+ t.datetime "created_at", :null => false
201
+ t.datetime "updated_at", :null => false
202
+ end
203
+
204
+ add_index "alchemy_legacy_page_urls", ["urlname"], :name => "index_alchemy_legacy_page_urls_on_urlname"
205
+
197
206
  create_table "alchemy_pages", :force => true do |t|
198
207
  t.string "name"
199
208
  t.string "urlname"
data/spec/factories.rb CHANGED
@@ -5,6 +5,7 @@ FactoryGirl.define do
5
5
  login "jdoe"
6
6
  password 's3cr3t'
7
7
  password_confirmation 's3cr3t'
8
+ language 'en'
8
9
 
9
10
  factory :admin_user do
10
11
  role "admin"
@@ -23,10 +23,16 @@ describe "Picture Library", :js => true do
23
23
  it "it should be possible to undo tag filtering by clicking on an active tag name" do
24
24
  visit '/alchemy/admin/pictures'
25
25
  click_on 'tag1 (1)'
26
- click_on 'tag2 (1)'
26
+ page.should_not have_content 'TaggedWith2'
27
+ click_on 'tag1 (1)'
27
28
  page.should have_content 'TaggedWith2'
29
+ end
30
+
31
+ it "it should be possible to tighten the tag scope by clicking on another tag name" do
32
+ visit '/alchemy/admin/pictures'
33
+ click_on 'tag1 (1)'
28
34
  click_on 'tag2 (1)'
29
- page.should_not have_content 'TaggedWith2'
35
+ page.should have_content "You don't have any images in your archive"
30
36
  end
31
37
 
32
38
  end
@@ -10,8 +10,8 @@ describe "Security: " do
10
10
  context "If no user is present" do
11
11
 
12
12
  it "render the signup view" do
13
- visit '/alchemy/'
14
- within('#alchemy_greeting') { page.should have_content('signup') }
13
+ visit '/alchemy'
14
+ current_path.should == '/alchemy/admin/signup'
15
15
  end
16
16
  end
17
17
 
@@ -21,6 +21,7 @@ describe "Translation integration" do
21
21
 
22
22
  it "should be possible to change the current locale in the session" do
23
23
  visit admin_dashboard_path(:locale => :de)
24
+ page.should have_content('Willkommen')
24
25
  visit admin_dashboard_path(:locale => :en)
25
26
  page.should have_content('Welcome')
26
27
  end
@@ -30,10 +31,25 @@ describe "Translation integration" do
30
31
  page.should have_content('Welcome')
31
32
  end
32
33
 
33
- it "should use the current users language setting if no other parameter is given" do
34
- Alchemy::User.first.update_attributes(:language => :de)
35
- visit admin_dashboard_path
36
- page.should have_content('Willkommen')
34
+ context "if no other parameter is given" do
35
+ it "should use the current users language setting" do
36
+ Alchemy::User.first.update_attributes!(language: 'de')
37
+ visit admin_dashboard_path
38
+ page.should have_content('Willkommen')
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ context "with translated header" do
45
+
46
+ before do
47
+ Capybara.current_driver = :rack_test_translated_header
48
+ end
49
+
50
+ it "should use the browsers language setting if no other parameter is given" do
51
+ visit root_path
52
+ ::I18n.locale.should == :de
37
53
  end
38
54
 
39
55
  end
@@ -106,7 +106,7 @@ describe Alchemy::ResourcesHelper do
106
106
  describe "resource_window_size" do
107
107
  it "should return overlay size string depending on resource attributes length" do
108
108
  @controller.stub(:resource_handler).and_return(OpenStruct.new(:attributes => OpenStruct.new(:length => 4)))
109
- @controller.resource_window_size.should == "400x240"
109
+ @controller.resource_window_size.should == "420x260"
110
110
  end
111
111
  end
112
112
  end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ module Alchemy
4
+ describe Cell do
5
+
6
+ let(:cell) { FactoryGirl.build(:cell) }
7
+
8
+ describe "#available_elements" do
9
+
10
+ context "without assigned elements" do
11
+ it "should return an empty Array" do
12
+ cell.stub!(:description).and_return({})
13
+ cell.available_elements.should == []
14
+ end
15
+ end
16
+
17
+ context "with assigned elements" do
18
+ it "should return an Array of element names" do
19
+ cell.stub!(:description).and_return({'elements' => ['test_element', 'test_element_2']})
20
+ cell.available_elements.should == ['test_element', 'test_element_2']
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+ describe "#description" do
27
+
28
+ context "without a definition for the expected cellname" do
29
+ it "should return an empty Hash" do
30
+ Cell.stub!(:definition_for).and_return({})
31
+ cell.description.should == {}
32
+ end
33
+ end
34
+
35
+ context "with a definition for the expected cellname found" do
36
+ it "should return its definition Hash" do
37
+ Cell.stub!(:definition_for).and_return({'name' => 'test_cell', 'elements' => ['test_element', 'test_element_2']})
38
+ cell.description.should == {'name' => 'test_cell', 'elements' => ['test_element', 'test_element_2']}
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
@@ -144,22 +144,39 @@ module Alchemy
144
144
 
145
145
  describe '#update' do
146
146
 
147
+ let(:page) { FactoryGirl.create(:page, :name => 'My Testpage', :language => language, :parent_id => language_root.id) }
148
+
147
149
  context "before/after filter" do
148
150
 
149
151
  it "should not set the title automatically if the name changed but title is not blank" do
150
- page = FactoryGirl.create(:page, :name => 'My Testpage', :language => language, :parent_id => language_root.id)
151
152
  page.name = "My Renaming Test"
152
153
  page.save; page.reload
153
154
  page.title.should == "My Testpage"
154
155
  end
155
156
 
156
157
  it "should not automatically set the title if it changed its value" do
157
- page = FactoryGirl.create(:page, :name => 'My Testpage', :language => language, :parent_id => language_root.id)
158
158
  page.title = "I like SEO"
159
159
  page.save; page.reload
160
160
  page.title.should == "I like SEO"
161
161
  end
162
162
 
163
+ context "urlname has changed" do
164
+ it "should store legacy url" do
165
+ page.urlname = 'new-urlname'
166
+ page.save!
167
+ page.legacy_urls.should_not be_empty
168
+ page.legacy_urls.first.urlname.should == 'my-testpage'
169
+ end
170
+ end
171
+
172
+ context "urlname has not changed" do
173
+ it "should not store a legacy url" do
174
+ page.urlname = 'my-testpage'
175
+ page.save!
176
+ page.legacy_urls.should be_empty
177
+ end
178
+ end
179
+
163
180
  end
164
181
 
165
182
  end
@@ -17,6 +17,18 @@ module Alchemy
17
17
  picture.should_not be_valid
18
18
  end
19
19
 
20
+ it "is valid with capitalized image file extension" do
21
+ image_file = File.new(File.expand_path('../../support/image2.PNG', __FILE__))
22
+ picture = Picture.new(:image_file => image_file)
23
+ picture.should be_valid
24
+ end
25
+
26
+ it "is valid with jpeg image file extension" do
27
+ image_file = File.new(File.expand_path('../../support/image3.jpeg', __FILE__))
28
+ picture = Picture.new(:image_file => image_file)
29
+ picture.should be_valid
30
+ end
31
+
20
32
  describe '#suffix' do
21
33
 
22
34
  it "should return the suffix of original filename" do
data/spec/routing_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "The Routing", :type => :routing do
4
4
 
5
- before(:each) { @routes = Alchemy::Engine.routes }
5
+ before { @routes = Alchemy::Engine.routes }
6
6
 
7
7
  context "for downloads" do
8
8
 
@@ -10,44 +10,44 @@ describe "The Routing", :type => :routing do
10
10
  {
11
11
  :get => "/attachment/32/download/Presseveranstaltung.pdf"
12
12
  }.should route_to(
13
- :controller => "alchemy/attachments",
14
- :action => "download",
15
- :id => "32",
16
- :name => "Presseveranstaltung",
17
- :format => "pdf"
18
- )
13
+ :controller => "alchemy/attachments",
14
+ :action => "download",
15
+ :id => "32",
16
+ :name => "Presseveranstaltung",
17
+ :format => "pdf"
18
+ )
19
19
  end
20
20
 
21
21
  it "should have a route for legacy Alchemy 1.x downloads" do
22
22
  {
23
23
  :get => "/attachment/32/download?name=Presseveranstaltung.pdf"
24
24
  }.should route_to(
25
- :controller => "alchemy/attachments",
26
- :action => "download",
27
- :id => "32"
28
- )
25
+ :controller => "alchemy/attachments",
26
+ :action => "download",
27
+ :id => "32"
28
+ )
29
29
  end
30
30
 
31
31
  it "should have a route for legacy washAPP downloads" do
32
32
  {
33
33
  :get => "/wa_files/download/11"
34
34
  }.should route_to(
35
- :controller => "alchemy/attachments",
36
- :action => "download",
37
- :id => "11"
38
- )
35
+ :controller => "alchemy/attachments",
36
+ :action => "download",
37
+ :id => "11"
38
+ )
39
39
  end
40
40
 
41
41
  it "should have a route for legacy WebMate downloads" do
42
42
  {
43
43
  :get => "/uploads/files/0000/0028/Pressetext.pdf"
44
44
  }.should route_to(
45
- :controller => "alchemy/attachments",
46
- :action => "download",
47
- :id => "0028",
48
- :name => "Pressetext",
49
- :suffix => "pdf"
50
- )
45
+ :controller => "alchemy/attachments",
46
+ :action => "download",
47
+ :id => "0028",
48
+ :name => "Pressetext",
49
+ :suffix => "pdf"
50
+ )
51
51
  end
52
52
 
53
53
  end
@@ -60,11 +60,11 @@ describe "The Routing", :type => :routing do
60
60
  {
61
61
  :get => "/products/my-product"
62
62
  }.should route_to(
63
- :controller => "alchemy/pages",
64
- :action => "show",
65
- :level1 => "products",
66
- :urlname => "my-product"
67
- )
63
+ :controller => "alchemy/pages",
64
+ :action => "show",
65
+ :level1 => "products",
66
+ :urlname => "my-product"
67
+ )
68
68
  end
69
69
 
70
70
  context "and language" do
@@ -73,12 +73,12 @@ describe "The Routing", :type => :routing do
73
73
  {
74
74
  :get => "/de/products/my-product"
75
75
  }.should route_to(
76
- :controller => "alchemy/pages",
77
- :action => "show",
78
- :level1 => "products",
79
- :urlname => "my-product",
80
- :lang => "de"
81
- )
76
+ :controller => "alchemy/pages",
77
+ :action => "show",
78
+ :level1 => "products",
79
+ :urlname => "my-product",
80
+ :lang => "de"
81
+ )
82
82
  end
83
83
 
84
84
  end
@@ -91,12 +91,12 @@ describe "The Routing", :type => :routing do
91
91
  {
92
92
  :get => "/catalog/products/my-product"
93
93
  }.should route_to(
94
- :controller => "alchemy/pages",
95
- :action => "show",
96
- :level1 => "catalog",
97
- :level2 => "products",
98
- :urlname => "my-product"
99
- )
94
+ :controller => "alchemy/pages",
95
+ :action => "show",
96
+ :level1 => "catalog",
97
+ :level2 => "products",
98
+ :urlname => "my-product"
99
+ )
100
100
  end
101
101
 
102
102
  context "and language" do
@@ -105,13 +105,13 @@ describe "The Routing", :type => :routing do
105
105
  {
106
106
  :get => "/de/catalog/products/my-product"
107
107
  }.should route_to(
108
- :controller => "alchemy/pages",
109
- :action => "show",
110
- :level1 => "catalog",
111
- :level2 => "products",
112
- :urlname => "my-product",
113
- :lang => "de"
114
- )
108
+ :controller => "alchemy/pages",
109
+ :action => "show",
110
+ :level1 => "catalog",
111
+ :level2 => "products",
112
+ :urlname => "my-product",
113
+ :lang => "de"
114
+ )
115
115
  end
116
116
 
117
117
  end
@@ -124,13 +124,13 @@ describe "The Routing", :type => :routing do
124
124
  {
125
125
  :get => "/2011/12/08/my-post"
126
126
  }.should route_to(
127
- :controller => "alchemy/pages",
128
- :action => "show",
129
- :level1 => "2011",
130
- :level2 => "12",
131
- :level3 => "08",
132
- :urlname => "my-post"
133
- )
127
+ :controller => "alchemy/pages",
128
+ :action => "show",
129
+ :level1 => "2011",
130
+ :level2 => "12",
131
+ :level3 => "08",
132
+ :urlname => "my-post"
133
+ )
134
134
  end
135
135
 
136
136
  context "and language" do
@@ -139,14 +139,14 @@ describe "The Routing", :type => :routing do
139
139
  {
140
140
  :get => "/de/2011/12/08/my-post"
141
141
  }.should route_to(
142
- :controller => "alchemy/pages",
143
- :action => "show",
144
- :level1 => "2011",
145
- :level2 => "12",
146
- :level3 => "08",
147
- :urlname => "my-post",
148
- :lang => "de"
149
- )
142
+ :controller => "alchemy/pages",
143
+ :action => "show",
144
+ :level1 => "2011",
145
+ :level2 => "12",
146
+ :level3 => "08",
147
+ :urlname => "my-post",
148
+ :lang => "de"
149
+ )
150
150
  end
151
151
 
152
152
  end
@@ -161,97 +161,97 @@ describe "The Routing", :type => :routing do
161
161
  {
162
162
  :get => "/pictures/3/show/900x300/kitten.jpg"
163
163
  }.should route_to(
164
- :controller => "alchemy/pictures",
165
- :action => "show",
166
- :id => "3",
167
- :size => "900x300",
168
- :name => "kitten",
169
- :format => "jpg"
170
- )
164
+ :controller => "alchemy/pictures",
165
+ :action => "show",
166
+ :id => "3",
167
+ :size => "900x300",
168
+ :name => "kitten",
169
+ :format => "jpg"
170
+ )
171
171
  end
172
172
 
173
173
  it "should route to cropped show action" do
174
174
  {
175
175
  :get => "/pictures/3/show/900x300/crop/kitten.jpg"
176
176
  }.should route_to(
177
- :controller => "alchemy/pictures",
178
- :action => "show",
179
- :id => "3",
180
- :size => "900x300",
181
- :crop => "crop",
182
- :name => "kitten",
183
- :format => "jpg"
184
- )
177
+ :controller => "alchemy/pictures",
178
+ :action => "show",
179
+ :id => "3",
180
+ :size => "900x300",
181
+ :crop => "crop",
182
+ :name => "kitten",
183
+ :format => "jpg"
184
+ )
185
185
  end
186
186
 
187
187
  it "should route to cropped mask show action" do
188
188
  get(
189
189
  "/pictures/3/show/300x300/crop/200x50/100x100/kitten.jpg"
190
190
  ).should route_to(
191
- :controller => "alchemy/pictures",
192
- :action => "show",
193
- :id => "3",
194
- :size => "300x300",
195
- :crop => "crop",
196
- :crop_from => "200x50",
197
- :crop_size => "100x100",
198
- :name => "kitten",
199
- :format => "jpg"
200
- )
191
+ :controller => "alchemy/pictures",
192
+ :action => "show",
193
+ :id => "3",
194
+ :size => "300x300",
195
+ :crop => "crop",
196
+ :crop_from => "200x50",
197
+ :crop_size => "100x100",
198
+ :name => "kitten",
199
+ :format => "jpg"
200
+ )
201
201
  end
202
202
 
203
203
  it "should route to thumbnail action" do
204
204
  get(
205
205
  "/pictures/3/thumbnails/small/kitten.jpg"
206
206
  ).should route_to(
207
- :controller => "alchemy/pictures",
208
- :action => "thumbnail",
209
- :id => "3",
210
- :size => "small",
211
- :name => "kitten",
212
- :format => "jpg"
213
- )
207
+ :controller => "alchemy/pictures",
208
+ :action => "thumbnail",
209
+ :id => "3",
210
+ :size => "small",
211
+ :name => "kitten",
212
+ :format => "jpg"
213
+ )
214
214
  end
215
215
 
216
216
  it "should route to cropped thumbnail action" do
217
217
  get(
218
218
  "/pictures/3/thumbnails/small/crop/kitten.jpg"
219
219
  ).should route_to(
220
- :controller => "alchemy/pictures",
221
- :action => "thumbnail",
222
- :id => "3",
223
- :crop => "crop",
224
- :size => "small",
225
- :name => "kitten",
226
- :format => "jpg"
227
- )
220
+ :controller => "alchemy/pictures",
221
+ :action => "thumbnail",
222
+ :id => "3",
223
+ :crop => "crop",
224
+ :size => "small",
225
+ :name => "kitten",
226
+ :format => "jpg"
227
+ )
228
228
  end
229
229
 
230
230
  it "should route to cropped and masked thumbnail" do
231
231
  get(
232
232
  "/pictures/3/thumbnails/small/0x0/200x200/kitten.jpg"
233
233
  ).should route_to(
234
- :controller => "alchemy/pictures",
235
- :action => "thumbnail",
236
- :id => "3",
237
- :crop_from => "0x0",
238
- :crop_size => "200x200",
239
- :size => "small",
240
- :name => "kitten",
241
- :format => "jpg"
242
- )
234
+ :controller => "alchemy/pictures",
235
+ :action => "thumbnail",
236
+ :id => "3",
237
+ :crop_from => "0x0",
238
+ :crop_size => "200x200",
239
+ :size => "small",
240
+ :name => "kitten",
241
+ :format => "jpg"
242
+ )
243
243
  end
244
244
 
245
245
  it "should route to zoomed picture" do
246
246
  get(
247
247
  "/pictures/3/zoom/kitten.jpg"
248
248
  ).should route_to(
249
- :controller => "alchemy/pictures",
250
- :action => "zoom",
251
- :id => "3",
252
- :name => "kitten",
253
- :format => "jpg"
254
- )
249
+ :controller => "alchemy/pictures",
250
+ :action => "zoom",
251
+ :id => "3",
252
+ :name => "kitten",
253
+ :format => "jpg"
254
+ )
255
255
  end
256
256
 
257
257
  end