alchemy_cms 2.1.rc2 → 2.1.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js +3 -3
- data/app/assets/stylesheets/alchemy/elements.css.scss +20 -9
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.css.scss +3 -2
- data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +1 -40
- data/app/helpers/alchemy/admin/contents_helper.rb +7 -1
- data/app/helpers/alchemy/admin/elements_helper.rb +1 -5
- data/app/helpers/alchemy/admin/essences_helper.rb +50 -6
- data/app/helpers/alchemy/elements_helper.rb +17 -11
- data/app/helpers/alchemy/pages_helper.rb +75 -56
- data/app/models/alchemy/content.rb +23 -14
- data/app/models/alchemy/element.rb +56 -46
- data/app/views/alchemy/admin/contents/_missing.html.erb +2 -1
- data/app/views/alchemy/admin/contents/create.js.erb +7 -6
- data/app/views/alchemy/admin/dashboard/index.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +11 -9
- data/app/views/alchemy/navigation/_renderer.html.erb +1 -1
- data/config/locales/alchemy.de.yml +1 -1
- data/config/locales/alchemy.en.yml +21 -21
- data/lib/alchemy/capistrano.rb +57 -48
- data/lib/alchemy/page_layout.rb +6 -8
- data/lib/alchemy/version.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +76 -2
- data/spec/integration/pages_controller_spec.rb +1 -1
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/element_spec.rb +23 -0
- metadata +32 -31
data/lib/alchemy/page_layout.rb
CHANGED
@@ -2,7 +2,7 @@ module Alchemy
|
|
2
2
|
class PageLayout
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
-
|
5
|
+
get_layouts
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.element_names_for(page_layout)
|
@@ -25,7 +25,7 @@ module Alchemy
|
|
25
25
|
# You can pass a single layout definition as Hash, or a collection of pagelayouts as Array.
|
26
26
|
# Example Pagelayout definitions can be found in the +page_layouts.yml+ from the standard set.
|
27
27
|
def self.add(page_layout)
|
28
|
-
|
28
|
+
get_layouts
|
29
29
|
if page_layout.is_a?(Array)
|
30
30
|
@@definitions += page_layout
|
31
31
|
elsif page_layout.is_a?(Hash)
|
@@ -38,17 +38,15 @@ module Alchemy
|
|
38
38
|
# Returns the page_layout description found by name in page_layouts.yml
|
39
39
|
def self.get(name)
|
40
40
|
return {} if name.blank?
|
41
|
-
|
42
|
-
@@definitions.detect{ |a| a["name"].downcase == name.downcase }
|
41
|
+
get_layouts.detect{ |a| a["name"].downcase == name.downcase }
|
43
42
|
end
|
44
43
|
|
45
44
|
def self.get_all_by_attributes(attributes)
|
46
45
|
return [] if attributes.blank?
|
47
46
|
if attributes.class.name == 'Hash'
|
48
|
-
@@definitions ||= read_layouts_file
|
49
47
|
layouts = []
|
50
48
|
attributes.stringify_keys.each do |key, value|
|
51
|
-
result =
|
49
|
+
result = get_layouts.select{ |a| a[key].to_s.downcase == value.to_s.downcase if a.has_key?(key) }
|
52
50
|
layouts += result unless result.empty?
|
53
51
|
end
|
54
52
|
return layouts
|
@@ -68,7 +66,7 @@ module Alchemy
|
|
68
66
|
end
|
69
67
|
|
70
68
|
def self.selectable_layouts(language_id, layoutpage = false)
|
71
|
-
|
69
|
+
get_layouts.select do |layout|
|
72
70
|
used = layout["unique"] && has_a_page_this_layout?(layout["name"], language_id)
|
73
71
|
if layoutpage
|
74
72
|
layout["layoutpage"] == true && !used
|
@@ -80,7 +78,7 @@ module Alchemy
|
|
80
78
|
|
81
79
|
def self.get_page_layout_names
|
82
80
|
a = []
|
83
|
-
|
81
|
+
get_layouts.each{ |l| a << l.keys.first }
|
84
82
|
a
|
85
83
|
end
|
86
84
|
|
data/lib/alchemy/version.rb
CHANGED
@@ -48,7 +48,81 @@ describe Alchemy::PagesHelper do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
|
+
describe '#render_subnavigation' do
|
53
|
+
|
54
|
+
before(:each) do
|
55
|
+
@language = Alchemy::Language.get_default
|
56
|
+
@language_root = Factory(:language_root_page, :language => @language, :name => 'Intro')
|
57
|
+
@level_1 = Factory(:public_page, :language => @language, :parent_id => @language_root.id, :visible => true, :name => 'Level 1')
|
58
|
+
@level_2 = Factory(:public_page, :language => @language, :parent_id => @level_1.id, :visible => true, :name => 'Level 2')
|
59
|
+
@level_3 = Factory(:public_page, :language => @language, :parent_id => @level_2.id, :visible => true, :name => 'Level 3')
|
60
|
+
@level_4 = Factory(:public_page, :language => @language, :parent_id => @level_3.id, :visible => true, :name => 'Level 4')
|
61
|
+
helper.stub(:multi_language?).and_return(false)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should return nil if no @page is set" do
|
65
|
+
helper.render_subnavigation.should be(nil)
|
66
|
+
end
|
67
|
+
|
68
|
+
context "showing a page with level 2" do
|
69
|
+
|
70
|
+
before(:each) do
|
71
|
+
@page = @level_2
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should render the navigation from current page" do
|
75
|
+
helper.render_subnavigation.should have_selector('ul > li > a[href="/alchemy/level-2"]')
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should set current page active" do
|
79
|
+
helper.render_subnavigation.should have_selector('a[href="/alchemy/level-2"].active')
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
context "showing a page with level 3" do
|
85
|
+
|
86
|
+
before(:each) do
|
87
|
+
@page = @level_3
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should render the navigation from current pages parent" do
|
91
|
+
helper.render_subnavigation.should have_selector('ul > li > ul > li > a[href="/alchemy/level-3"]')
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should set current page active" do
|
95
|
+
helper.render_subnavigation.should have_selector('a[href="/alchemy/level-3"].active')
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
context "showing a page with level 4" do
|
101
|
+
|
102
|
+
before(:each) do
|
103
|
+
@page = @level_4
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should render the navigation from current pages parents parent" do
|
107
|
+
helper.render_subnavigation.should have_selector('ul > li > ul > li > ul > li > a[href="/alchemy/level-4"]')
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should set current page active" do
|
111
|
+
helper.render_subnavigation.should have_selector('a[href="/alchemy/level-4"].active')
|
112
|
+
end
|
113
|
+
|
114
|
+
context "beginning with level 3" do
|
115
|
+
|
116
|
+
it "should render the navigation beginning from its parent" do
|
117
|
+
helper.render_subnavigation(:level => 3).should have_selector('ul > li > ul > li > a[href="/alchemy/level-4"]')
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
52
126
|
describe "#render_breadcrumb" do
|
53
127
|
|
54
128
|
before(:each) do
|
@@ -248,7 +322,7 @@ describe Alchemy::PagesHelper do
|
|
248
322
|
|
249
323
|
it "should render a title tag for current page with a prefix and a seperator" do
|
250
324
|
@page = mock_model('Page', :title => 'A Public Page')
|
251
|
-
helper.render_title_tag(:prefix => 'Peters Petshop', :seperator => '###').should have_selector('title[contains("Peters Petshop ### A Public Page")]')
|
325
|
+
helper.render_title_tag(:prefix => 'Peters Petshop', :seperator => ' ### ').should have_selector('title[contains("Peters Petshop ### A Public Page")]')
|
252
326
|
end
|
253
327
|
end
|
254
328
|
|
data/spec/models/content_spec.rb
CHANGED
@@ -72,4 +72,28 @@ describe Alchemy::Content do
|
|
72
72
|
|
73
73
|
end
|
74
74
|
|
75
|
+
describe '#copy' do
|
76
|
+
|
77
|
+
before(:each) do
|
78
|
+
@element = Factory(:element, :name => 'text')
|
79
|
+
@content = @element.contents.first
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should create a new record with all attributes of source except given differences" do
|
83
|
+
copy = Alchemy::Content.copy(@content, {:name => 'foobar', :element_id => @element.id + 1})
|
84
|
+
copy.name.should == 'foobar'
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should make a new record for essence of source" do
|
88
|
+
copy = Alchemy::Content.copy(@content, {:element_id => @element.id + 1})
|
89
|
+
copy.essence_id.should_not == @content.essence_id
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should copy source essence attributes" do
|
93
|
+
copy = Alchemy::Content.copy(@content, {:element_id => @element.id + 1})
|
94
|
+
copy.essence.body == @content.essence.body
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
75
99
|
end
|
data/spec/models/element_spec.rb
CHANGED
@@ -153,4 +153,27 @@ describe Alchemy::Element do
|
|
153
153
|
|
154
154
|
end
|
155
155
|
|
156
|
+
describe '#copy' do
|
157
|
+
|
158
|
+
before(:each) do
|
159
|
+
@element = Factory(:element)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should not create contents from scratch" do
|
163
|
+
copy = Alchemy::Element.copy(@element)
|
164
|
+
copy.contents.count.should == @element.contents.count
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should create a new record with all attributes of source except given differences" do
|
168
|
+
copy = Alchemy::Element.copy(@element, {:name => 'foobar'})
|
169
|
+
copy.name.should == 'foobar'
|
170
|
+
end
|
171
|
+
|
172
|
+
it "should make copies of all contents of source" do
|
173
|
+
copy = Alchemy::Element.copy(@element)
|
174
|
+
copy.contents.collect(&:id).should_not == @element.contents.collect(&:id)
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
156
179
|
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.1.
|
4
|
+
version: 2.1.rc3
|
5
5
|
prerelease: 4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-01-
|
14
|
+
date: 2012-01-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &70365142414880 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '3.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70365142414880
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: authlogic
|
29
|
-
requirement: &
|
29
|
+
requirement: &70365142414420 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70365142414420
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: awesome_nested_set
|
40
|
-
requirement: &
|
40
|
+
requirement: &70365142413860 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '2.0'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70365142413860
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: declarative_authorization
|
51
|
-
requirement: &
|
51
|
+
requirement: &70365142413320 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.5.4
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70365142413320
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: tvdeyen-fleximage
|
62
|
-
requirement: &
|
62
|
+
requirement: &70365142412840 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 1.0.9
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70365142412840
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: will_paginate
|
73
|
-
requirement: &
|
73
|
+
requirement: &70365142412340 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '3.0'
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70365142412340
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: acts_as_ferret
|
84
|
-
requirement: &
|
84
|
+
requirement: &70365142411860 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0.5'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70365142411860
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: acts_as_list
|
95
|
-
requirement: &
|
95
|
+
requirement: &70365142411380 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ~>
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0.1'
|
101
101
|
type: :runtime
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70365142411380
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: magiclabs-userstamp
|
106
|
-
requirement: &
|
106
|
+
requirement: &70365142410880 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ~>
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: 2.0.2
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70365142410880
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: dynamic_form
|
117
|
-
requirement: &
|
117
|
+
requirement: &70365142699160 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ~>
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: '1.1'
|
123
123
|
type: :runtime
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70365142699160
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: jquery-rails
|
128
|
-
requirement: &
|
128
|
+
requirement: &70365142698680 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ~>
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: 1.0.16
|
134
134
|
type: :runtime
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *70365142698680
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: attachment_magic
|
139
|
-
requirement: &
|
139
|
+
requirement: &70365142698200 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ~>
|
@@ -144,10 +144,10 @@ dependencies:
|
|
144
144
|
version: 0.2.1
|
145
145
|
type: :runtime
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *70365142698200
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: rspec-rails
|
150
|
-
requirement: &
|
150
|
+
requirement: &70365142697720 !ruby/object:Gem::Requirement
|
151
151
|
none: false
|
152
152
|
requirements:
|
153
153
|
- - ~>
|
@@ -155,10 +155,10 @@ dependencies:
|
|
155
155
|
version: '2.8'
|
156
156
|
type: :development
|
157
157
|
prerelease: false
|
158
|
-
version_requirements: *
|
158
|
+
version_requirements: *70365142697720
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: sqlite3
|
161
|
-
requirement: &
|
161
|
+
requirement: &70365142697340 !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
163
|
requirements:
|
164
164
|
- - ! '>='
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
version: '0'
|
167
167
|
type: :development
|
168
168
|
prerelease: false
|
169
|
-
version_requirements: *
|
169
|
+
version_requirements: *70365142697340
|
170
170
|
description: Alchemy is an awesome Rails CMS with an extremely flexible content storing
|
171
171
|
architecture.
|
172
172
|
email:
|
@@ -791,7 +791,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
791
791
|
version: '0'
|
792
792
|
segments:
|
793
793
|
- 0
|
794
|
-
hash:
|
794
|
+
hash: -574775660697271963
|
795
795
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
796
796
|
none: false
|
797
797
|
requirements:
|
@@ -871,3 +871,4 @@ test_files:
|
|
871
871
|
- spec/routing_spec.rb
|
872
872
|
- spec/spec_helper.rb
|
873
873
|
- spec/support/controller_hacks.rb
|
874
|
+
has_rdoc:
|