alchemy_cms 2.0.rc3 → 2.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/.rspec +1 -2
- data/.travis.yml +11 -0
- data/.yardopts +0 -1
- data/Gemfile +1 -2
- data/README.md +14 -0
- data/alchemy_cms.gemspec +4 -2
- data/app/controllers/admin/clipboard_controller.rb +8 -9
- data/app/controllers/admin/contents_controller.rb +4 -2
- data/app/controllers/admin/essence_pictures_controller.rb +2 -2
- data/app/controllers/admin/layoutpages_controller.rb +2 -0
- data/app/controllers/admin/pages_controller.rb +5 -5
- data/app/controllers/admin/pictures_controller.rb +2 -1
- data/app/controllers/admin/trash_controller.rb +2 -0
- data/app/controllers/alchemy_controller.rb +10 -4
- data/app/controllers/elements_controller.rb +1 -1
- data/app/helpers/admin/elements_helper.rb +32 -1
- data/app/helpers/alchemy_helper.rb +15 -818
- data/app/helpers/contents_helper.rb +69 -0
- data/app/helpers/elements_helper.rb +161 -0
- data/app/helpers/essences_helper.rb +167 -0
- data/app/helpers/pages_helper.rb +401 -19
- data/app/models/attachment.rb +4 -0
- data/app/models/element.rb +27 -14
- data/app/models/page.rb +75 -38
- data/app/views/admin/essence_pictures/destroy.js.erb +1 -1
- data/app/views/admin/pages/_create_language_form.html.erb +2 -1
- data/app/views/admin/pages/new.html.erb +1 -1
- data/app/views/admin/pages/update.js.erb +1 -1
- data/app/views/admin/partials/_upload_form.html.erb +2 -2
- data/app/views/admin/pictures/index.html.erb +7 -4
- data/app/views/essences/_essence_picture_editor.html.erb +1 -3
- data/app/views/layouts/alchemy.html.erb +59 -59
- data/app/views/layouts/pages.html.erb +2 -4
- data/app/views/{partials/_navigation_image_link.html.erb → navigation/_image_link.html.erb} +0 -0
- data/app/views/{partials/_navigation_link.html.erb → navigation/_link.html.erb} +1 -1
- data/app/views/{partials/_navigation_renderer.html.erb → navigation/_renderer.html.erb} +0 -0
- data/app/views/page_layouts/_contact.html.erb +1 -1
- data/app/views/page_layouts/_external.html.erb +0 -1
- data/app/views/page_layouts/_intro.html.erb +1 -1
- data/app/views/page_layouts/_news.html.erb +1 -1
- data/app/views/page_layouts/_search.html.erb +1 -1
- data/app/views/page_layouts/_standard.html.erb +1 -1
- data/assets/images/icons.png +0 -0
- data/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css +49 -31
- data/assets/stylesheets/alchemy.css +111 -91
- data/assets/stylesheets/elements.css +12 -16
- data/bin/alchemy +1 -1
- data/config/alchemy/config.yml +4 -0
- data/config/initializers/tinymce_hammer.rb +1 -0
- data/config/locales/de.yml +3 -1
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +6 -4
- data/lib/alchemy/capistrano.rb +4 -7
- data/lib/alchemy/page_layout.rb +12 -8
- data/lib/alchemy/version.rb +1 -1
- data/spec/controllers/admin/clipboard_controller_spec.rb +23 -0
- data/spec/dummy/db/schema.rb +9 -9
- data/spec/factories.rb +24 -6
- data/spec/helpers/admin/elements_helper_spec.rb +20 -0
- data/spec/helpers/alchemy_helper_spec.rb +41 -0
- data/spec/helpers/contents_helper_spec.rb +27 -0
- data/spec/helpers/elements_helper_spec.rb +39 -0
- data/spec/helpers/essences_helper_spec.rb +49 -0
- data/spec/helpers/pages_helper_spec.rb +140 -0
- data/spec/integration/security_spec.rb +1 -1
- data/spec/integration/standardset_spec.rb +29 -0
- data/spec/models/element_spec.rb +49 -0
- data/spec/{language_spec.rb → models/language_spec.rb} +0 -0
- data/spec/models/page_spec.rb +139 -0
- data/spec/{user_spec.rb → models/user_spec.rb} +0 -0
- data/spec/page_layout_spec.rb +21 -0
- data/spec/routing_spec.rb +53 -0
- data/spec/spec_helper.rb +12 -11
- metadata +54 -303
- data/spec/dummy/config/alchemy/config.yml +0 -199
- data/spec/dummy/config/alchemy/elements.yml +0 -91
- data/spec/dummy/config/alchemy/page_layouts.yml +0 -29
- data/spec/dummy/public/images/alchemy/ajax_loader.gif +0 -0
- data/spec/dummy/public/images/alchemy/alchemy-logo.png +0 -0
- data/spec/dummy/public/images/alchemy/flags.png +0 -0
- data/spec/dummy/public/images/alchemy/gui/navi-tab.png +0 -0
- data/spec/dummy/public/images/alchemy/gui/shading.png +0 -0
- data/spec/dummy/public/images/alchemy/gui/shading_90.png +0 -0
- data/spec/dummy/public/images/alchemy/gui/toggle.png +0 -0
- data/spec/dummy/public/images/alchemy/icons.png +0 -0
- data/spec/dummy/public/images/alchemy/jquery-sb/select_arrow.gif +0 -0
- data/spec/dummy/public/images/alchemy/jquery-sb/select_arrow_bg.gif +0 -0
- data/spec/dummy/public/images/alchemy/jquery-sb/select_arrow_bg_hover.gif +0 -0
- data/spec/dummy/public/images/alchemy/jquery-ui/ui-icons_666666_256x240.png +0 -0
- data/spec/dummy/public/images/alchemy/placeholder.png +0 -0
- data/spec/dummy/public/images/alchemy/swfupload/browse_button.png +0 -0
- data/spec/dummy/public/javascripts/alchemy/alchemy.element_editor_selector.js +0 -88
- data/spec/dummy/public/javascripts/alchemy/alchemy.growler.js +0 -44
- data/spec/dummy/public/javascripts/alchemy/alchemy.image_cropper.js +0 -56
- data/spec/dummy/public/javascripts/alchemy/alchemy.js +0 -892
- data/spec/dummy/public/javascripts/alchemy/alchemy.link_overlay.js +0 -221
- data/spec/dummy/public/javascripts/alchemy/alchemy.page_sorter.js +0 -42
- data/spec/dummy/public/javascripts/alchemy/alchemy.preview.js +0 -145
- data/spec/dummy/public/javascripts/alchemy/jquery-ui.js +0 -428
- data/spec/dummy/public/javascripts/alchemy/jquery.Jcrop.min.js +0 -246
- data/spec/dummy/public/javascripts/alchemy/jquery.dialogextend.min.js +0 -8
- data/spec/dummy/public/javascripts/alchemy/jquery.in-place-edit.js +0 -171
- data/spec/dummy/public/javascripts/alchemy/jquery.js +0 -18
- data/spec/dummy/public/javascripts/alchemy/jquery.rails.js +0 -315
- data/spec/dummy/public/javascripts/alchemy/jquery.sb.min.js +0 -14
- data/spec/dummy/public/javascripts/alchemy/jquery.scrollTo-1.4.2-min.js +0 -11
- data/spec/dummy/public/javascripts/alchemy/jquery.ui.nestedSortable.js +0 -291
- data/spec/dummy/public/javascripts/alchemy/jquery.ui.tabspaging.js +0 -281
- data/spec/dummy/public/javascripts/alchemy/swfupload/fileprogress.js +0 -203
- data/spec/dummy/public/javascripts/alchemy/swfupload/handlers.js +0 -171
- data/spec/dummy/public/javascripts/alchemy/swfupload/queue.js +0 -98
- data/spec/dummy/public/javascripts/alchemy/swfupload/swfupload.js +0 -980
- data/spec/dummy/public/javascripts/alchemy/swfupload/swfupload.swf +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/jquery.tinymce.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/langs/de.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/langs/en.js +0 -223
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/license.txt +0 -504
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/alchemy_link/editor_plugin.js +0 -43
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/alchemy_link/langs/de.js +0 -4
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/alchemy_link/langs/en.js +0 -4
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -109
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css +0 -402
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/inlinepopups/template.htm +0 -387
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/lists/editor_plugin.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/editor_plugin.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/js/pastetext.js +0 -36
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/js/pasteword.js +0 -51
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/langs/de_dlg.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/langs/en_dlg.js +0 -5
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/pastetext.htm +0 -27
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/paste/pasteword.htm +0 -21
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/cell.htm +0 -180
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/css/cell.css +0 -17
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/css/row.css +0 -25
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/css/table.css +0 -13
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/editor_plugin.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/js/cell.js +0 -319
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/js/merge_cells.js +0 -27
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/js/row.js +0 -237
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/js/table.js +0 -450
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/langs/de_dlg.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/langs/en_dlg.js +0 -75
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/merge_cells.htm +0 -32
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/row.htm +0 -158
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/plugins/table/table.htm +0 -188
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/about.htm +0 -52
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/anchor.htm +0 -26
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/charmap.htm +0 -51
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/color_picker.htm +0 -74
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/editor_template.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/image.htm +0 -80
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/flash.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/iframe.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/trans.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/video.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/about.js +0 -73
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/anchor.js +0 -42
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/charmap.js +0 -355
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/color_picker.js +0 -329
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/image.js +0 -247
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/link.js +0 -153
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/js/source_editor.js +0 -56
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/langs/de.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/langs/de_dlg.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/langs/en.js +0 -68
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/langs/en_dlg.js +0 -54
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/link.htm +0 -57
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/shortcuts.htm +0 -47
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/content.css +0 -47
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/dialog.css +0 -117
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/default/ui.css +0 -214
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/highcontrast/content.css +0 -23
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +0 -105
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/highcontrast/ui.css +0 -102
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/content.css +0 -46
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/dialog.css +0 -117
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/ui.css +0 -217
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +0 -8
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/advanced/source_editor.htm +0 -25
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/themes/simple/langs/de.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/tiny_mce.js +0 -1
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/tiny_mce_popup.js +0 -5
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/utils/editable_selects.js +0 -70
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/utils/form_utils.js +0 -210
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/utils/mctabs.js +0 -162
- data/spec/dummy/public/javascripts/alchemy/tiny_mce/utils/validate.js +0 -252
- data/spec/dummy/public/stylesheets/alchemy/Jcrop.gif +0 -0
- data/spec/dummy/public/stylesheets/alchemy/alchemy.css +0 -3653
- data/spec/dummy/public/stylesheets/alchemy/alchemy_tinymce_content.css +0 -94
- data/spec/dummy/public/stylesheets/alchemy/alchemy_tinymce_dialog.css +0 -415
- data/spec/dummy/public/stylesheets/alchemy/default/img/tabs.gif +0 -0
- data/spec/dummy/public/stylesheets/alchemy/elements.css +0 -900
- data/spec/dummy/public/stylesheets/alchemy/flags.css +0 -1
- data/spec/dummy/public/stylesheets/alchemy/ie6.css +0 -18
- data/spec/dummy/public/stylesheets/alchemy/jquery-ui-1.8.7.alchemy.css +0 -2023
- data/spec/dummy/public/stylesheets/alchemy/jquery.Jcrop.css +0 -35
- data/spec/dummy/public/stylesheets/alchemy/jquery.sb.css +0 -244
- data/spec/dummy/public/stylesheets/alchemy/standard_set.css +0 -374
- data/spec/page_spec.rb +0 -50
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include AlchemyHelper
|
4
|
+
|
5
|
+
describe ElementsHelper do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@page = Factory(:public_page)
|
9
|
+
@element = Factory(:element, :page => @page)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should render an element view partial" do
|
13
|
+
helper.render_element(@element).should match(/class="article".+id="article_6"/)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should render all elements" do
|
17
|
+
@another_element = Factory(:element)
|
18
|
+
helper.stub!(:configuration).and_return(true)
|
19
|
+
helper.render_elements.should match(/id="header_3.+id="article_5"/)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should render a unique dom id for element" do
|
23
|
+
helper.element_dom_id(@element).should == "#{@element.name}_#{@element.id}"
|
24
|
+
end
|
25
|
+
|
26
|
+
context "in preview mode" do
|
27
|
+
|
28
|
+
it "should return the data-alchemy-element HTML attribute for element" do
|
29
|
+
@preview_mode = true
|
30
|
+
helper.element_preview_code(@element).should == " data-alchemy-element='#{@element.id}'"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not return the data-alchemy-element HTML attribute if not in preview_mode" do
|
34
|
+
helper.element_preview_code(@element).should_not == " data-alchemy-element='#{@element.id}'"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EssencesHelper do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@element = Factory(:element)
|
7
|
+
@element.content_by_name('intro').essence.update_attributes(:body => 'hello!')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should render an essence" do
|
11
|
+
content = @element.content_by_name('intro')
|
12
|
+
render_essence(content).should match(/hello!/)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should render an essence view" do
|
16
|
+
content = @element.content_by_name('intro')
|
17
|
+
render_essence_view(content).should match(/hello!/)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should render an essence view by name" do
|
21
|
+
render_essence_view_by_name(@element, 'intro').should match(/hello!/)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should render an essence view by type" do
|
25
|
+
render_essence_view_by_type(@element, 'EssenceText').should match(/hello!/)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should render an essence view by position" do
|
29
|
+
render_essence_view_by_position(@element, 1).should match(/hello!/)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should render an essence editor" do
|
33
|
+
content = @element.content_by_name('intro')
|
34
|
+
render_essence_editor(content).should match(/input.+type="text".+value="hello!/)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should render an essence editor by name" do
|
38
|
+
render_essence_editor_by_name(@element, 'intro').should match(/input.+type="text".+value="hello!/)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should render an essence editor by type" do
|
42
|
+
render_essence_editor_by_type(@element, 'EssenceText').should match(/input.+type="text".+value="hello!/)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should render an essence editor by position" do
|
46
|
+
render_essence_editor_by_position(@element, 1).should match(/input.+type="text".+value="hello!/)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PagesHelper do
|
4
|
+
|
5
|
+
it "should render the current page layout" do
|
6
|
+
@page = Factory(:public_page)
|
7
|
+
helper.stub(:configuration).and_return(true)
|
8
|
+
render_page_layout.should have_selector('div#content')
|
9
|
+
end
|
10
|
+
|
11
|
+
context "navigation and meta data" do
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
@language = Language.get_default
|
15
|
+
@root_page = Factory(:language_root_page, :language => @language, :name => 'Home')
|
16
|
+
@page = Factory(:public_page, :language => @language, :parent_id => @root_page.id, :visible => true)
|
17
|
+
helper.stub(:multi_language?).and_return(false)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should render the page navigation" do
|
21
|
+
helper.render_navigation.should have_selector('ul.navigation_level_1 li.a-public-page.active.last a.active[href="/a-public-page"]')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should render a breadcrumb to current page" do
|
25
|
+
helper.render_breadcrumb.should have_selector('a.active.last[href="/a-public-page"]')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should render meta tags for current page" do
|
29
|
+
helper.render_meta_data(:title_prefix => 'Peters Petshop').should have_selector('title[contains("Peters Petshop | A Public Page")]')
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should render a title tag for current page" do
|
33
|
+
helper.render_title_tag(:prefix => 'Peters Petshop').should have_selector('title[contains("Peters Petshop | A Public Page")]')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
context "method language_switches" do
|
39
|
+
|
40
|
+
before :each do
|
41
|
+
@default_language = Language.get_default
|
42
|
+
@klingonian = Factory(:language)
|
43
|
+
# simulates link_to_public_child = true
|
44
|
+
helper.stub(:configuration).and_return(true)
|
45
|
+
helper.stub(:multi_language?).and_return(true)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return nil when having only one public language" do
|
49
|
+
helper.stub(:configuration).and_return(true)
|
50
|
+
helper.language_switches.should be nil
|
51
|
+
end
|
52
|
+
|
53
|
+
context "with two public languages and two language_roots" do
|
54
|
+
|
55
|
+
before :each do
|
56
|
+
@default_language_root = Factory(:language_root_page, :language => @default_language, :name => 'Default Language Root')
|
57
|
+
@klingonian_language_root = Factory(:language_root_page)
|
58
|
+
end
|
59
|
+
|
60
|
+
context "and config redirect_to_public_child is set to TRUE" do
|
61
|
+
|
62
|
+
before :each do
|
63
|
+
# simulates link_to_public_child = true
|
64
|
+
helper.stub(:configuration).and_return(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return nil if only one language_root is public and both do not have children" do
|
68
|
+
@klingonian_language_root.update_attributes(:public => false)
|
69
|
+
helper.language_switches.should == nil
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should return nil if only one language_root is public and both have none public children" do
|
73
|
+
@klingonian_language_root.update_attributes(:public => false)
|
74
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
|
75
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => false, :name => "child1")
|
76
|
+
helper.language_switches.should == nil
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should render two links when having two public language_root pages" do
|
80
|
+
helper.language_switches.should have_selector('a', :count => 2)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should render two links when having just one public language_root but a public children in both language_roots" do
|
84
|
+
@klingonian_language_root.update_attributes(:public => false)
|
85
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
|
86
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
|
87
|
+
helper.language_switches.should have_selector('a', :count => 2)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should render two links when having two not public language_roots but a public children in both" do
|
91
|
+
@default_language_root.update_attributes(:public => false)
|
92
|
+
@klingonian_language_root.update_attributes(:public => false)
|
93
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
|
94
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
|
95
|
+
helper.language_switches.should have_selector('a', :count => 2)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should return nil when having two not public language_roots and a public children in only one of them" do
|
99
|
+
@default_language_root.update_attributes(:public => false)
|
100
|
+
@klingonian_language_root.update_attributes(:public => false)
|
101
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => false, :name => "child1")
|
102
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
|
103
|
+
helper.language_switches.should == nil
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
context "and config redirect_to_public_child is set to FALSE" do
|
109
|
+
|
110
|
+
before :each do
|
111
|
+
# simulates link_to_public_child = false
|
112
|
+
helper.stub(:configuration).and_return(false)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should render two links when having two public language_root pages" do
|
116
|
+
helper.language_switches.should have_selector('a', :count => 2)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should render nil when having just one public language_root but a public children in both language_roots" do
|
120
|
+
@klingonian_language_root.update_attributes(:public => false)
|
121
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
|
122
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
|
123
|
+
helper.language_switches.should == nil
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should render nil when having two not public language_roots but a public children in both" do
|
127
|
+
@default_language_root.update_attributes(:public => false)
|
128
|
+
@klingonian_language_root.update_attributes(:public => false)
|
129
|
+
@default_first_public_child = Factory(:page, :language => @default_language, :parent_id => @default_language_root.id, :public => true, :name => "child1")
|
130
|
+
@klingonian_first_public_child = Factory(:page, :language => @klingonian, :parent_id => @klingonian_language_root.id, :public => true, :name => "child1")
|
131
|
+
helper.language_switches.should == nil
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
@@ -10,7 +10,7 @@ describe "Security: " do
|
|
10
10
|
context "If no user is present" do
|
11
11
|
it "render the signup view" do
|
12
12
|
visit '/'
|
13
|
-
within('#alchemy_greeting') { page.should have_content('
|
13
|
+
within('#alchemy_greeting') { page.should have_content('Signup') }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Alchemy Standard Set' do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
# We need an user or the signup view will show up
|
7
|
+
Factory(:admin_user)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should render a whole page including all its elements and contents" do
|
11
|
+
p = Factory(:public_page, :language => Language.get_default)
|
12
|
+
article = p.elements.find_by_name('article')
|
13
|
+
article.content_by_name('intro').essence.update_attributes(:body => 'Welcome to Peters Petshop', :public => true)
|
14
|
+
visit '/de/a-public-page'
|
15
|
+
within('div#content div.article div.intro') { page.should have_content('Welcome to Peters Petshop') }
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should render the navigation with all visible pages" do
|
19
|
+
language = Language.get_default
|
20
|
+
language_root = Factory(:language_root_page, :language => language, :name => 'Home')
|
21
|
+
pages = [
|
22
|
+
Factory(:public_page, :language => language, :visible => true, :name => 'Page 1', :parent_id => language_root.id),
|
23
|
+
Factory(:public_page, :language => language, :visible => true, :name => 'Page 2', :parent_id => language_root.id)
|
24
|
+
]
|
25
|
+
visit '/'
|
26
|
+
within('div#navigation ul') { page.should have_selector('li a[href="/page-1"], li a[href="/page-2"]') }
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Element do
|
4
|
+
|
5
|
+
context "scoped" do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
Element.delete_all
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return all public elements" do
|
12
|
+
elements = [Factory(:element, :public => true), Factory(:element, :public => true)]
|
13
|
+
Element.published.all.should == elements
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return all elements by name" do
|
17
|
+
elements = [Factory(:element, :name => 'article'), Factory(:element, :name => 'article')]
|
18
|
+
Element.named(['article']).all.should == elements
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should return all elements but excluded ones" do
|
22
|
+
Factory(:element, :name => 'article')
|
23
|
+
Factory(:element, :name => 'article')
|
24
|
+
excluded = [Factory(:element, :name => 'claim')]
|
25
|
+
Element.excluded(['article']).all.should == excluded
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return a list of element definitions for a list of element names" do
|
31
|
+
element_names = ["article"]
|
32
|
+
definitions = Element.all_definitions_for(element_names)
|
33
|
+
definitions.first.fetch("name").should == 'article'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should always return an array calling all_definitions_for()" do
|
37
|
+
definitions = Element.all_definitions_for(nil)
|
38
|
+
definitions.should == []
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should raise an error if no descriptions are found" do
|
42
|
+
FileUtils.mv(File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml'), File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml.bak'))
|
43
|
+
expect { Element.descriptions }.should raise_error
|
44
|
+
FileUtils.mv(File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml.bak'), File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml'))
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return an ingredient by name"
|
48
|
+
|
49
|
+
end
|
File without changes
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Page do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
#@rootpage = Factory(:page, :page_layout => "rootpage", :parent_id => nil)
|
7
|
+
#@language = @rootpage.language
|
8
|
+
#@language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language)
|
9
|
+
@rootpage = Page.rootpage
|
10
|
+
@language = @rootpage.language
|
11
|
+
@language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should contain one rootpage" do
|
15
|
+
Page.rootpage.should be_instance_of(Page)
|
16
|
+
end
|
17
|
+
|
18
|
+
context "finding elements" do
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
@page = Factory(:public_page)
|
22
|
+
@non_public_elements = [
|
23
|
+
Factory(:element, :public => false, :page => @page),
|
24
|
+
Factory(:element, :public => false, :page => @page)
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the collection of elements if passed an array into options[:collection]" do
|
29
|
+
options = {:collection => @page.elements}
|
30
|
+
@page.find_elements(options).all.should == @page.elements.all
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with show_non_public argument TRUE" do
|
34
|
+
|
35
|
+
it "should return all elements from empty options" do
|
36
|
+
@page.find_elements({}, true).all.should == @page.elements.all
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should only return the elements passed as options[:only]" do
|
40
|
+
@page.find_elements({:only => ['article']}, true).all.should == @page.elements.named('article').all
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should not return the elements passed as options[:except]" do
|
44
|
+
@page.find_elements({:except => ['article']}, true).all.should == @page.elements - @page.elements.named('article').all
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should return elements offsetted" do
|
48
|
+
@page.find_elements({:offset => 2}, true).all.should == @page.elements.offset(2)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return elements limitted in count" do
|
52
|
+
@page.find_elements({:count => 1}, true).all.should == @page.elements.limit(1)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
context "with show_non_public argument FALSE" do
|
58
|
+
|
59
|
+
it "should return all elements from empty arguments" do
|
60
|
+
@page.find_elements().all.should == @page.elements.published.all
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should only return the public elements passed as options[:only]" do
|
64
|
+
@page.find_elements(:only => ['article']).all.should == @page.elements.published.named('article').all
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return all public elements except the ones passed as options[:except]" do
|
68
|
+
@page.find_elements(:except => ['article']).all.should == @page.elements.published.all - @page.elements.published.named('article').all
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should return elements offsetted" do
|
72
|
+
@page.find_elements({:offset => 2}).all.should == @page.elements.published.offset(2)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return elements limitted in count" do
|
76
|
+
@page.find_elements({:count => 1}).all.should == @page.elements.published.limit(1)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
context "create" do
|
84
|
+
it "the rootpage with page_layout rootpage does not need a parent_id" do
|
85
|
+
@rootpage.rootpage?.should be_true
|
86
|
+
end
|
87
|
+
|
88
|
+
it "all pages except the rootpage must have a parent_id" do
|
89
|
+
page = Factory.build(:page, :page_layout => "anypage", :parent_id => nil, :language => @language)
|
90
|
+
page.valid?
|
91
|
+
page.errors.should have_key(:parent_id)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "must not be created if the page_layout is set to 'rootpage' and a page already exists with this page_layout and parent_id = nil" do
|
95
|
+
page = Factory.build(:page, :name => "anypage", :page_layout => "rootpage", :parent_id => @language_root.id, :language => @language)
|
96
|
+
page.valid?
|
97
|
+
page.errors.should have_key(:page_layout)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should get a webfriendly urlname on create" do
|
101
|
+
page = Factory(:page, :name => 'klingon$&stößel ', :language => @language, :parent_id => @language_root.id)
|
102
|
+
page.urlname.should == 'klingon-stoessel'
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should generate a three letter urlname from two letter name" do
|
106
|
+
page = Factory(:page, :name => 'Au', :language => @language, :parent_id => @language_root.id)
|
107
|
+
page.urlname.should == '-au'
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should generate a three letter urlname from two letter name with umlaut" do
|
111
|
+
page = Factory(:page, :name => 'Aü', :language => @language, :parent_id => @language_root.id)
|
112
|
+
page.urlname.should == 'aue'
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should generate a three letter urlname from one letter name" do
|
116
|
+
page = Factory(:page, :name => 'A', :language => @language, :parent_id => @language_root.id)
|
117
|
+
page.urlname.should == '--a'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "with children" do
|
122
|
+
before(:each) do
|
123
|
+
@first_child = Factory(:page, :name => "First child", :language => @language, :public => false, :parent_id => @language_root.id)
|
124
|
+
@first_child.move_to_child_of(@language_root)
|
125
|
+
|
126
|
+
@first_public_child = Factory(:page, :name => "First public child", :language => @language, :parent_id => @language_root.id, :public => true)
|
127
|
+
@first_public_child.move_to_child_of(@language_root)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should return a page object (or nil if no public child exists) for first_public_child" do
|
131
|
+
if @language_root.children.any?
|
132
|
+
@language_root.first_public_child.should == @first_public_child
|
133
|
+
else
|
134
|
+
@language_root.first_public_child.should == nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|