alchemy_cms 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/alchemy_cms.gemspec +1 -0
- data/app/models/alchemy/language.rb +2 -2
- data/app/models/alchemy/page.rb +7 -2
- data/app/models/alchemy/site.rb +2 -2
- data/bin/alchemy +1 -1
- data/lib/alchemy/engine.rb +2 -1
- data/lib/alchemy/version.rb +1 -1
- data/spec/models/page_spec.rb +20 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bab31bb3ea923d47cdd096c29f4e389df529859
|
4
|
+
data.tar.gz: 72aba254bc066b4eb4f54dc1e8c40abdfca35278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 590ccca504b3fb42b370d11d2316fd2b748a71659d9294e13bf889fa6c47c260fd77fc0d613deac628c1d1cdc49e00af80aa7bdf9c95a496deba311b4582a10b
|
7
|
+
data.tar.gz: 6a220a27a0d560964e0be33eb649675187d3bc06c008779ef16cb2dac013698393abd6a174283a78992808243117ce23c087d9793a8a2400062a486e6bb3bd97
|
data/alchemy_cms.gemspec
CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |gem|
|
|
42
42
|
gem.add_runtime_dependency 'turbolinks', '~> 2.0'
|
43
43
|
gem.add_runtime_dependency 'non-stupid-digest-assets', '~> 1.0.3'
|
44
44
|
gem.add_runtime_dependency 'active_model_serializers', '>= 0.8.1', '< 0.10.0'
|
45
|
+
gem.add_runtime_dependency 'request_store', '~> 1.1.0'
|
45
46
|
|
46
47
|
gem.add_development_dependency 'rspec-rails', '~> 2.0'
|
47
48
|
gem.add_development_dependency 'capybara'
|
@@ -45,12 +45,12 @@ module Alchemy
|
|
45
45
|
|
46
46
|
# Store the current language in the current thread.
|
47
47
|
def current=(v)
|
48
|
-
|
48
|
+
RequestStore.store[:alchemy_current_language] = v
|
49
49
|
end
|
50
50
|
|
51
51
|
# Current language from current thread or default.
|
52
52
|
def current
|
53
|
-
|
53
|
+
RequestStore.store[:alchemy_current_language] || default
|
54
54
|
end
|
55
55
|
|
56
56
|
# The root page of the current language.
|
data/app/models/alchemy/page.rb
CHANGED
@@ -84,6 +84,7 @@ module Alchemy
|
|
84
84
|
before_save :set_language_code, if: -> { language.present? }, unless: :systempage?
|
85
85
|
before_save :set_restrictions_to_child_pages, if: :restricted_changed?, unless: :systempage?
|
86
86
|
before_save :inherit_restricted_status, if: -> { parent && parent.restricted? }, unless: :systempage?
|
87
|
+
before_save :update_published_at, if: -> { public && read_attribute(:published_at).nil? }, unless: :systempage?
|
87
88
|
before_create :set_language_from_parent_or_default, if: -> { language_id.blank? }, unless: :systempage?
|
88
89
|
after_update :create_legacy_url, if: :urlname_changed?, unless: :redirects_to_external?
|
89
90
|
|
@@ -104,13 +105,13 @@ module Alchemy
|
|
104
105
|
# Used to store the current page previewed in the edit page template.
|
105
106
|
#
|
106
107
|
def current_preview=(page)
|
107
|
-
|
108
|
+
RequestStore.store[:alchemy_current_preview] = page
|
108
109
|
end
|
109
110
|
|
110
111
|
# Returns the current page previewed in the edit page template.
|
111
112
|
#
|
112
113
|
def current_preview
|
113
|
-
|
114
|
+
RequestStore.store[:alchemy_current_preview]
|
114
115
|
end
|
115
116
|
|
116
117
|
# @return the language root page for given language id.
|
@@ -392,5 +393,9 @@ module Alchemy
|
|
392
393
|
legacy_urls.find_or_create_by(urlname: urlname_was)
|
393
394
|
end
|
394
395
|
|
396
|
+
def update_published_at
|
397
|
+
self.published_at = Time.now
|
398
|
+
end
|
399
|
+
|
395
400
|
end
|
396
401
|
end
|
data/app/models/alchemy/site.rb
CHANGED
@@ -43,11 +43,11 @@ module Alchemy
|
|
43
43
|
|
44
44
|
class << self
|
45
45
|
def current=(v)
|
46
|
-
|
46
|
+
RequestStore.store[:alchemy_current_site] = v
|
47
47
|
end
|
48
48
|
|
49
49
|
def current
|
50
|
-
|
50
|
+
RequestStore.store[:alchemy_current_site] || default
|
51
51
|
end
|
52
52
|
|
53
53
|
def default
|
data/bin/alchemy
CHANGED
data/lib/alchemy/engine.rb
CHANGED
@@ -12,6 +12,7 @@ require 'jquery-rails'
|
|
12
12
|
require 'jquery-ui-rails'
|
13
13
|
require 'kaminari'
|
14
14
|
require 'non-stupid-digest-assets'
|
15
|
+
require 'request_store'
|
15
16
|
require 'sass-rails'
|
16
17
|
require 'sassy-buttons'
|
17
18
|
require 'simple_form'
|
@@ -79,7 +80,7 @@ module Alchemy
|
|
79
80
|
end
|
80
81
|
|
81
82
|
initializer 'alchemy.non_digest_assets' do |app|
|
82
|
-
NonStupidDigestAssets.whitelist
|
83
|
+
NonStupidDigestAssets.whitelist += [/^tinymce\//]
|
83
84
|
end
|
84
85
|
|
85
86
|
config.after_initialize do
|
data/lib/alchemy/version.rb
CHANGED
data/spec/models/page_spec.rb
CHANGED
@@ -180,6 +180,26 @@ module Alchemy
|
|
180
180
|
page.legacy_urls.should be_empty
|
181
181
|
end
|
182
182
|
end
|
183
|
+
|
184
|
+
context "public has changed" do
|
185
|
+
it "should update published_at" do
|
186
|
+
page.update_attributes!(public: true)
|
187
|
+
page.read_attribute(:published_at).should be_within(1.second).of(Time.now)
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should not update already set published_at" do
|
191
|
+
page.update_attributes!(published_at: 2.weeks.ago)
|
192
|
+
page.update_attributes!(public: true)
|
193
|
+
page.read_attribute(:published_at).should be_within(1.second).of(2.weeks.ago)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context "public has not changed" do
|
198
|
+
it "should not update published_at" do
|
199
|
+
page.update_attributes!(name: 'New Name')
|
200
|
+
page.read_attribute(:published_at).should be_nil
|
201
|
+
end
|
202
|
+
end
|
183
203
|
end
|
184
204
|
|
185
205
|
context 'after_move' do
|
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.0.
|
4
|
+
version: 3.0.2
|
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: 2014-09-
|
15
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -348,6 +348,20 @@ dependencies:
|
|
348
348
|
- - "<"
|
349
349
|
- !ruby/object:Gem::Version
|
350
350
|
version: 0.10.0
|
351
|
+
- !ruby/object:Gem::Dependency
|
352
|
+
name: request_store
|
353
|
+
requirement: !ruby/object:Gem::Requirement
|
354
|
+
requirements:
|
355
|
+
- - "~>"
|
356
|
+
- !ruby/object:Gem::Version
|
357
|
+
version: 1.1.0
|
358
|
+
type: :runtime
|
359
|
+
prerelease: false
|
360
|
+
version_requirements: !ruby/object:Gem::Requirement
|
361
|
+
requirements:
|
362
|
+
- - "~>"
|
363
|
+
- !ruby/object:Gem::Version
|
364
|
+
version: 1.1.0
|
351
365
|
- !ruby/object:Gem::Dependency
|
352
366
|
name: rspec-rails
|
353
367
|
requirement: !ruby/object:Gem::Requirement
|