alchemy_cms 2.2.4 → 2.3.rc5

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 (215) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +3 -4
  3. data/Gemfile +1 -0
  4. data/README.md +10 -6
  5. data/alchemy_cms.gemspec +5 -2
  6. data/app/assets/images/alchemy/icons.png +0 -0
  7. data/app/assets/images/sassy-ie-overlay.png +0 -0
  8. data/app/assets/javascripts/alchemy/alchemy.base.js +50 -59
  9. data/app/assets/javascripts/alchemy/alchemy.buttons.js +14 -4
  10. data/app/assets/javascripts/alchemy/alchemy.datepicker.js +8 -2
  11. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +11 -3
  12. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -1
  13. data/app/assets/javascripts/alchemy/alchemy.link_overlay.js.coffee +14 -1
  14. data/app/assets/javascripts/alchemy/alchemy.preview.js +1 -1
  15. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +12 -4
  16. data/app/assets/javascripts/alchemy/alchemy.uploader.js +4 -1
  17. data/app/assets/javascripts/alchemy/alchemy.windows.js +18 -8
  18. data/app/assets/stylesheets/alchemy/_defaults.scss +84 -120
  19. data/app/assets/stylesheets/alchemy/alchemy.css +2 -2
  20. data/app/assets/stylesheets/alchemy/archive.css.scss +288 -0
  21. data/app/assets/stylesheets/alchemy/base.css.scss +95 -390
  22. data/app/assets/stylesheets/alchemy/dashboard.css.scss +4 -4
  23. data/app/assets/stylesheets/alchemy/elements.css.scss +83 -118
  24. data/app/assets/stylesheets/alchemy/flash.css.scss +1 -1
  25. data/app/assets/stylesheets/alchemy/form_elements.css.scss +528 -0
  26. data/app/assets/stylesheets/alchemy/frame.css.scss +13 -39
  27. data/app/assets/stylesheets/alchemy/icons.css.scss +217 -228
  28. data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +48 -50
  29. data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
  30. data/app/assets/stylesheets/alchemy/login.css.scss +1 -5
  31. data/app/assets/stylesheets/alchemy/menubar.css.scss +19 -29
  32. data/app/assets/stylesheets/alchemy/pagination.css.scss +3 -4
  33. data/app/assets/stylesheets/alchemy/sitemap.css.scss +81 -81
  34. data/app/assets/stylesheets/alchemy/tables.css.scss +63 -57
  35. data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +57 -57
  36. data/app/assets/stylesheets/alchemy/upload.css.scss +6 -6
  37. data/app/assets/stylesheets/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss +6 -10
  38. data/app/controllers/alchemy/admin/attachments_controller.rb +5 -4
  39. data/app/controllers/alchemy/admin/base_controller.rb +1 -9
  40. data/app/controllers/alchemy/admin/contents_controller.rb +4 -6
  41. data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
  42. data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
  43. data/app/controllers/alchemy/admin/pictures_controller.rb +74 -15
  44. data/app/controllers/alchemy/attachments_controller.rb +8 -2
  45. data/app/controllers/alchemy/base_controller.rb +47 -5
  46. data/app/controllers/alchemy/elements_controller.rb +1 -1
  47. data/app/controllers/alchemy/messages_controller.rb +12 -12
  48. data/app/controllers/alchemy/pages_controller.rb +5 -1
  49. data/app/controllers/alchemy/pictures_controller.rb +9 -4
  50. data/app/controllers/alchemy/user_sessions_controller.rb +2 -4
  51. data/app/helpers/alchemy/admin/base_helper.rb +98 -19
  52. data/app/helpers/alchemy/admin/contents_helper.rb +2 -2
  53. data/app/helpers/alchemy/admin/elements_helper.rb +2 -3
  54. data/app/helpers/alchemy/base_helper.rb +6 -5
  55. data/app/helpers/alchemy/elements_helper.rb +2 -2
  56. data/app/helpers/alchemy/essences_helper.rb +4 -5
  57. data/app/helpers/alchemy/pages_helper.rb +15 -79
  58. data/app/helpers/alchemy/url_helper.rb +67 -0
  59. data/app/mailers/alchemy/messages.rb +1 -1
  60. data/app/mailers/alchemy/notifications.rb +1 -1
  61. data/app/models/alchemy/attachment.rb +11 -2
  62. data/app/models/alchemy/cell.rb +20 -10
  63. data/app/models/alchemy/content.rb +4 -3
  64. data/app/models/alchemy/element.rb +170 -178
  65. data/app/models/alchemy/language/code.rb +4 -1
  66. data/app/models/alchemy/message.rb +19 -3
  67. data/app/models/alchemy/page.rb +45 -40
  68. data/app/models/alchemy/picture.rb +24 -2
  69. data/app/models/alchemy/user.rb +2 -3
  70. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +12 -12
  71. data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
  72. data/app/views/alchemy/admin/attachments/create.js.erb +1 -0
  73. data/app/views/alchemy/admin/attachments/edit.html.erb +9 -3
  74. data/app/views/alchemy/admin/attachments/index.html.erb +3 -2
  75. data/app/views/alchemy/admin/contents/_missing.html.erb +1 -1
  76. data/app/views/alchemy/admin/contents/create.js.erb +54 -0
  77. data/app/views/alchemy/admin/contents/new.html.erb +9 -4
  78. data/app/views/alchemy/admin/elements/{_add_content.html.erb → _add_picture.html.erb} +4 -4
  79. data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -1
  80. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -1
  81. data/app/views/alchemy/admin/elements/{_picture_editor.html.erb → _picture_gallery_editor.html.erb} +7 -11
  82. data/app/views/alchemy/admin/elements/fold.js.erb +46 -0
  83. data/app/views/alchemy/admin/elements/index.html.erb +24 -24
  84. data/app/views/alchemy/admin/elements/list.js.erb +11 -9
  85. data/app/views/alchemy/admin/essence_files/assign.js.erb +3 -1
  86. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +28 -0
  87. data/app/views/alchemy/admin/pages/_contactform_links.html.erb +8 -6
  88. data/app/views/alchemy/admin/pages/_external_link.html.erb +11 -9
  89. data/app/views/alchemy/admin/pages/_file_link.html.erb +10 -8
  90. data/app/views/alchemy/admin/pages/_internal_link.html.erb +14 -10
  91. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
  92. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  93. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +32 -21
  94. data/app/views/alchemy/admin/pages/configure.html.erb +2 -2
  95. data/app/views/alchemy/admin/pages/configure_external.html.erb +13 -13
  96. data/app/views/alchemy/admin/pages/edit.html.erb +2 -2
  97. data/app/views/alchemy/admin/pages/index.html.erb +26 -24
  98. data/app/views/alchemy/admin/pages/link.html.erb +2 -5
  99. data/app/views/alchemy/admin/partials/_upload_form.html.erb +28 -12
  100. data/app/views/alchemy/admin/pictures/_archive.html.erb +54 -0
  101. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +10 -7
  102. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +21 -22
  103. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +31 -0
  104. data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +9 -0
  105. data/app/views/alchemy/admin/pictures/_picture.html.erb +36 -6
  106. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +27 -0
  107. data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +3 -1
  108. data/app/views/alchemy/admin/pictures/create.js.erb +4 -5
  109. data/app/views/alchemy/admin/pictures/edit.html.erb +26 -0
  110. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +39 -0
  111. data/app/views/alchemy/admin/pictures/index.html.erb +81 -70
  112. data/app/views/alchemy/admin/pictures/index.js.erb +3 -0
  113. data/app/views/alchemy/admin/pictures/new.html.erb +1 -0
  114. data/app/views/alchemy/admin/resources/index.html.erb +3 -1
  115. data/app/views/alchemy/admin/users/_table.html.erb +1 -1
  116. data/app/views/alchemy/admin/users/index.html.erb +27 -23
  117. data/app/views/alchemy/elements/_article_editor.html.erb +7 -2
  118. data/app/views/alchemy/elements/_bild_editor.html.erb +1 -1
  119. data/app/views/alchemy/elements/_bild_text_editor.html.erb +6 -1
  120. data/app/views/alchemy/elements/_bild_text_view.html.erb +3 -3
  121. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -1
  122. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +2 -2
  123. data/app/views/alchemy/elements/_intro_image_text_view.html.erb +4 -4
  124. data/app/views/alchemy/elements/_searchresult_editor.html.erb +4 -1
  125. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +1 -1
  126. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +2 -3
  127. data/app/views/alchemy/essences/_essence_picture_tools.html.erb +1 -1
  128. data/app/views/alchemy/search/_form.html.erb +8 -0
  129. data/app/views/alchemy/search/_result.html.erb +3 -2
  130. data/app/views/alchemy/search/_results.html.erb +28 -0
  131. data/app/views/alchemy/user_sessions/leave.html.erb +4 -4
  132. data/app/views/alchemy/user_sessions/login.html.erb +1 -2
  133. data/app/views/layouts/alchemy/admin.html.erb +30 -10
  134. data/app/views/layouts/alchemy/login.html.erb +2 -39
  135. data/config/alchemy/elements.yml +1 -2
  136. data/config/alchemy/page_layouts.yml +8 -5
  137. data/config/authorization_rules.rb +27 -18
  138. data/config/initializers/localeapp.rb +9 -0
  139. data/config/locales/alchemy.de.yml +93 -56
  140. data/config/locales/alchemy.en.yml +73 -50
  141. data/config/routes.rb +3 -1
  142. data/db/migrate/20120704181529_add_upload_hash_to_alchemy_picture.rb +5 -0
  143. data/db/migrate/20120705214247_acts_as_taggable_on_migration.rb +28 -0
  144. data/db/migrate/20120728185830_add_cached_tag_list_to_alchemy_pictures.rb +5 -0
  145. data/db/migrate/20120831135441_set_alchemy_languages_country_code_default_to_empty_string.rb +9 -0
  146. data/lib/alchemy/capistrano.rb +2 -2
  147. data/lib/alchemy/essence.rb +14 -0
  148. data/lib/alchemy/page_layout.rb +0 -6
  149. data/lib/alchemy/resource.rb +9 -15
  150. data/lib/alchemy/upgrader.rb +18 -3
  151. data/lib/alchemy/version.rb +5 -1
  152. data/lib/alchemy_cms.rb +4 -1
  153. data/lib/rails/generators/alchemy/deploy_script/deploy_script_generator.rb +16 -6
  154. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +17 -3
  155. data/lib/rails/generators/alchemy/elements/elements_generator.rb +6 -1
  156. data/lib/rails/generators/alchemy/elements/templates/editor.html.erb +10 -1
  157. data/lib/rails/generators/alchemy/elements/templates/view.html.erb +17 -18
  158. data/lib/rails/generators/alchemy/scaffold/files/pages.html.erb +4 -2
  159. data/lib/tasks/fleximage.rake +2 -2
  160. data/spec/controllers/admin/contents_controller_spec.rb +2 -2
  161. data/spec/controllers/admin/elements_controller_spec.rb +30 -1
  162. data/spec/controllers/admin/pages_controller_spec.rb +35 -18
  163. data/spec/controllers/admin/trash_controller_spec.rb +40 -16
  164. data/spec/controllers/attachments_controller_spec.rb +62 -0
  165. data/spec/controllers/base_controller_spec.rb +43 -42
  166. data/spec/controllers/elements_controller_spec.rb +30 -0
  167. data/spec/controllers/pages_controller_spec.rb +22 -5
  168. data/spec/controllers/pictures_controller_spec.rb +82 -0
  169. data/spec/dummy/app/models/event.rb +2 -1
  170. data/spec/dummy/config/database.yml +3 -2
  171. data/spec/dummy/db/schema.rb +51 -27
  172. data/spec/factories.rb +29 -8
  173. data/spec/helpers/admin/base_helper_spec.rb +134 -21
  174. data/spec/helpers/admin/contents_helper_spec.rb +2 -2
  175. data/spec/helpers/admin/elements_helper_spec.rb +17 -9
  176. data/spec/helpers/admin/essences_helper_spec.rb +7 -6
  177. data/spec/helpers/essences_helper_spec.rb +8 -7
  178. data/spec/helpers/pages_helper_spec.rb +208 -325
  179. data/spec/helpers/url_helper_spec.rb +171 -0
  180. data/spec/integration/admin/link_overlay_spec.rb +53 -0
  181. data/spec/integration/admin/modules_integration_spec.rb +22 -26
  182. data/spec/integration/admin/pages_controller_spec.rb +10 -19
  183. data/spec/integration/admin/picture_library_integration_spec.rb +52 -0
  184. data/spec/integration/admin/resources_integration_spec.rb +68 -75
  185. data/spec/integration/pages_controller_spec.rb +70 -61
  186. data/spec/integration/security_spec.rb +3 -5
  187. data/spec/integration/translation_integration_spec.rb +56 -0
  188. data/spec/libraries/essence_spec.rb +18 -0
  189. data/spec/libraries/resource_spec.rb +101 -79
  190. data/spec/libraries/resources_helper_spec.rb +3 -0
  191. data/spec/models/content_spec.rb +63 -60
  192. data/spec/models/element_spec.rb +203 -93
  193. data/spec/models/language_spec.rb +90 -65
  194. data/spec/models/page_layout_spec.rb +37 -0
  195. data/spec/models/page_spec.rb +181 -113
  196. data/spec/models/picture_spec.rb +73 -26
  197. data/spec/models/resource_spec.rb +52 -23
  198. data/spec/support/alchemy/specs_helpers.rb +2 -0
  199. data/spec/support/image.png +0 -0
  200. data/spec/{helpers/url_helpers_spec.rb → url_helpers_spec.rb} +0 -0
  201. data/vendor/assets/javascripts/jquery_plugins/jquery.selectBoxIt.js +1909 -0
  202. data/vendor/assets/javascripts/jquery_plugins/preloadCssImages.jQuery_v5.js +152 -0
  203. metadata +106 -33
  204. data/app/assets/stylesheets/alchemy/buttons.css.scss +0 -361
  205. data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +0 -260
  206. data/app/views/alchemy/admin/contents/create.js.coffee +0 -49
  207. data/app/views/alchemy/admin/elements/fold.js.coffee +0 -37
  208. data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +0 -19
  209. data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +0 -16
  210. data/app/views/alchemy/admin/pictures/update.js.erb +0 -3
  211. data/spec/dummy/config/locales/en.yml +0 -5
  212. data/spec/dummy/config/locales/fo.yml +0 -5
  213. data/spec/page_layout_spec.rb +0 -35
  214. data/vendor/assets/javascripts/jquery_plugins/jquery.in-place-edit.js +0 -172
  215. data/vendor/assets/javascripts/jquery_plugins/jquery.sb.min.js +0 -14
@@ -0,0 +1,171 @@
1
+ require 'spec_helper'
2
+
3
+ include Alchemy::BaseHelper
4
+
5
+ module Alchemy
6
+ describe UrlHelper do
7
+
8
+ before do
9
+ @page = mock_model(Page, :urlname => 'testpage', :language_code => 'en')
10
+ end
11
+
12
+ describe "#show_page_path_params" do
13
+
14
+ context "when multi_language" do
15
+
16
+ before do
17
+ helper.stub!(:multi_language?).and_return(true)
18
+ end
19
+
20
+ it "should return a Hash with urlname and language_id parameter" do
21
+ helper.stub!(:multi_language?).and_return(true)
22
+ helper.show_page_path_params(@page).should include(:urlname => 'testpage', :lang => 'en')
23
+ end
24
+
25
+ it "should return a Hash with urlname, language_id and query parameter" do
26
+ helper.stub!(:multi_language?).and_return(true)
27
+ helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :lang => 'en', :query => 'test')
28
+ end
29
+
30
+ end
31
+
32
+ context "not multi_language" do
33
+
34
+ before do
35
+ helper.stub!(:multi_language?).and_return(false)
36
+ end
37
+
38
+ it "should return a Hash with the urlname but without language_id parameter" do
39
+ helper.show_page_path_params(@page).should include(:urlname => 'testpage')
40
+ helper.show_page_path_params(@page).should_not include(:lang => 'en')
41
+ end
42
+
43
+ it "should return a Hash with urlname and query parameter" do
44
+ helper.show_page_path_params(@page, {:query => 'test'}).should include(:urlname => 'testpage', :query => 'test')
45
+ helper.show_page_path_params(@page).should_not include(:lang => 'en')
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+ describe "#show_alchemy_page_path" do
53
+
54
+ context "when multi_language" do
55
+
56
+ before do
57
+ helper.stub!(:multi_language?).and_return(true)
58
+ end
59
+
60
+ it "should return the correct relative path string" do
61
+ helper.show_alchemy_page_path(@page).should == "/alchemy/#{@page.language_code}/testpage"
62
+ end
63
+
64
+ it "should return the correct relative path string with additional parameters" do
65
+ helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/alchemy/#{@page.language_code}/testpage?query=test"
66
+ end
67
+
68
+ end
69
+
70
+ context "not multi_language" do
71
+
72
+ before do
73
+ helper.stub!(:multi_language?).and_return(false)
74
+ end
75
+
76
+ it "should return the correct relative path string" do
77
+ helper.show_alchemy_page_path(@page).should == "/alchemy/testpage"
78
+ end
79
+
80
+ it "should return the correct relative path string with additional parameter" do
81
+ helper.show_alchemy_page_path(@page, {:query => 'test'}).should == "/alchemy/testpage?query=test"
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+
88
+ describe "#show_alchemy_page_url" do
89
+
90
+ context "when multi_language" do
91
+
92
+ before do
93
+ helper.stub!(:multi_language?).and_return(true)
94
+ end
95
+
96
+ it "should return the correct url string" do
97
+ helper.show_alchemy_page_url(@page).should == "http://#{helper.request.host}/alchemy/#{@page.language_code}/testpage"
98
+ end
99
+
100
+ it "should return the correct url string with additional parameters" do
101
+ helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/alchemy/#{@page.language_code}/testpage?query=test"
102
+ end
103
+
104
+ end
105
+
106
+ context "not multi_language" do
107
+
108
+ before do
109
+ helper.stub!(:multi_language?).and_return(false)
110
+ end
111
+
112
+ it "should return the correct url string" do
113
+ helper.show_alchemy_page_url(@page).should == "http://#{helper.request.host}/alchemy/testpage"
114
+ end
115
+
116
+ it "should return the correct url string with additional parameter" do
117
+ helper.show_alchemy_page_url(@page, {:query => 'test'}).should == "http://#{helper.request.host}/alchemy/testpage?query=test"
118
+ end
119
+
120
+ end
121
+
122
+ end
123
+
124
+ describe 'picture path helpers' do
125
+
126
+ let(:picture) { mock_model(Picture, :urlname => 'cute_kitten', :id => 42) }
127
+
128
+ describe '#show_alchemy_picture_path' do
129
+
130
+ it "should return the correct relative path string" do
131
+ helper.show_alchemy_picture_path(picture).should == "/alchemy/pictures/42/show/cute_kitten.jpg"
132
+ end
133
+
134
+ end
135
+
136
+ describe '#show_alchemy_picture_url' do
137
+
138
+ it "should return the correct url string" do
139
+ helper.show_alchemy_picture_url(picture).should == "http://#{helper.request.host}/alchemy/pictures/42/show/cute_kitten.jpg"
140
+ end
141
+
142
+ end
143
+
144
+ describe '#show_picture_path_params' do
145
+
146
+ it "should return the correct params for rendering a picture" do
147
+ helper.show_picture_path_params(picture).should include(:name => 'cute_kitten', :format => 'jpg')
148
+ end
149
+
150
+ context "with additional params" do
151
+
152
+ it "should include these params" do
153
+ helper.show_picture_path_params(picture, {:format => 'png'}).should include(:name => 'cute_kitten', :format => 'png')
154
+ end
155
+
156
+ end
157
+
158
+ context "with additional params crop set to true" do
159
+
160
+ it "should include crop as parameter" do
161
+ helper.show_picture_path_params(picture, {:crop => true}).should include(:name => 'cute_kitten', :crop => 'crop')
162
+ end
163
+
164
+ end
165
+
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Link overlay" do
4
+
5
+ before do
6
+ authorize_as_admin
7
+ end
8
+
9
+ context "GUI" do
10
+
11
+ it "has a tab for linking internal pages" do
12
+ visit link_admin_pages_path
13
+ within('#overlay_tabs') { page.should have_content('Internal')}
14
+ end
15
+
16
+ it "has a tab for linking external pages" do
17
+ visit link_admin_pages_path
18
+ within('#overlay_tabs') { page.should have_content('External')}
19
+ end
20
+
21
+ it "has a tab for linking files" do
22
+ visit link_admin_pages_path
23
+ within('#overlay_tabs') { page.should have_content('File')}
24
+ end
25
+
26
+ end
27
+
28
+ context "linking internal pages" do
29
+
30
+ let(:lang_root) do
31
+ FactoryGirl.create(:language_root_page)
32
+ end
33
+
34
+ before do
35
+ public_page = FactoryGirl.create(:public_page, :parent_id => lang_root.id)
36
+ public_page_2 = FactoryGirl.create(:public_page, :parent_id => lang_root.id)
37
+ end
38
+
39
+ it "should have a tree of internal pages" do
40
+ visit link_admin_pages_path
41
+ page.should have_selector('ul#sitemap li a')
42
+ end
43
+
44
+ it "should not have a link for pages that redirect to external" do
45
+ redirect = FactoryGirl.create(:page, :parent_id => lang_root.id, :name => 'Google', :urlname => 'http://www.google.com')
46
+ Alchemy::Page.any_instance.stub(:definition).and_return({'redirects_to_external' => true})
47
+ visit link_admin_pages_path
48
+ page.should_not have_selector('ul#sitemap li div[name="/http-www-google-com"] a')
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -1,34 +1,30 @@
1
- # Skipping on Travis-CI, because capybara-webkit does not install on travis.
2
- unless ENV["CI"]
3
- require 'spec_helper'
1
+ require 'spec_helper'
4
2
 
5
- describe "Modules" do
3
+ describe "Modules" do
6
4
 
7
- context "A custom module with a main-apps controller" do
5
+ context "A custom module with a main-apps controller" do
8
6
 
9
- before(:each) do
10
- load_authorization_rules
11
- create_admin_user
12
- login_into_alchemy
13
- end
14
-
15
- it "should have a button in main_navigation, pointing to the configured controller" do
16
- Alchemy::Modules.register_module(
17
- {
18
- :name => 'events',
19
- :navigation => {
20
- :icon => 'icon events',
21
- :name => 'Events',
22
- :controller => '/admin/events',
23
- :action => 'index'
24
- }
25
- })
26
- visit '/alchemy/admin'
27
- click_on 'Events'
28
- page.should_not have_content('Upps!')
29
- end
7
+ before do
8
+ load_authorization_rules
9
+ authorize_as_admin
10
+ end
30
11
 
12
+ it "should have a button in main_navigation, pointing to the configured controller" do
13
+ Alchemy::Modules.register_module(
14
+ {
15
+ :name => 'events',
16
+ :navigation => {
17
+ :icon => 'icon events',
18
+ :name => 'Events',
19
+ :controller => '/admin/events',
20
+ :action => 'index'
21
+ }
22
+ })
23
+ visit '/alchemy/admin'
24
+ click_on 'Events'
25
+ page.should_not have_content('Upps!')
31
26
  end
32
27
 
33
28
  end
29
+
34
30
  end
@@ -3,23 +3,20 @@ require 'spec_helper'
3
3
  module Alchemy
4
4
  describe Admin::PagesController, :js => true do
5
5
 
6
- before(:each) do
7
- create_admin_user
8
- @german_root = FactoryGirl.create(:language_root_page, :language => Language.get_default, :name => 'Deutsch')
9
- login_into_alchemy
6
+ let(:klingonian) { FactoryGirl.create(:klingonian) }
7
+ let(:german_root) { FactoryGirl.create(:language_root_page) }
8
+ let(:klingonian_root) { FactoryGirl.create(:language_root_page, :name => 'Klingonian', :language => klingonian) }
9
+
10
+ before do
11
+ german_root
12
+ authorize_as_admin
10
13
  end
11
14
 
12
15
  describe "language tree switching" do
13
16
 
14
- before(:all) do
15
- @language = FactoryGirl.create(:language)
16
- end
17
-
18
17
  context "in a multilangual environment" do
19
18
 
20
- before(:all) do
21
- @klingonian_root = FactoryGirl.create(:language_root_page, :name => 'Klingonian')
22
- end
19
+ before { klingonian_root }
23
20
 
24
21
  it "one should be able to switch the language tree" do
25
22
  visit('/alchemy/admin/pages')
@@ -27,14 +24,12 @@ module Alchemy
27
24
  page.should have_selector('#sitemap .sitemap_pagename_link', :text => 'Klingonian')
28
25
  end
29
26
 
30
- after(:all) {
31
- @klingonian_root.delete
32
- }
33
-
34
27
  end
35
28
 
36
29
  context "with no language root page" do
37
30
 
31
+ before { klingonian }
32
+
38
33
  it "it should display the form for creating language root" do
39
34
  visit('/alchemy/admin/pages')
40
35
  page.select 'Klingonian', :from => 'language'
@@ -43,10 +38,6 @@ module Alchemy
43
38
 
44
39
  end
45
40
 
46
- after(:all) {
47
- @language.destroy
48
- }
49
-
50
41
  end
51
42
 
52
43
  describe "flush complete page cache" do
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Picture Library", :js => true do
4
+
5
+ before do
6
+ authorize_as_admin
7
+ end
8
+
9
+ describe "Tagging" do
10
+
11
+ before do
12
+ picture = FactoryGirl.create(:picture, :tag_list => 'tag1', :name => 'TaggedWith1')
13
+ picture = FactoryGirl.create(:picture, :tag_list => 'tag2', :name => 'TaggedWith2')
14
+ end
15
+
16
+ it "it should be possible to filter tags by clicking on its name in the tag list" do
17
+ visit '/alchemy/admin/pictures'
18
+ click_on 'tag1 (1)'
19
+ page.should have_content 'TaggedWith1'
20
+ page.should_not have_content 'TaggedWith2'
21
+ end
22
+
23
+ it "it should be possible to undo tag filtering by clicking on an active tag name" do
24
+ visit '/alchemy/admin/pictures'
25
+ click_on 'tag1 (1)'
26
+ click_on 'tag2 (1)'
27
+ page.should have_content 'TaggedWith2'
28
+ click_on 'tag2 (1)'
29
+ page.should_not have_content 'TaggedWith2'
30
+ end
31
+
32
+ end
33
+
34
+ describe "Filter by tag" do
35
+
36
+ before do
37
+ FactoryGirl.create(:picture, :tag_list => 'bla')
38
+ end
39
+
40
+ it "should list all applied tags" do
41
+ visit '/alchemy/admin/pictures'
42
+ page.should have_content 'bla'
43
+ end
44
+
45
+ it "should be possible to filter pictures by tag" do
46
+ visit '/alchemy/admin/pictures'
47
+ click_on 'bla (1)'
48
+ page.should have_content 'bla'
49
+ end
50
+
51
+ end
52
+ end
@@ -1,94 +1,87 @@
1
- # Skipping on Travis-CI, because capybara-webkit does not install on travis.
2
- unless ENV["CI"]
3
- require 'spec_helper'
4
-
5
- describe "Resources" do
6
-
7
- before(:all) do
8
- Event.create!(:name => 'My Event',
9
- :hidden_name => 'not shown',
10
- :starts_at => DateTime.new(2012, 03, 02, 8, 15),
11
- :ends_at => DateTime.new(2012, 03, 02, 19, 30),
12
- :description => "something\nfancy",
13
- :published => false,
14
- :entrance_fee => 12.32)
15
- Event.create!(:name => 'My second Event',
16
- :starts_at => DateTime.new(2012, 03, 02, 8, 15),
17
- :ends_at => DateTime.new(2012, 03, 02, 19, 30),
18
- :description => "something\nfancy",
19
- :published => false,
20
- :entrance_fee => 12.32)
21
- end
1
+ require 'spec_helper'
2
+
3
+ describe "Resources" do
4
+
5
+ before do
6
+ load_authorization_rules
7
+ authorize_as_admin
8
+ Event.create!(:name => 'My Event',
9
+ :hidden_name => 'not shown',
10
+ :starts_at => DateTime.new(2012, 03, 02, 8, 15),
11
+ :ends_at => DateTime.new(2012, 03, 02, 19, 30),
12
+ :description => "something\nfancy",
13
+ :published => false,
14
+ :entrance_fee => 12.32)
15
+ Event.create!(:name => 'My second Event',
16
+ :starts_at => DateTime.new(2012, 03, 02, 8, 15),
17
+ :ends_at => DateTime.new(2012, 03, 02, 19, 30),
18
+ :description => "something\nfancy",
19
+ :published => false,
20
+ :entrance_fee => 12.32)
21
+ end
22
22
 
23
- before(:each) {
24
- load_authorization_rules
25
- create_admin_user
26
- login_into_alchemy
27
- }
23
+ describe "index view" do
28
24
 
29
- describe "index view" do
25
+ it "should have a button for creating a new resource items" do
26
+ visit '/admin/events'
27
+ page.should have_selector('#toolbar div.button_with_label a.icon_button span.icon.create')
28
+ end
30
29
 
31
- it "should have a button for creating a new resource items" do
32
- visit '/admin/events'
33
- page.should have_selector('#toolbar div.button_with_label a.icon_button span.icon.create')
34
- end
30
+ it "should list existing items" do
31
+ visit '/admin/events'
32
+ page.should have_content("My Event")
33
+ page.should have_content("something fancy")
34
+ page.should have_content("12.32")
35
+ end
35
36
 
36
- it "should list existing items" do
37
- visit '/admin/events'
38
- page.should have_content("My Event")
39
- page.should have_content("something fancy")
40
- page.should have_content("12.32")
41
- end
37
+ it "should list existing resource-items nicely formatted"
42
38
 
43
- it "should list existing resource-items nicely formatted"
39
+ end
44
40
 
45
- end
41
+ describe "form for creating and updating items" do
42
+ it "renders an input field according to the attribute's type"
43
+ end
46
44
 
47
- describe "form for creating and updating items" do
48
- it "renders an input field according to the attribute's type"
49
- end
45
+ describe "create resource item" do
50
46
 
51
- describe "create resource item" do
52
-
53
- context "when form filled with valid data" do
54
- it "lists the new item" do
55
- visit '/admin/events/new'
56
- fill_in 'event_name', :with => 'My second event'
57
- fill_in 'event_starts_at', :with => DateTime.new(2012, 03, 03, 20, 00)
58
- click_on 'Save'
59
- page.should have_content "My second event"
60
- page.should have_content "2012-03-03"
61
- end
47
+ context "when form filled with valid data" do
48
+ it "lists the new item" do
49
+ visit '/admin/events/new'
50
+ fill_in 'event_name', :with => 'My second event'
51
+ fill_in 'event_starts_at', :with => DateTime.new(2012, 03, 03, 20, 00)
52
+ click_on 'Save'
53
+ page.should have_content "My second event"
54
+ page.should have_content "2012-03-03"
62
55
  end
56
+ end
63
57
 
64
- context "when form filled with invalid data" do
65
- it "shows the form again" do
66
- visit '/admin/events/new'
67
- fill_in 'event_name', :with => '' #invalid!
68
- click_on 'Save'
69
- page.should have_selector "input#event_name"
70
- end
71
- it "lists invalid fields"
58
+ context "when form filled with invalid data" do
59
+ it "shows the form again" do
60
+ visit '/admin/events/new'
61
+ fill_in 'event_name', :with => '' #invalid!
62
+ click_on 'Save'
63
+ page.should have_selector "input#event_name"
72
64
  end
73
-
65
+ it "lists invalid fields"
74
66
  end
75
67
 
76
- describe "updating an item" do
77
- it "shows the updated value"
78
- end
68
+ end
79
69
 
80
- describe "destroying an item" do
70
+ describe "updating an item" do
71
+ it "shows the updated value"
72
+ end
73
+
74
+ describe "destroying an item" do
81
75
 
82
- it "should'n be on the list anymore", :js => true do
83
- visit '/admin/events'
84
- within('tr', :text => 'My second Event') do
85
- click_on 'Delete'
86
- end
87
- click_on 'Yes'
88
- page.should have_content "My Event"
89
- page.should_not have_content "My second Event"
76
+ it "should'n be on the list anymore", :js => true do
77
+ visit '/admin/events'
78
+ within('tr', :text => 'My second Event') do
79
+ click_on 'Delete'
90
80
  end
81
+ click_on 'Yes'
82
+ page.should have_content "My Event"
83
+ page.should_not have_content "My second Event"
91
84
  end
92
-
93
85
  end
86
+
94
87
  end