alchemy_cms 2.2.rc14 → 2.2.rc15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +11 -0
  2. data/app/assets/javascripts/alchemy/alchemy.js +2 -1
  3. data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +1 -1
  4. data/app/assets/stylesheets/alchemy/elements.css.scss +0 -4
  5. data/app/assets/stylesheets/alchemy/menubar.css.scss +21 -4
  6. data/app/controllers/alchemy/admin/contents_controller.rb +3 -4
  7. data/app/controllers/alchemy/admin/elements_controller.rb +4 -4
  8. data/app/controllers/alchemy/admin/pages_controller.rb +7 -25
  9. data/app/controllers/alchemy/pages_controller.rb +5 -16
  10. data/app/helpers/alchemy/admin/base_helper.rb +3 -3
  11. data/app/helpers/alchemy/admin/contents_helper.rb +3 -2
  12. data/app/helpers/alchemy/admin/elements_helper.rb +22 -0
  13. data/app/helpers/alchemy/elements_helper.rb +12 -12
  14. data/app/helpers/alchemy/pages_helper.rb +43 -43
  15. data/app/models/alchemy/element.rb +3 -3
  16. data/app/models/alchemy/message.rb +5 -1
  17. data/app/models/alchemy/page.rb +23 -11
  18. data/app/sweepers/alchemy/content_sweeper.rb +6 -8
  19. data/app/sweepers/alchemy/pages_sweeper.rb +4 -20
  20. data/app/views/alchemy/admin/contents/create.js.coffee +49 -0
  21. data/app/views/alchemy/admin/elements/create.js.erb +30 -0
  22. data/app/views/alchemy/admin/elements/trash.js.erb +12 -13
  23. data/app/views/alchemy/admin/elements/update.js.erb +19 -22
  24. data/app/views/alchemy/admin/pages/update.js.erb +30 -0
  25. data/app/views/alchemy/admin/users/_user.html.erb +1 -0
  26. data/app/views/alchemy/admin/users/index.html.erb +1 -0
  27. data/app/views/alchemy/essences/_essence_select_editor.html.erb +1 -1
  28. data/config/locales/alchemy.de.yml +1 -0
  29. data/config/locales/alchemy.en.yml +1 -0
  30. data/lib/alchemy/upgrader.rb +0 -2
  31. data/lib/alchemy/version.rb +1 -1
  32. data/spec/controllers/admin/elements_controller_spec.rb +1 -1
  33. data/spec/controllers/admin/pages_controller_spec.rb +23 -3
  34. data/spec/models/page_spec.rb +12 -0
  35. metadata +6 -5
  36. data/app/views/alchemy/admin/contents/create.js.erb +0 -49
  37. data/app/views/alchemy/admin/elements/create.js.coffee +0 -31
  38. data/app/views/alchemy/admin/pages/update.js.coffee +0 -36
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
 
3
- VERSION = "2.2.rc14"
3
+ VERSION = "2.2.rc15"
4
4
 
5
5
  end
@@ -17,7 +17,7 @@ module Alchemy
17
17
 
18
18
  it "should return a select tag with elements" do
19
19
  Alchemy::Page.should_receive(:find_by_urlname_and_language_id).and_return(page)
20
- Alchemy::Element.should_receive(:find_all_by_page_id_and_public).and_return([element])
20
+ Alchemy::Element.stub_chain([:published, :find_all_by_page_id]).and_return([element])
21
21
  get :list, {:page_urlname => page.urlname, :format => :js}
22
22
  response.body.should match(/select(.*)elements_from_page_selector(.*)option/)
23
23
  end
@@ -5,7 +5,7 @@ module Alchemy
5
5
 
6
6
  before(:each) do
7
7
  activate_authlogic
8
- Alchemy::UserSession.create FactoryGirl.create(:admin_user)
8
+ UserSession.create FactoryGirl.create(:admin_user)
9
9
  end
10
10
 
11
11
  describe "#flush" do
@@ -64,7 +64,7 @@ module Alchemy
64
64
  describe '#copy_language_tree' do
65
65
 
66
66
  before(:each) do
67
- @language = Alchemy::Language.get_default
67
+ @language = Language.get_default
68
68
  @language_root = FactoryGirl.create(:language_root_page, :language => @language, :name => 'Intro')
69
69
  @level_1 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @language_root.id, :visible => true, :name => 'Level 1')
70
70
  @level_2 = FactoryGirl.create(:public_page, :language => @language, :parent_id => @level_1.id, :visible => true, :name => 'Level 2')
@@ -74,7 +74,7 @@ module Alchemy
74
74
  session[:language_code] = @new_language.code
75
75
  session[:language_id] = @new_language.id
76
76
  post :copy_language_tree, {:languages => {:new_lang_id => @new_language.id, :old_lang_id => @language.id}}
77
- @new_lang_root = Alchemy::Page.language_root_for(@new_language.id)
77
+ @new_lang_root = Page.language_root_for(@new_language.id)
78
78
  end
79
79
 
80
80
  it "should copy all pages" do
@@ -93,5 +93,25 @@ module Alchemy
93
93
 
94
94
  end
95
95
 
96
+ describe '#edit' do
97
+
98
+ before(:each) do
99
+ @language = Language.get_default
100
+ @page = FactoryGirl.create(:public_page, :language => @language)
101
+ session[:language_id] = @language.id
102
+ end
103
+
104
+ it "should find a page from urlname" do
105
+ get :edit, {:id => @page.to_param}
106
+ response.status.should == 200
107
+ end
108
+
109
+ it "should find a page from id" do
110
+ get :edit, {:id => @page.id}
111
+ response.status.should == 200
112
+ end
113
+
114
+ end
115
+
96
116
  end
97
117
  end
@@ -527,5 +527,17 @@ module Alchemy
527
527
 
528
528
  end
529
529
 
530
+ describe '#to_param' do
531
+
532
+ before(:each) do
533
+ @page = FactoryGirl.create(:public_page)
534
+ end
535
+
536
+ it "should use the urlname as id parameter in urls" do
537
+ @page.to_param.should == @page.urlname
538
+ end
539
+
540
+ end
541
+
530
542
  end
531
543
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.rc14
4
+ version: 2.2.rc15
5
5
  prerelease: 4
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-06-11 00:00:00.000000000 Z
15
+ date: 2012-06-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -394,6 +394,7 @@ files:
394
394
  - app/assets/javascripts/alchemy/alchemy.elements_window.js
395
395
  - app/assets/javascripts/alchemy/alchemy.file_progress.js
396
396
  - app/assets/javascripts/alchemy/alchemy.growler.js
397
+ - app/assets/javascripts/alchemy/alchemy.gui.js.coffee
397
398
  - app/assets/javascripts/alchemy/alchemy.html5.js
398
399
  - app/assets/javascripts/alchemy/alchemy.image_cropper.js
399
400
  - app/assets/javascripts/alchemy/alchemy.jquery_loader.js
@@ -519,7 +520,7 @@ files:
519
520
  - app/views/alchemy/admin/clipboard/insert.js.erb
520
521
  - app/views/alchemy/admin/clipboard/remove.js.erb
521
522
  - app/views/alchemy/admin/contents/_missing.html.erb
522
- - app/views/alchemy/admin/contents/create.js.erb
523
+ - app/views/alchemy/admin/contents/create.js.coffee
523
524
  - app/views/alchemy/admin/contents/destroy.js.coffee
524
525
  - app/views/alchemy/admin/contents/new.html.erb
525
526
  - app/views/alchemy/admin/contents/order.js.erb
@@ -531,7 +532,7 @@ files:
531
532
  - app/views/alchemy/admin/elements/_elements_select.html.erb
532
533
  - app/views/alchemy/admin/elements/_new_element_form.html.erb
533
534
  - app/views/alchemy/admin/elements/_picture_editor.html.erb
534
- - app/views/alchemy/admin/elements/create.js.coffee
535
+ - app/views/alchemy/admin/elements/create.js.erb
535
536
  - app/views/alchemy/admin/elements/fold.js.coffee
536
537
  - app/views/alchemy/admin/elements/index.html.erb
537
538
  - app/views/alchemy/admin/elements/list.js.erb
@@ -576,7 +577,7 @@ files:
576
577
  - app/views/alchemy/admin/pages/show.html.erb
577
578
  - app/views/alchemy/admin/pages/sort.js.erb
578
579
  - app/views/alchemy/admin/pages/unlock.js.erb
579
- - app/views/alchemy/admin/pages/update.js.coffee
580
+ - app/views/alchemy/admin/pages/update.js.erb
580
581
  - app/views/alchemy/admin/partials/_flash.html.erb
581
582
  - app/views/alchemy/admin/partials/_flash_notices.html.erb
582
583
  - app/views/alchemy/admin/partials/_flash_upload.html.erb
@@ -1,49 +0,0 @@
1
- (function($) {
2
- <% if params[:was_missing] -%>
3
-
4
- $("#element_<%= @element.id -%>_content_missing").replaceWith('<%= escape_javascript(
5
- render(
6
- :partial => "alchemy/essences/#{@content.essence_partial_name}_editor",
7
- :locals => @locals
8
- )
9
- ) -%>');
10
-
11
- <% else -%>
12
-
13
- $("<%= @element_dom_id -%>").before('<%= escape_javascript(
14
- render(
15
- :partial => "alchemy/essences/#{@content.essence_partial_name}_editor",
16
- :locals => @locals
17
- )
18
- ) -%>');
19
- Alchemy.enableButton('.disabled.button');
20
- Alchemy.overlayObserver('#<%= content_dom_id(@content) %>');
21
-
22
- <% end -%>
23
-
24
- <% case @content.essence_type -%>
25
- <% when "Alchemy::EssencePicture" -%>
26
- $('#picture_to_assign_<%= @content.ingredient.id %> a').attr('href', '#').off('click');
27
- <% if @contents_of_this_type.length > 1 -%>
28
- $('#element_<%= @element.id -%>_contents .essence_picture_editor').addClass('dragable_picture');
29
- <% end -%>
30
- <% if !max_image_count.blank? && (@contents_of_this_type.length >= max_image_count) -%>
31
- $("#add_content_<%= @element.id -%>").remove();
32
- <% end -%>
33
- Alchemy.SortableContents('#element_<%= @element.id -%>_contents', '<%= form_authenticity_token -%>');
34
-
35
- <% when "Alchemy::EssenceDate" -%>
36
-
37
- Alchemy.Datepicker('#element_<%= @element.id -%> input.date');
38
-
39
- <% when "Alchemy::EssenceRichtext" -%>
40
-
41
- Alchemy.Tinymce.addEditor('contents_content_<%= @content.id -%>_body');
42
-
43
- <% end -%>
44
-
45
- Alchemy.reloadPreview();
46
- Alchemy.closeCurrentWindow();
47
- Alchemy.SelectBox("#element_<%= @element.id %> select.alchemy_selectbox");
48
- Alchemy.growl('<%= t("Successfully added content", :content => @content.name) -%>');
49
- })(jQuery);
@@ -1,31 +0,0 @@
1
- <% if @cutted_element_id %>
2
- $('.element_editor[data-element-id="<%= @cutted_element_id %>"]').remove()
3
- <% end %>
4
-
5
- <% if @page.can_have_cells? %>
6
- Alchemy.selectOrCreateCellTab('<%= @cell.nil? ? "for_other_elements" : @cell.name -%>', '<%= @cell.nil? ? t("other Elements") : @cell.name_for_label -%>')
7
- <% end %>
8
-
9
- $('#cell_<%= @cell.nil? ? "for_other_elements" : @cell.name -%>').append('<%= escape_javascript render(:partial => "element", :object => @element, :locals => {:draggable => true}) -%>')
10
- $('#cell_<%= @cell.nil? ? "for_other_elements" : @cell.name -%>').sortable('refresh')
11
- Alchemy.growl('<%= t("successfully_added_element") -%>')
12
- Alchemy.closeCurrentWindow()
13
-
14
- <% @element.rtf_contents.each do |content| %>
15
- Alchemy.Tinymce.addEditor('<%= content.form_field_id -%>')
16
- <% end %>
17
-
18
- Alchemy.PreviewWindow.refresh()
19
- Alchemy.ElementEditorSelector.init()
20
-
21
- $el = $('#element_<%= @element.id -%>')
22
- $el.trigger('Alchemy.SelectElementEditor')
23
- Alchemy.ElementDirtyObserver($el)
24
- Alchemy.SelectBox('select', $el)
25
- Alchemy.ButtonObserver('button.button', $el)
26
- Alchemy.Datepicker('input[type="date"]', $el)
27
- Alchemy.overlayObserver($el)
28
-
29
- <% if @clipboard.blank? %>
30
- $('#clipboard_button .icon.clipboard').removeClass('full')
31
- <% end %>
@@ -1,36 +0,0 @@
1
- Alchemy.closeCurrentWindow()
2
-
3
- <% if @while_page_edit %>
4
-
5
- Alchemy.reloadPreview()
6
- $('#page_<%= @page.id %>_status').replaceWith('<%= escape_javascript(render(:partial => "page_status")) -%>')
7
-
8
- <% else %>
9
- $page = $('#page_<%= @page.id %>')
10
- $('.sitemap_page > .sitemap_sitename .sitemap_pagename_link', $page).html('<%= @page.name -%>')
11
-
12
- <% if @page.locked? && @page.locker == current_user %>
13
-
14
- $('#locked_page_<%= @page.id %> > a').html('<%= @page.name -%>')
15
-
16
- <% end %>
17
-
18
- $('#page_<%= @page.id %>_infos').html('<%= escape_javascript(render(:partial => "page_infos", :locals => {:page => @page})) -%>')
19
-
20
- <% if @page.restricted? %>
21
-
22
- $('.page_status:nth-child(3)', $page).addClass('restricted', 'not_restricted').removeClass('not_restricted')
23
-
24
- <% elsif @page.redirects_to_external? %>
25
-
26
- $('span.redirect_url', $page).html('&raquo; <%= t("Redirects to") %>: <%= h @page.urlname %>')
27
-
28
- <% else %>
29
-
30
- $('.page_status:nth-child(3)', $page).addClass('not_restricted').removeClass('restricted')
31
-
32
- <% end %>
33
-
34
- <% end %>
35
-
36
- Alchemy.growl("<%= @notice -%>")