alchemy_cms 2.2.4 → 2.3.rc5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.travis.yml +3 -4
- data/Gemfile +1 -0
- data/README.md +10 -6
- data/alchemy_cms.gemspec +5 -2
- data/app/assets/images/alchemy/icons.png +0 -0
- data/app/assets/images/sassy-ie-overlay.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +50 -59
- data/app/assets/javascripts/alchemy/alchemy.buttons.js +14 -4
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js +8 -2
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +11 -3
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js.coffee +14 -1
- data/app/assets/javascripts/alchemy/alchemy.preview.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +12 -4
- data/app/assets/javascripts/alchemy/alchemy.uploader.js +4 -1
- data/app/assets/javascripts/alchemy/alchemy.windows.js +18 -8
- data/app/assets/stylesheets/alchemy/_defaults.scss +84 -120
- data/app/assets/stylesheets/alchemy/alchemy.css +2 -2
- data/app/assets/stylesheets/alchemy/archive.css.scss +288 -0
- data/app/assets/stylesheets/alchemy/base.css.scss +95 -390
- data/app/assets/stylesheets/alchemy/dashboard.css.scss +4 -4
- data/app/assets/stylesheets/alchemy/elements.css.scss +83 -118
- data/app/assets/stylesheets/alchemy/flash.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/form_elements.css.scss +528 -0
- data/app/assets/stylesheets/alchemy/frame.css.scss +13 -39
- data/app/assets/stylesheets/alchemy/icons.css.scss +217 -228
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +48 -50
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/login.css.scss +1 -5
- data/app/assets/stylesheets/alchemy/menubar.css.scss +19 -29
- data/app/assets/stylesheets/alchemy/pagination.css.scss +3 -4
- data/app/assets/stylesheets/alchemy/sitemap.css.scss +81 -81
- data/app/assets/stylesheets/alchemy/tables.css.scss +63 -57
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +57 -57
- data/app/assets/stylesheets/alchemy/upload.css.scss +6 -6
- data/app/assets/stylesheets/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss +6 -10
- data/app/controllers/alchemy/admin/attachments_controller.rb +5 -4
- data/app/controllers/alchemy/admin/base_controller.rb +1 -9
- data/app/controllers/alchemy/admin/contents_controller.rb +4 -6
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
- data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
- data/app/controllers/alchemy/admin/pictures_controller.rb +74 -15
- data/app/controllers/alchemy/attachments_controller.rb +8 -2
- data/app/controllers/alchemy/base_controller.rb +47 -5
- data/app/controllers/alchemy/elements_controller.rb +1 -1
- data/app/controllers/alchemy/messages_controller.rb +12 -12
- data/app/controllers/alchemy/pages_controller.rb +5 -1
- data/app/controllers/alchemy/pictures_controller.rb +9 -4
- data/app/controllers/alchemy/user_sessions_controller.rb +2 -4
- data/app/helpers/alchemy/admin/base_helper.rb +98 -19
- data/app/helpers/alchemy/admin/contents_helper.rb +2 -2
- data/app/helpers/alchemy/admin/elements_helper.rb +2 -3
- data/app/helpers/alchemy/base_helper.rb +6 -5
- data/app/helpers/alchemy/elements_helper.rb +2 -2
- data/app/helpers/alchemy/essences_helper.rb +4 -5
- data/app/helpers/alchemy/pages_helper.rb +15 -79
- data/app/helpers/alchemy/url_helper.rb +67 -0
- data/app/mailers/alchemy/messages.rb +1 -1
- data/app/mailers/alchemy/notifications.rb +1 -1
- data/app/models/alchemy/attachment.rb +11 -2
- data/app/models/alchemy/cell.rb +20 -10
- data/app/models/alchemy/content.rb +4 -3
- data/app/models/alchemy/element.rb +170 -178
- data/app/models/alchemy/language/code.rb +4 -1
- data/app/models/alchemy/message.rb +19 -3
- data/app/models/alchemy/page.rb +45 -40
- data/app/models/alchemy/picture.rb +24 -2
- data/app/models/alchemy/user.rb +2 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +12 -12
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/create.js.erb +1 -0
- data/app/views/alchemy/admin/attachments/edit.html.erb +9 -3
- data/app/views/alchemy/admin/attachments/index.html.erb +3 -2
- data/app/views/alchemy/admin/contents/_missing.html.erb +1 -1
- data/app/views/alchemy/admin/contents/create.js.erb +54 -0
- data/app/views/alchemy/admin/contents/new.html.erb +9 -4
- data/app/views/alchemy/admin/elements/{_add_content.html.erb → _add_picture.html.erb} +4 -4
- data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -1
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -1
- data/app/views/alchemy/admin/elements/{_picture_editor.html.erb → _picture_gallery_editor.html.erb} +7 -11
- data/app/views/alchemy/admin/elements/fold.js.erb +46 -0
- data/app/views/alchemy/admin/elements/index.html.erb +24 -24
- data/app/views/alchemy/admin/elements/list.js.erb +11 -9
- data/app/views/alchemy/admin/essence_files/assign.js.erb +3 -1
- data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +28 -0
- data/app/views/alchemy/admin/pages/_contactform_links.html.erb +8 -6
- data/app/views/alchemy/admin/pages/_external_link.html.erb +11 -9
- data/app/views/alchemy/admin/pages/_file_link.html.erb +10 -8
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +14 -10
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +32 -21
- data/app/views/alchemy/admin/pages/configure.html.erb +2 -2
- data/app/views/alchemy/admin/pages/configure_external.html.erb +13 -13
- data/app/views/alchemy/admin/pages/edit.html.erb +2 -2
- data/app/views/alchemy/admin/pages/index.html.erb +26 -24
- data/app/views/alchemy/admin/pages/link.html.erb +2 -5
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +28 -12
- data/app/views/alchemy/admin/pictures/_archive.html.erb +54 -0
- data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +10 -7
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +21 -22
- data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +31 -0
- data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +9 -0
- data/app/views/alchemy/admin/pictures/_picture.html.erb +36 -6
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +27 -0
- data/app/views/alchemy/admin/pictures/archive_overlay.js.erb +3 -1
- data/app/views/alchemy/admin/pictures/create.js.erb +4 -5
- data/app/views/alchemy/admin/pictures/edit.html.erb +26 -0
- data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +39 -0
- data/app/views/alchemy/admin/pictures/index.html.erb +81 -70
- data/app/views/alchemy/admin/pictures/index.js.erb +3 -0
- data/app/views/alchemy/admin/pictures/new.html.erb +1 -0
- data/app/views/alchemy/admin/resources/index.html.erb +3 -1
- data/app/views/alchemy/admin/users/_table.html.erb +1 -1
- data/app/views/alchemy/admin/users/index.html.erb +27 -23
- data/app/views/alchemy/elements/_article_editor.html.erb +7 -2
- data/app/views/alchemy/elements/_bild_editor.html.erb +1 -1
- data/app/views/alchemy/elements/_bild_text_editor.html.erb +6 -1
- data/app/views/alchemy/elements/_bild_text_view.html.erb +3 -3
- data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -1
- data/app/views/alchemy/elements/_image_mosaic_view.html.erb +2 -2
- data/app/views/alchemy/elements/_intro_image_text_view.html.erb +4 -4
- data/app/views/alchemy/elements/_searchresult_editor.html.erb +4 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +2 -3
- data/app/views/alchemy/essences/_essence_picture_tools.html.erb +1 -1
- data/app/views/alchemy/search/_form.html.erb +8 -0
- data/app/views/alchemy/search/_result.html.erb +3 -2
- data/app/views/alchemy/search/_results.html.erb +28 -0
- data/app/views/alchemy/user_sessions/leave.html.erb +4 -4
- data/app/views/alchemy/user_sessions/login.html.erb +1 -2
- data/app/views/layouts/alchemy/admin.html.erb +30 -10
- data/app/views/layouts/alchemy/login.html.erb +2 -39
- data/config/alchemy/elements.yml +1 -2
- data/config/alchemy/page_layouts.yml +8 -5
- data/config/authorization_rules.rb +27 -18
- data/config/initializers/localeapp.rb +9 -0
- data/config/locales/alchemy.de.yml +93 -56
- data/config/locales/alchemy.en.yml +73 -50
- data/config/routes.rb +3 -1
- data/db/migrate/20120704181529_add_upload_hash_to_alchemy_picture.rb +5 -0
- data/db/migrate/20120705214247_acts_as_taggable_on_migration.rb +28 -0
- data/db/migrate/20120728185830_add_cached_tag_list_to_alchemy_pictures.rb +5 -0
- data/db/migrate/20120831135441_set_alchemy_languages_country_code_default_to_empty_string.rb +9 -0
- data/lib/alchemy/capistrano.rb +2 -2
- data/lib/alchemy/essence.rb +14 -0
- data/lib/alchemy/page_layout.rb +0 -6
- data/lib/alchemy/resource.rb +9 -15
- data/lib/alchemy/upgrader.rb +18 -3
- data/lib/alchemy/version.rb +5 -1
- data/lib/alchemy_cms.rb +4 -1
- data/lib/rails/generators/alchemy/deploy_script/deploy_script_generator.rb +16 -6
- data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +17 -3
- data/lib/rails/generators/alchemy/elements/elements_generator.rb +6 -1
- data/lib/rails/generators/alchemy/elements/templates/editor.html.erb +10 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.erb +17 -18
- data/lib/rails/generators/alchemy/scaffold/files/pages.html.erb +4 -2
- data/lib/tasks/fleximage.rake +2 -2
- data/spec/controllers/admin/contents_controller_spec.rb +2 -2
- data/spec/controllers/admin/elements_controller_spec.rb +30 -1
- data/spec/controllers/admin/pages_controller_spec.rb +35 -18
- data/spec/controllers/admin/trash_controller_spec.rb +40 -16
- data/spec/controllers/attachments_controller_spec.rb +62 -0
- data/spec/controllers/base_controller_spec.rb +43 -42
- data/spec/controllers/elements_controller_spec.rb +30 -0
- data/spec/controllers/pages_controller_spec.rb +22 -5
- data/spec/controllers/pictures_controller_spec.rb +82 -0
- data/spec/dummy/app/models/event.rb +2 -1
- data/spec/dummy/config/database.yml +3 -2
- data/spec/dummy/db/schema.rb +51 -27
- data/spec/factories.rb +29 -8
- data/spec/helpers/admin/base_helper_spec.rb +134 -21
- data/spec/helpers/admin/contents_helper_spec.rb +2 -2
- data/spec/helpers/admin/elements_helper_spec.rb +17 -9
- data/spec/helpers/admin/essences_helper_spec.rb +7 -6
- data/spec/helpers/essences_helper_spec.rb +8 -7
- data/spec/helpers/pages_helper_spec.rb +208 -325
- data/spec/helpers/url_helper_spec.rb +171 -0
- data/spec/integration/admin/link_overlay_spec.rb +53 -0
- data/spec/integration/admin/modules_integration_spec.rb +22 -26
- data/spec/integration/admin/pages_controller_spec.rb +10 -19
- data/spec/integration/admin/picture_library_integration_spec.rb +52 -0
- data/spec/integration/admin/resources_integration_spec.rb +68 -75
- data/spec/integration/pages_controller_spec.rb +70 -61
- data/spec/integration/security_spec.rb +3 -5
- data/spec/integration/translation_integration_spec.rb +56 -0
- data/spec/libraries/essence_spec.rb +18 -0
- data/spec/libraries/resource_spec.rb +101 -79
- data/spec/libraries/resources_helper_spec.rb +3 -0
- data/spec/models/content_spec.rb +63 -60
- data/spec/models/element_spec.rb +203 -93
- data/spec/models/language_spec.rb +90 -65
- data/spec/models/page_layout_spec.rb +37 -0
- data/spec/models/page_spec.rb +181 -113
- data/spec/models/picture_spec.rb +73 -26
- data/spec/models/resource_spec.rb +52 -23
- data/spec/support/alchemy/specs_helpers.rb +2 -0
- data/spec/support/image.png +0 -0
- data/spec/{helpers/url_helpers_spec.rb → url_helpers_spec.rb} +0 -0
- data/vendor/assets/javascripts/jquery_plugins/jquery.selectBoxIt.js +1909 -0
- data/vendor/assets/javascripts/jquery_plugins/preloadCssImages.jQuery_v5.js +152 -0
- metadata +106 -33
- data/app/assets/stylesheets/alchemy/buttons.css.scss +0 -361
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +0 -260
- data/app/views/alchemy/admin/contents/create.js.coffee +0 -49
- data/app/views/alchemy/admin/elements/fold.js.coffee +0 -37
- data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +0 -19
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +0 -16
- data/app/views/alchemy/admin/pictures/update.js.erb +0 -3
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/locales/fo.yml +0 -5
- data/spec/page_layout_spec.rb +0 -35
- data/vendor/assets/javascripts/jquery_plugins/jquery.in-place-edit.js +0 -172
- data/vendor/assets/javascripts/jquery_plugins/jquery.sb.min.js +0 -14
@@ -1,61 +1,63 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
module Alchemy
|
4
|
+
describe BaseController do
|
4
5
|
|
5
|
-
|
6
|
+
let(:default_language) { Language.get_default }
|
7
|
+
let(:klingonian) { FactoryGirl.create(:klingonian) }
|
6
8
|
|
7
|
-
|
8
|
-
@language = Alchemy::Language.get_default
|
9
|
-
controller.send :set_language_from, @language.id
|
10
|
-
controller.session[:language_id].should == @language.id
|
11
|
-
end
|
9
|
+
describe "#set_language_from" do
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
it "should set the language from id" do
|
12
|
+
controller.send :set_language_from, default_language.id
|
13
|
+
controller.session[:language_id].should == default_language.id
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should set the language from code" do
|
17
|
+
controller.send :set_language_from, klingonian.code
|
18
|
+
controller.session[:language_id].should == klingonian.id
|
19
|
+
controller.session[:language_code].should == klingonian.code
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should set the language from id as string" do
|
23
|
+
controller.send :set_language_from, default_language.id.to_s
|
24
|
+
controller.session[:language_id].should == default_language.id
|
25
|
+
controller.session[:language_code].should == default_language.code
|
26
|
+
end
|
19
27
|
|
20
|
-
it "should set the language from id as string" do
|
21
|
-
@language = FactoryGirl.create(:language)
|
22
|
-
controller.send :set_language_from, @language.id.to_s
|
23
|
-
controller.session[:language_id].should == @language.id
|
24
|
-
controller.session[:language_code].should == @language.code
|
25
28
|
end
|
26
29
|
|
27
|
-
|
30
|
+
describe "#set_language" do
|
28
31
|
|
29
|
-
|
32
|
+
context "with no lang param" do
|
30
33
|
|
31
|
-
|
34
|
+
it "should set the default language" do
|
35
|
+
controller.stub!(:params).and_return({})
|
36
|
+
controller.send :set_language
|
37
|
+
controller.session[:language_id].should == default_language.id
|
38
|
+
controller.session[:language_code].should == default_language.code
|
39
|
+
end
|
32
40
|
|
33
|
-
it "should set the default language" do
|
34
|
-
controller.stub!(:params).and_return({})
|
35
|
-
controller.send :set_language
|
36
|
-
controller.session[:language_id].should == Alchemy::Language.get_default.id
|
37
|
-
controller.session[:language_code].should == Alchemy::Language.get_default.code
|
38
41
|
end
|
39
42
|
|
40
|
-
|
43
|
+
context "with lang param" do
|
41
44
|
|
42
|
-
|
45
|
+
it "should set the language" do
|
46
|
+
controller.stub!(:params).and_return({:lang => klingonian.code})
|
47
|
+
controller.send :set_language
|
48
|
+
controller.session[:language_id].should == klingonian.id
|
49
|
+
controller.session[:language_code].should == klingonian.code
|
50
|
+
end
|
43
51
|
|
44
|
-
|
45
|
-
@language = FactoryGirl.create(:language)
|
46
|
-
controller.stub!(:params).and_return({:lang => 'kl'})
|
47
|
-
controller.send :set_language
|
48
|
-
controller.session[:language_id].should == @language.id
|
49
|
-
controller.session[:language_code].should == @language.code
|
50
|
-
end
|
52
|
+
context "for language that does not exist" do
|
51
53
|
|
52
|
-
|
54
|
+
it "should set the language to default" do
|
55
|
+
controller.stub!(:params).and_return({:lang => 'fo'})
|
56
|
+
controller.send :set_language
|
57
|
+
controller.session[:language_id].should == default_language.id
|
58
|
+
controller.session[:language_code].should == default_language.code
|
59
|
+
end
|
53
60
|
|
54
|
-
it "should set the language to default" do
|
55
|
-
controller.stub!(:params).and_return({:lang => 'fo'})
|
56
|
-
controller.send :set_language
|
57
|
-
controller.session[:language_id].should == Alchemy::Language.get_default.id
|
58
|
-
controller.session[:language_code].should == Alchemy::Language.get_default.code
|
59
61
|
end
|
60
62
|
|
61
63
|
end
|
@@ -63,5 +65,4 @@ describe Alchemy::BaseController do
|
|
63
65
|
end
|
64
66
|
|
65
67
|
end
|
66
|
-
|
67
68
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
describe ElementsController do
|
5
|
+
|
6
|
+
let(:page) { FactoryGirl.create(:public_page, :restricted => true) }
|
7
|
+
let(:element) { FactoryGirl.create(:element, :page => page, :name => 'download') }
|
8
|
+
|
9
|
+
it "should not be possible to see restricted elements" do
|
10
|
+
get :show, :id => element.id
|
11
|
+
response.status.should == 302
|
12
|
+
response.should redirect_to(login_path)
|
13
|
+
end
|
14
|
+
|
15
|
+
context "as a registered user" do
|
16
|
+
|
17
|
+
before do
|
18
|
+
activate_authlogic
|
19
|
+
UserSession.create(FactoryGirl.create(:registered_user))
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be possible to see restricted elements" do
|
23
|
+
get :show, :id => element.id
|
24
|
+
response.status.should == 200
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -12,7 +12,7 @@ describe Alchemy::PagesController do
|
|
12
12
|
context "requested for a page containing a feed" do
|
13
13
|
|
14
14
|
before(:each) do
|
15
|
-
@page = FactoryGirl.create(:public_page, :parent_id => @default_language_root.id, :page_layout => 'news', :name => 'News', :language => @default_language)
|
15
|
+
@page = FactoryGirl.create(:public_page, :parent_id => @default_language_root.id, :page_layout => 'news', :name => 'News', :language => @default_language, :do_not_autogenerate => false)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should render a rss feed" do
|
@@ -42,8 +42,25 @@ describe Alchemy::PagesController do
|
|
42
42
|
context "with param layout set to none" do
|
43
43
|
|
44
44
|
it "should not render a layout" do
|
45
|
-
get :show, :urlname => :home, :layout =>
|
46
|
-
response.body.should_not
|
45
|
+
get :show, :urlname => :home, :layout => 'none'
|
46
|
+
response.body.should_not match /<head>/
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
context "with param layout set to false" do
|
52
|
+
|
53
|
+
it "should not render a layout" do
|
54
|
+
get :show, :urlname => :home, :layout => 'false'
|
55
|
+
response.body.should_not match /<head>/
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
context "with params layout set to not existing layout" do
|
61
|
+
|
62
|
+
it "should raise ActionController::RoutingError" do
|
63
|
+
expect { get :show, :urlname => :home, :layout => 'lkuiuk' }.to raise_error(ActionController::RoutingError)
|
47
64
|
end
|
48
65
|
|
49
66
|
end
|
@@ -104,8 +121,8 @@ describe Alchemy::PagesController do
|
|
104
121
|
before(:each) do
|
105
122
|
@catalog = FactoryGirl.create(:public_page, :name => "Catalog", :parent_id => @default_language_root.id, :language => @default_language)
|
106
123
|
@products = FactoryGirl.create(:public_page, :name => "Products", :parent_id => @catalog.id, :language => @default_language)
|
107
|
-
@product = FactoryGirl.create(:public_page, :name => "Screwdriver", :parent_id => @products.id, :language => @default_language)
|
108
|
-
@product.elements.find_by_name('article').contents.essence_texts.first.essence.
|
124
|
+
@product = FactoryGirl.create(:public_page, :name => "Screwdriver", :parent_id => @products.id, :language => @default_language, :do_not_autogenerate => false)
|
125
|
+
@product.elements.find_by_name('article').contents.essence_texts.first.essence.update_column(:body, 'screwdriver')
|
109
126
|
controller.stub!(:configuration) { |arg| arg == :url_nesting ? true : false }
|
110
127
|
end
|
111
128
|
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Fixes missing method tempfile error
|
4
|
+
class Rack::Test::UploadedFile
|
5
|
+
attr_reader :tempfile
|
6
|
+
end
|
7
|
+
|
8
|
+
module Alchemy
|
9
|
+
describe PicturesController do
|
10
|
+
|
11
|
+
let(:page) { FactoryGirl.create(:public_page, :restricted => false) }
|
12
|
+
let(:restricted_page) { FactoryGirl.create(:public_page, :restricted => true) }
|
13
|
+
let(:element) { FactoryGirl.create(:element, :page => page, :name => 'bild', :create_contents_after_create => true) }
|
14
|
+
let(:restricted_element) { FactoryGirl.create(:element, :page => restricted_page, :name => 'bild', :create_contents_after_create => true) }
|
15
|
+
let(:picture) { Picture.create(:image_file => fixture_file_upload(File.expand_path('../../support/image.png', __FILE__), 'image/png')) }
|
16
|
+
|
17
|
+
context "Requesting a picture that is not assigned with any page" do
|
18
|
+
it "should render the picture" do
|
19
|
+
get :show, :id => picture.id, :format => :png
|
20
|
+
response.status.should == 200
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "Requesting a picture that is assigned on restricted and non-restricted pages" do
|
25
|
+
|
26
|
+
before do
|
27
|
+
essence = element.contents.where(:name => 'image').first.essence
|
28
|
+
essence.picture_id = picture.id
|
29
|
+
essence.save
|
30
|
+
|
31
|
+
essence = restricted_element.contents.where(:name => 'image').first.essence
|
32
|
+
essence.picture_id = picture.id
|
33
|
+
essence.save
|
34
|
+
end
|
35
|
+
|
36
|
+
context "as guest user" do
|
37
|
+
it "should render the picture" do
|
38
|
+
get :show, :id => picture.id, :format => :png
|
39
|
+
response.status.should == 200
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
context "Requesting a picture that is assigned with restricted pages only" do
|
46
|
+
|
47
|
+
before do
|
48
|
+
essence = restricted_element.contents.where(:name => 'image').first.essence
|
49
|
+
essence.picture_id = picture.id
|
50
|
+
essence.save
|
51
|
+
end
|
52
|
+
|
53
|
+
context "as guest user" do
|
54
|
+
|
55
|
+
it "should not render the picture, but redirect to login path" do
|
56
|
+
get :show, :id => picture.id
|
57
|
+
response.status.should == 302
|
58
|
+
response.should redirect_to(login_path)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
context "as registered user" do
|
64
|
+
|
65
|
+
before do
|
66
|
+
activate_authlogic
|
67
|
+
UserSession.create(FactoryGirl.create(:registered_user))
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should render the picture" do
|
71
|
+
get :show, :id => picture.id, :format => :png
|
72
|
+
response.status.should == 200
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class Event < ActiveRecord::Base
|
2
|
-
attr_accessible :name, :hidden_name, :starts_at, :ends_at, :description, :published, :entrance_fee, :location_id
|
2
|
+
attr_accessible :name, :hidden_name, :starts_at, :ends_at, :description, :published, :entrance_fee, :location_id, :organizer_id
|
3
3
|
validates_presence_of :name
|
4
|
+
|
4
5
|
end
|
@@ -5,13 +5,14 @@ sqlite: &sqlite
|
|
5
5
|
mysql: &mysql
|
6
6
|
adapter: mysql2
|
7
7
|
username: root
|
8
|
-
password:
|
8
|
+
password:
|
9
9
|
database: alchemy_cms_dummy_<%= Rails.env %>
|
10
10
|
|
11
11
|
postgresql: &postgresql
|
12
12
|
adapter: postgresql
|
13
|
+
<% if ENV['CI'] %>
|
13
14
|
username: postgres
|
14
|
-
|
15
|
+
<% end %>
|
15
16
|
database: alchemy_cms_dummy_<%= Rails.env %>
|
16
17
|
min_messages: ERROR
|
17
18
|
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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 =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120831135441) do
|
15
15
|
|
16
16
|
create_table "alchemy_attachments", :force => true do |t|
|
17
17
|
t.string "name"
|
@@ -24,14 +24,6 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
24
24
|
t.datetime "updated_at", :null => false
|
25
25
|
end
|
26
26
|
|
27
|
-
create_table "alchemy_essence_booleans", :force => true do |t|
|
28
|
-
t.boolean "value"
|
29
|
-
t.timestamps
|
30
|
-
t.userstamps
|
31
|
-
end
|
32
|
-
|
33
|
-
add_index "alchemy_essence_booleans", ["value"], :name => "index_alchemy_essence_booleans_on_value"
|
34
|
-
|
35
27
|
create_table "alchemy_cells", :force => true do |t|
|
36
28
|
t.integer "page_id"
|
37
29
|
t.string "name"
|
@@ -86,6 +78,16 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
86
78
|
t.datetime "updated_at", :null => false
|
87
79
|
end
|
88
80
|
|
81
|
+
create_table "alchemy_essence_booleans", :force => true do |t|
|
82
|
+
t.boolean "value"
|
83
|
+
t.datetime "created_at", :null => false
|
84
|
+
t.datetime "updated_at", :null => false
|
85
|
+
t.integer "creator_id"
|
86
|
+
t.integer "updater_id"
|
87
|
+
end
|
88
|
+
|
89
|
+
add_index "alchemy_essence_booleans", ["value"], :name => "index_alchemy_essence_booleans_on_value"
|
90
|
+
|
89
91
|
create_table "alchemy_essence_dates", :force => true do |t|
|
90
92
|
t.datetime "date"
|
91
93
|
t.integer "creator_id"
|
@@ -154,9 +156,11 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
154
156
|
end
|
155
157
|
|
156
158
|
create_table "alchemy_essence_selects", :force => true do |t|
|
157
|
-
t.string
|
158
|
-
t.
|
159
|
-
t.
|
159
|
+
t.string "value"
|
160
|
+
t.datetime "created_at", :null => false
|
161
|
+
t.datetime "updated_at", :null => false
|
162
|
+
t.integer "creator_id"
|
163
|
+
t.integer "updater_id"
|
160
164
|
end
|
161
165
|
|
162
166
|
add_index "alchemy_essence_selects", ["value"], :name => "index_alchemy_essence_selects_on_value"
|
@@ -205,7 +209,7 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
205
209
|
t.integer "creator_id"
|
206
210
|
t.integer "updater_id"
|
207
211
|
t.boolean "default", :default => false
|
208
|
-
t.string "country_code"
|
212
|
+
t.string "country_code", :default => "", :null => false
|
209
213
|
end
|
210
214
|
|
211
215
|
add_index "alchemy_languages", ["language_code", "country_code"], :name => "index_alchemy_languages_on_language_code_and_country_code"
|
@@ -224,17 +228,17 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
224
228
|
t.integer "rgt"
|
225
229
|
t.integer "parent_id"
|
226
230
|
t.integer "depth"
|
227
|
-
t.boolean "visible",
|
228
|
-
t.boolean "public",
|
229
|
-
t.boolean "locked",
|
231
|
+
t.boolean "visible", :default => false
|
232
|
+
t.boolean "public", :default => false
|
233
|
+
t.boolean "locked", :default => false
|
230
234
|
t.integer "locked_by"
|
231
|
-
t.boolean "restricted",
|
232
|
-
t.boolean "robot_index",
|
233
|
-
t.boolean "robot_follow",
|
234
|
-
t.boolean "sitemap",
|
235
|
-
t.boolean "layoutpage",
|
236
|
-
t.datetime "created_at",
|
237
|
-
t.datetime "updated_at",
|
235
|
+
t.boolean "restricted", :default => false
|
236
|
+
t.boolean "robot_index", :default => true
|
237
|
+
t.boolean "robot_follow", :default => true
|
238
|
+
t.boolean "sitemap", :default => true
|
239
|
+
t.boolean "layoutpage", :default => false
|
240
|
+
t.datetime "created_at", :null => false
|
241
|
+
t.datetime "updated_at", :null => false
|
238
242
|
t.integer "creator_id"
|
239
243
|
t.integer "updater_id"
|
240
244
|
t.integer "language_id"
|
@@ -249,10 +253,12 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
249
253
|
t.string "image_filename"
|
250
254
|
t.integer "image_width"
|
251
255
|
t.integer "image_height"
|
252
|
-
t.datetime "created_at",
|
253
|
-
t.datetime "updated_at",
|
256
|
+
t.datetime "created_at", :null => false
|
257
|
+
t.datetime "updated_at", :null => false
|
254
258
|
t.integer "creator_id"
|
255
259
|
t.integer "updater_id"
|
260
|
+
t.string "upload_hash"
|
261
|
+
t.string "cached_tag_list"
|
256
262
|
end
|
257
263
|
|
258
264
|
create_table "alchemy_users", :force => true do |t|
|
@@ -292,8 +298,26 @@ ActiveRecord::Schema.define(:version => 20120611221734) do
|
|
292
298
|
t.decimal "entrance_fee", :precision => 6, :scale => 2
|
293
299
|
t.boolean "published"
|
294
300
|
t.integer "location_id"
|
295
|
-
t.
|
296
|
-
t.datetime "
|
301
|
+
t.integer "organizer_id"
|
302
|
+
t.datetime "created_at", :null => false
|
303
|
+
t.datetime "updated_at", :null => false
|
304
|
+
end
|
305
|
+
|
306
|
+
create_table "taggings", :force => true do |t|
|
307
|
+
t.integer "tag_id"
|
308
|
+
t.integer "taggable_id"
|
309
|
+
t.string "taggable_type"
|
310
|
+
t.integer "tagger_id"
|
311
|
+
t.string "tagger_type"
|
312
|
+
t.string "context"
|
313
|
+
t.datetime "created_at"
|
314
|
+
end
|
315
|
+
|
316
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
317
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
318
|
+
|
319
|
+
create_table "tags", :force => true do |t|
|
320
|
+
t.string "name"
|
297
321
|
end
|
298
322
|
|
299
323
|
end
|
data/spec/factories.rb
CHANGED
@@ -25,27 +25,40 @@ FactoryGirl.define do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
factory :language, :class => 'Alchemy::Language' do
|
28
|
-
|
29
|
-
|
30
|
-
default
|
31
|
-
frontpage_name '
|
28
|
+
name 'Deutsch'
|
29
|
+
code 'de'
|
30
|
+
default true
|
31
|
+
frontpage_name 'Intro'
|
32
32
|
page_layout 'intro'
|
33
33
|
public true
|
34
34
|
|
35
|
-
factory :
|
36
|
-
|
35
|
+
factory :klingonian do
|
36
|
+
name 'Klingonian'
|
37
|
+
code 'kl'
|
38
|
+
frontpage_name 'Tuq'
|
39
|
+
default false
|
40
|
+
end
|
41
|
+
|
42
|
+
factory :english do
|
43
|
+
name 'English'
|
44
|
+
code 'en'
|
45
|
+
frontpage_name 'Intro'
|
46
|
+
default false
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
50
|
factory :page, :class => 'Alchemy::Page' do
|
41
51
|
|
42
|
-
language { Alchemy::Language.
|
52
|
+
language { Alchemy::Language.get_default || FactoryGirl.create(:language) }
|
43
53
|
sequence(:name) { |n| "A Page #{n}" }
|
44
54
|
parent_id { (Alchemy::Page.find_by_language_root(true) || FactoryGirl.create(:language_root_page)).id }
|
45
55
|
page_layout "standard"
|
46
56
|
|
57
|
+
# This speeds up creating of pages dramatically. Pass :do_not_autogenerate => false to generate elements
|
58
|
+
do_not_autogenerate true
|
59
|
+
|
47
60
|
factory :language_root_page do
|
48
|
-
name '
|
61
|
+
name 'Startseite'
|
49
62
|
page_layout 'intro'
|
50
63
|
language_root true
|
51
64
|
public true
|
@@ -74,6 +87,14 @@ FactoryGirl.define do
|
|
74
87
|
|
75
88
|
factory :element, :class => 'Alchemy::Element' do
|
76
89
|
name 'article'
|
90
|
+
create_contents_after_create false
|
91
|
+
end
|
92
|
+
|
93
|
+
factory :picture, :class => 'Alchemy::Picture' do
|
94
|
+
image_file File.new(File.expand_path('../support/image.png', __FILE__))
|
95
|
+
name 'image'
|
96
|
+
image_filename 'image.png'
|
97
|
+
upload_hash Time.now.hash
|
77
98
|
end
|
78
99
|
|
79
100
|
end
|