alchemy_cms 2.0.rc6 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.travis.yml +2 -1
  2. data/LICENSE +24 -619
  3. data/README.md +38 -36
  4. data/alchemy_cms.gemspec +1 -1
  5. data/app/controllers/admin/elements_controller.rb +3 -2
  6. data/app/controllers/admin/pages_controller.rb +20 -14
  7. data/app/controllers/admin/trash_controller.rb +4 -0
  8. data/app/controllers/pages_controller.rb +27 -16
  9. data/app/helpers/admin/elements_helper.rb +55 -0
  10. data/app/helpers/alchemy_helper.rb +0 -45
  11. data/app/helpers/elements_helper.rb +8 -1
  12. data/app/helpers/pages_helper.rb +0 -10
  13. data/app/models/element.rb +39 -5
  14. data/app/models/page.rb +27 -7
  15. data/app/sweepers/pages_sweeper.rb +0 -9
  16. data/app/views/admin/pages/update.js.erb +15 -1
  17. data/app/views/admin/partials/_upload_form.html.erb +2 -2
  18. data/app/views/elements/_contactform_view.html.erb +10 -23
  19. data/app/views/elements/_searchresult_view.html.erb +47 -40
  20. data/app/views/essences/_essence_html_view.html.erb +1 -1
  21. data/app/views/pages/show.rss.builder +20 -25
  22. data/assets/javascripts/alchemy.js +2 -2
  23. data/assets/stylesheets/elements.css +1 -1
  24. data/assets/stylesheets/standard_set.css +84 -14
  25. data/config/alchemy/elements.yml +2 -0
  26. data/config/alchemy/page_layouts.yml +1 -0
  27. data/config/locales/de.yml +5 -5
  28. data/lib/alchemy/version.rb +1 -1
  29. data/lib/rails/generators/alchemy/plugin/templates/config.yml +3 -3
  30. data/spec/controllers/admin/trash_controller_spec.rb +22 -0
  31. data/spec/controllers/pages_controller_spec.rb +39 -0
  32. data/spec/dummy/db/schema.rb +10 -9
  33. data/spec/factories.rb +5 -0
  34. data/spec/helpers/elements_helper_spec.rb +7 -0
  35. data/spec/integration/pages_controller_spec.rb +1 -1
  36. data/spec/models/element_spec.rb +51 -5
  37. data/spec/models/page_spec.rb +70 -10
  38. metadata +10 -7
  39. data/TODO.txt +0 -1
@@ -5,22 +5,24 @@ require 'spec_helper'
5
5
  describe Page do
6
6
 
7
7
  before(:each) do
8
- #@rootpage = Factory(:page, :page_layout => "rootpage", :parent_id => nil)
9
- #@language = @rootpage.language
10
- #@language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language)
11
8
  @rootpage = Page.rootpage
12
- @language = @rootpage.language
13
- @language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language)
9
+ @language = Language.get_default
10
+ @language_root = Factory(:page, :parent_id => @rootpage.id, :language => @language, :language_root => true)
14
11
  end
15
12
 
16
13
  it "should contain one rootpage" do
17
14
  Page.rootpage.should be_instance_of(Page)
18
15
  end
16
+
17
+ it "should return all rss feed elements" do
18
+ @page = Factory(:public_page, :page_layout => 'news', :parent_id => @language_root.id, :language => @language)
19
+ @page.feed_elements.should == Element.find_all_by_name('news')
20
+ end
19
21
 
20
22
  context "finding elements" do
21
23
 
22
24
  before(:each) do
23
- @page = Factory(:public_page)
25
+ @page = Factory(:public_page)
24
26
  @non_public_elements = [
25
27
  Factory(:element, :public => false, :page => @page),
26
28
  Factory(:element, :public => false, :page => @page)
@@ -29,17 +31,17 @@ describe Page do
29
31
 
30
32
  it "should return the collection of elements if passed an array into options[:collection]" do
31
33
  options = {:collection => @page.elements}
32
- @page.find_elements(options).all.should == @page.elements.all
33
- end
34
+ @page.find_elements(options).all.should == @page.elements.all
35
+ end
34
36
 
35
37
  context "with show_non_public argument TRUE" do
36
38
 
37
39
  it "should return all elements from empty options" do
38
- @page.find_elements({}, true).all.should == @page.elements.all
40
+ @page.find_elements({}, true).all.should == @page.elements.all
39
41
  end
40
42
 
41
43
  it "should only return the elements passed as options[:only]" do
42
- @page.find_elements({:only => ['article']}, true).all.should == @page.elements.named('article').all
44
+ @page.find_elements({:only => ['article']}, true).all.should == @page.elements.named('article').all
43
45
  end
44
46
 
45
47
  it "should not return the elements passed as options[:except]" do
@@ -138,4 +140,62 @@ describe Page do
138
140
  end
139
141
  end
140
142
 
143
+ context ".public" do
144
+ it "should return 2 pages that are public" do
145
+ Factory(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
146
+ Factory(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
147
+ Page.public.should have(2).pages
148
+ end
149
+ end
150
+
151
+ context ".not_locked" do
152
+ it "should return 3 pages that are not blocked by a user at the moment" do
153
+ Factory(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
154
+ Factory(:public_page, :name => 'Second Public Child', :parent_id => @language_root.id, :language => @language)
155
+ Page.not_locked.should have(3).pages
156
+ end
157
+ end
158
+ context ".all_locked" do
159
+ it "should return 1 page that is blocked by a user at the moment" do
160
+ Factory(:public_page, :locked => true, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
161
+ Page.all_locked.should have(1).pages
162
+ end
163
+ end
164
+
165
+ context ".language_roots" do
166
+ it "should return 1 language_root" do
167
+ Factory(:public_page, :name => 'First Public Child', :parent_id => @language_root.id, :language => @language)
168
+ Page.language_roots.should have(1).pages
169
+ end
170
+ end
171
+
172
+
173
+ context ".layoutpages" do
174
+ it "should return 1 layoutpage" do
175
+ Factory(:public_page, :layoutpage => true, :name => 'Layoutpage', :parent_id => @rootpage.id, :language => @language)
176
+ Page.layoutpages.should have(1).pages
177
+ end
178
+ end
179
+
180
+ context ".visible" do
181
+ it "should return 1 visible page" do
182
+ Factory(:public_page, :name => 'First Public Child', :visible => true, :parent_id => @language_root.id, :language => @language)
183
+ Page.visible.should have(1).pages
184
+ end
185
+ end
186
+
187
+ context ".accessable" do
188
+ it "should return 2 accessable pages" do
189
+ Factory(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
190
+ Page.accessable.should have(2).pages
191
+ end
192
+ end
193
+
194
+ context ".restricted" do
195
+ it "should return 1 restricted page" do
196
+ Factory(:public_page, :name => 'First Public Child', :restricted => true, :parent_id => @language_root.id, :language => @language)
197
+ Page.restricted.should have(1).pages
198
+ end
199
+ end
200
+
141
201
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: 4
5
- version: 2.0.rc6
4
+ prerelease:
5
+ version: "2.0"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas von Deyen
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-10-30 00:00:00 Z
15
+ date: 2011-11-02 00:00:00 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -219,7 +219,6 @@ files:
219
219
  - LICENSE
220
220
  - README.md
221
221
  - Rakefile
222
- - TODO.txt
223
222
  - alchemy_cms.gemspec
224
223
  - app/controllers/admin/attachments_controller.rb
225
224
  - app/controllers/admin/clipboard_controller.rb
@@ -706,6 +705,8 @@ files:
706
705
  - spec/config_spec.rb
707
706
  - spec/controllers/admin/clipboard_controller_spec.rb
708
707
  - spec/controllers/admin/contents_controller_spec.rb
708
+ - spec/controllers/admin/trash_controller_spec.rb
709
+ - spec/controllers/pages_controller_spec.rb
709
710
  - spec/dummy/Rakefile
710
711
  - spec/dummy/app/controllers/application_controller.rb
711
712
  - spec/dummy/app/helpers/application_helper.rb
@@ -761,7 +762,7 @@ files:
761
762
  - spec/spec_helper.rb
762
763
  homepage: http://alchemy-cms.com
763
764
  licenses:
764
- - GPL-3
765
+ - BSD New
765
766
  post_install_message:
766
767
  rdoc_options: []
767
768
 
@@ -776,9 +777,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
776
777
  required_rubygems_version: !ruby/object:Gem::Requirement
777
778
  none: false
778
779
  requirements:
779
- - - ">"
780
+ - - ">="
780
781
  - !ruby/object:Gem::Version
781
- version: 1.3.1
782
+ version: "0"
782
783
  requirements:
783
784
  - ImageMagick (libmagick), v6.6 or greater.
784
785
  rubyforge_project:
@@ -791,6 +792,8 @@ test_files:
791
792
  - spec/config_spec.rb
792
793
  - spec/controllers/admin/clipboard_controller_spec.rb
793
794
  - spec/controllers/admin/contents_controller_spec.rb
795
+ - spec/controllers/admin/trash_controller_spec.rb
796
+ - spec/controllers/pages_controller_spec.rb
794
797
  - spec/dummy/Rakefile
795
798
  - spec/dummy/app/controllers/application_controller.rb
796
799
  - spec/dummy/app/helpers/application_helper.rb
data/TODO.txt DELETED
@@ -1 +0,0 @@
1
- https://github.com/magiclabs/alchemy/issues?milestone=1&state=open