alchemy_cms 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/app/models/alchemy/element.rb +14 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +9 -9
- data/lib/alchemy/permissions.rb +1 -1
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/templates/alchemy.rb +5 -4
- data/spec/dummy/app/models/dummy_user.rb +1 -1
- data/spec/features/admin/page_editing_feature_spec.rb +104 -64
- data/spec/libraries/permissions_spec.rb +8 -1
- data/spec/models/element_spec.rb +23 -0
- data/spec/models/page_spec.rb +19 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da3fbeab242eee7ed6dde78b96f4a503df8168d1
|
4
|
+
data.tar.gz: 372a82e46f31f66b61776290d1c2e6a56fa340a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6d578e24ffa7c5c6dc715e9e6ce3f859e49d7acbc1d42ad2b83f64e1adb9ce91acb5c4463071b91a6e88a020bc3592cee949517fc98304f5d4a5b35ff265531
|
7
|
+
data.tar.gz: e047f4e17c7081890e7b6abe6e4707de26715b610bb11e722d7cbb695bfcce2a446ef524895cb3f4591132ec157ade16d7d2244c66661199c0ecf876405090e9
|
data/.travis.yml
CHANGED
@@ -7,13 +7,13 @@ rvm:
|
|
7
7
|
- 2.1
|
8
8
|
branches:
|
9
9
|
only:
|
10
|
-
-
|
10
|
+
- 3.1-stable
|
11
11
|
before_script: 'bundle exec rake alchemy:spec:prepare'
|
12
12
|
script: 'bundle exec rspec'
|
13
13
|
env:
|
14
14
|
- DB=mysql
|
15
15
|
- DB=postgresql
|
16
|
-
- RAILS_VERSION=4.0.
|
16
|
+
- RAILS_VERSION=4.0.13
|
17
17
|
notifications:
|
18
18
|
irc:
|
19
19
|
on_success: change
|
data/Gemfile
CHANGED
@@ -421,6 +421,20 @@ module Alchemy
|
|
421
421
|
"alchemy/elements/#{name}_view"
|
422
422
|
end
|
423
423
|
|
424
|
+
# Returns the key that's taken for cache path.
|
425
|
+
#
|
426
|
+
# Uses the page's +published_at+ value that's updated when the user publishes the page.
|
427
|
+
#
|
428
|
+
# If the page is the current preview it uses the element's updated_at value as cache key.
|
429
|
+
#
|
430
|
+
def cache_key
|
431
|
+
if Page.current_preview == self.page
|
432
|
+
"alchemy/elements/#{id}-#{updated_at}"
|
433
|
+
else
|
434
|
+
"alchemy/elements/#{id}-#{page.published_at}"
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
424
438
|
private
|
425
439
|
|
426
440
|
# creates the contents for this element as described in the elements.yml
|
@@ -70,15 +70,15 @@
|
|
70
70
|
<% end %>
|
71
71
|
<label><%= _t(:page_properties) %></label>
|
72
72
|
</div>
|
73
|
-
<% if
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
73
|
+
<% if can?(:publish, @page) && !@page.layoutpage? %>
|
74
|
+
<div class="button_with_label">
|
75
|
+
<%= form_tag alchemy.publish_admin_page_path(@page), id: 'publish_page_form' do %>
|
76
|
+
<%= button_tag class: 'icon_button', title: _t(:explain_publishing) do %>
|
77
|
+
<%= render_icon('publish') %>
|
78
|
+
<% end %>
|
79
|
+
<label><%= _t("Publish page") %></label>
|
80
|
+
<% end %>
|
81
|
+
</div>
|
82
82
|
<% end %>
|
83
83
|
<div class="toolbar_spacer"></div>
|
84
84
|
<div class="select_with_label">
|
data/lib/alchemy/permissions.rb
CHANGED
@@ -145,6 +145,7 @@ module Alchemy
|
|
145
145
|
:destroy,
|
146
146
|
:flush,
|
147
147
|
:order,
|
148
|
+
:publish,
|
148
149
|
:sort,
|
149
150
|
:switch_language
|
150
151
|
], Alchemy::Page
|
@@ -197,7 +198,6 @@ module Alchemy
|
|
197
198
|
:fold,
|
198
199
|
:info,
|
199
200
|
:link,
|
200
|
-
:publish,
|
201
201
|
:read,
|
202
202
|
:update,
|
203
203
|
:unlock,
|
data/lib/alchemy/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# This rails template installs Alchemy and all depending gems.
|
2
|
-
require File.expand_path(
|
2
|
+
require File.expand_path("../../../alchemy/version", __FILE__)
|
3
3
|
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
|
4
|
+
gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: "3.1-stable"
|
5
|
+
gem "alchemy-devise", github: "AlchemyCMS/alchemy-devise", branch: "2.1-stable"
|
6
|
+
|
7
|
+
gem "capistrano", "~> 2.15.5", group: "development"
|
@@ -1,95 +1,135 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Page editing feature' do
|
4
|
-
let(:a_page) {
|
4
|
+
let(:a_page) { create(:page) }
|
5
5
|
|
6
|
-
|
6
|
+
context 'as author' do
|
7
|
+
before { authorize_as_admin(build(:author_user)) }
|
7
8
|
|
8
|
-
|
9
|
+
it 'cannot publish page.' do
|
10
|
+
visit alchemy.edit_admin_page_path(a_page)
|
11
|
+
expect(page).to_not have_selector('#publish_page_form')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'as editor' do
|
16
|
+
before { authorize_as_admin(build(:editor_user)) }
|
17
|
+
|
18
|
+
it 'can publish page.' do
|
19
|
+
visit alchemy.edit_admin_page_path(a_page)
|
20
|
+
find('#publish_page_form button').click
|
21
|
+
expect(page).to have_content Alchemy::I18n.t(:page_published, name: a_page.name)
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'while editing a global page' do
|
25
|
+
let(:a_page) { create(:page, layoutpage: true) }
|
9
26
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
expect(page).to have_selector('input#page_urlname')
|
14
|
-
expect(page).to have_selector('input#page_title')
|
15
|
-
expect(page).to have_selector('input#page_robot_index')
|
16
|
-
expect(page).to have_selector('input#page_robot_follow')
|
27
|
+
it 'cannot publish page.' do
|
28
|
+
visit alchemy.edit_admin_page_path(a_page)
|
29
|
+
expect(page).to_not have_selector('#publish_page_form')
|
17
30
|
end
|
31
|
+
end
|
32
|
+
end
|
18
33
|
|
19
|
-
|
20
|
-
|
21
|
-
allow(Alchemy::Config).to receive(:get) { |arg| arg == :sitemap ? {'show_flag' => true} : Alchemy::Config.show[arg.to_s] }
|
22
|
-
end
|
34
|
+
context 'as admin' do
|
35
|
+
let(:a_page) { create(:public_page, visible: true) }
|
23
36
|
|
24
|
-
|
37
|
+
before { authorize_as_admin }
|
38
|
+
|
39
|
+
context "in configure overlay" do
|
40
|
+
context "when editing a normal page" do
|
41
|
+
it "should show all relevant input fields" do
|
25
42
|
visit alchemy.configure_admin_page_path(a_page)
|
26
|
-
expect(page).to have_selector('input
|
43
|
+
expect(page).to have_selector('input#page_urlname')
|
44
|
+
expect(page).to have_selector('input#page_title')
|
45
|
+
expect(page).to have_selector('input#page_robot_index')
|
46
|
+
expect(page).to have_selector('input#page_robot_follow')
|
27
47
|
end
|
28
|
-
end
|
29
48
|
|
30
|
-
|
31
|
-
|
32
|
-
|
49
|
+
context "with sitemaps show_flag config option set to true" do
|
50
|
+
before do
|
51
|
+
allow(Alchemy::Config).to receive(:get) do |arg|
|
52
|
+
arg == :sitemap ? {'show_flag' => true} : Alchemy::Config.show[arg.to_s]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should show sitemap checkbox" do
|
57
|
+
visit alchemy.configure_admin_page_path(a_page)
|
58
|
+
expect(page).to have_selector('input[type="checkbox"]#page_sitemap')
|
59
|
+
end
|
33
60
|
end
|
34
61
|
|
35
|
-
|
36
|
-
|
37
|
-
|
62
|
+
context "with sitemaps show_flag config option set to false" do
|
63
|
+
before do
|
64
|
+
allow(Alchemy::Config).to receive(:get) do |arg|
|
65
|
+
arg == :sitemap ? {'show_flag' => false} : Alchemy::Config.show[arg.to_s]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should not show sitemap checkbox" do
|
70
|
+
visit alchemy.configure_admin_page_path(a_page)
|
71
|
+
expect(page).to_not have_selector('input[type="checkbox"]#page_sitemap')
|
72
|
+
end
|
38
73
|
end
|
39
74
|
end
|
40
|
-
end
|
41
75
|
|
42
|
-
|
43
|
-
|
76
|
+
context "when editing a global page" do
|
77
|
+
let(:layout_page) { create(:page, layoutpage: true) }
|
44
78
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
79
|
+
it "should not show the input fields for normal pages" do
|
80
|
+
visit alchemy.edit_admin_layoutpage_path(layout_page)
|
81
|
+
expect(page).to_not have_selector('input#page_urlname')
|
82
|
+
expect(page).to_not have_selector('input#page_title')
|
83
|
+
expect(page).to_not have_selector('input#page_robot_index')
|
84
|
+
expect(page).to_not have_selector('input#page_robot_follow')
|
85
|
+
end
|
51
86
|
end
|
52
|
-
end
|
53
87
|
|
54
|
-
|
55
|
-
|
88
|
+
context "when page is taggable" do
|
89
|
+
before do
|
90
|
+
expect_any_instance_of(Alchemy::Page)
|
91
|
+
.to receive(:taggable?).and_return(true)
|
92
|
+
end
|
56
93
|
|
57
|
-
|
58
|
-
|
59
|
-
|
94
|
+
it "should show the tag_list input field" do
|
95
|
+
visit alchemy.configure_admin_page_path(a_page)
|
96
|
+
expect(page).to have_selector('input#page_tag_list')
|
97
|
+
end
|
60
98
|
end
|
61
99
|
end
|
62
|
-
end
|
63
100
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
101
|
+
context "in preview frame" do
|
102
|
+
it "the menubar does not render on the page" do
|
103
|
+
visit alchemy.admin_page_path(a_page)
|
104
|
+
expect(page).not_to have_selector('#alchemy_menubar')
|
105
|
+
end
|
69
106
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
107
|
+
it "navigation links are not clickable" do
|
108
|
+
visit alchemy.admin_page_path(a_page)
|
109
|
+
within('#navigation') do
|
110
|
+
expect(page).to have_selector('a[href="javascript: void(0)"]')
|
111
|
+
end
|
74
112
|
end
|
75
113
|
end
|
76
|
-
end
|
77
114
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
115
|
+
context 'in element panel' do
|
116
|
+
let!(:everything_page) do
|
117
|
+
create(:page, page_layout: 'everything', do_not_autogenerate: false)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "renders essence editors for all elements" do
|
121
|
+
visit alchemy.admin_elements_path(page_id: everything_page.id)
|
122
|
+
|
123
|
+
expect(page).to have_selector('div.content_editor.essence_boolean')
|
124
|
+
expect(page).to have_selector('div.content_editor.essence_date')
|
125
|
+
expect(page).to have_selector('div.content_editor.essence_file')
|
126
|
+
expect(page).to have_selector('div.content_editor.essence_html_editor')
|
127
|
+
expect(page).to have_selector('div.content_editor.essence_link')
|
128
|
+
expect(page).to have_selector('div.content_editor.essence_picture_editor')
|
129
|
+
expect(page).to have_selector('div.content_editor.essence_richtext')
|
130
|
+
expect(page).to have_selector('div.content_editor.essence_select')
|
131
|
+
expect(page).to have_selector('div.content_editor.essence_text')
|
132
|
+
end
|
93
133
|
end
|
94
134
|
end
|
95
135
|
end
|
@@ -150,7 +150,10 @@ describe Alchemy::Permissions do
|
|
150
150
|
is_expected.to be_able_to(:link, Alchemy::Page)
|
151
151
|
is_expected.to be_able_to(:visit, Alchemy::Page)
|
152
152
|
is_expected.to be_able_to(:unlock, Alchemy::Page)
|
153
|
-
|
153
|
+
end
|
154
|
+
|
155
|
+
it "can not publish pages" do
|
156
|
+
is_expected.to_not be_able_to(:publish, Alchemy::Page)
|
154
157
|
end
|
155
158
|
|
156
159
|
it "can manage elements" do
|
@@ -208,6 +211,10 @@ describe Alchemy::Permissions do
|
|
208
211
|
is_expected.to be_able_to(:switch_language, Alchemy::Page)
|
209
212
|
end
|
210
213
|
|
214
|
+
it "can publish pages" do
|
215
|
+
is_expected.to be_able_to(:publish, Alchemy::Page)
|
216
|
+
end
|
217
|
+
|
211
218
|
it "can not see invisible pages" do
|
212
219
|
is_expected.not_to be_able_to(:see, not_visible_page)
|
213
220
|
end
|
data/spec/models/element_spec.rb
CHANGED
@@ -580,6 +580,29 @@ module Alchemy
|
|
580
580
|
end
|
581
581
|
end
|
582
582
|
|
583
|
+
describe '#cache_key' do
|
584
|
+
let(:page) { stub_model(Page, published_at: Time.now - 1.week) }
|
585
|
+
let(:element) { stub_model(Element, page: page, updated_at: Time.now) }
|
586
|
+
|
587
|
+
subject { element.cache_key }
|
588
|
+
|
589
|
+
before do
|
590
|
+
expect(Page).to receive(:current_preview).and_return(preview)
|
591
|
+
end
|
592
|
+
|
593
|
+
context "when current page rendered in preview mode" do
|
594
|
+
let(:preview) { page }
|
595
|
+
|
596
|
+
it { is_expected.to eq("alchemy/elements/#{element.id}-#{element.updated_at}") }
|
597
|
+
end
|
598
|
+
|
599
|
+
context "when current page not in preview mode" do
|
600
|
+
let(:preview) { nil }
|
601
|
+
|
602
|
+
it { is_expected.to eq("alchemy/elements/#{element.id}-#{page.published_at}") }
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
583
606
|
it_behaves_like "having a hint" do
|
584
607
|
let(:subject) { Element.new }
|
585
608
|
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -734,12 +734,26 @@ module Alchemy
|
|
734
734
|
end
|
735
735
|
|
736
736
|
describe '#cache_key' do
|
737
|
-
let(:page)
|
738
|
-
|
737
|
+
let(:page) do
|
738
|
+
stub_model(Page, updated_at: Time.now, published_at: Time.now - 1.week)
|
739
|
+
end
|
740
|
+
|
741
|
+
subject { page.cache_key }
|
742
|
+
|
743
|
+
before do
|
744
|
+
expect(Page).to receive(:current_preview).and_return(preview)
|
745
|
+
end
|
746
|
+
|
747
|
+
context "when current page rendered in preview mode" do
|
748
|
+
let(:preview) { page }
|
749
|
+
|
750
|
+
it { is_expected.to eq("alchemy/pages/#{page.id}-#{page.updated_at}") }
|
751
|
+
end
|
752
|
+
|
753
|
+
context "when current page not in preview mode" do
|
754
|
+
let(:preview) { nil }
|
739
755
|
|
740
|
-
|
741
|
-
subject { super().cache_key }
|
742
|
-
it { is_expected.to match(page.id.to_s) }
|
756
|
+
it { is_expected.to eq("alchemy/pages/#{page.id}-#{page.published_at}") }
|
743
757
|
end
|
744
758
|
end
|
745
759
|
|
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: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: actionpack-page_caching
|