radiant-concurrent_draft-extension 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +32 -21
- data/VERSION +1 -1
- data/app/views/admin/_draft_controls.html.haml +2 -2
- data/app/views/admin/page_parts/_page_part.html.haml +0 -0
- data/concurrent_draft_extension.rb +4 -4
- data/lib/concurrent_draft/helper_extensions.rb +14 -14
- data/pkg/radiant-concurrent_draft-extension-1.0.1.gem +0 -0
- data/public/images/admin/page_delete.png +0 -0
- data/radiant-concurrent_draft-extension.gemspec +5 -11
- metadata +6 -12
- data/pkg/radiant-concurrent_draft-extension-1.0.0.gem +0 -0
- data/test/helpers/caching_test_helper.rb +0 -42
- data/test/helpers/page_part_test_helper.rb +0 -49
- data/test/helpers/page_test_helper.rb +0 -77
data/README.textile
CHANGED
@@ -1,50 +1,61 @@
|
|
1
|
-
|
1
|
+
h1. Concurrent Draft
|
2
2
|
|
3
3
|
The *ConcurrentDraft* extension enables draft versions of pages, snippets and layouts, which can be scheduled for promotion to Production. Every such artifact (page, snippet or layout) can have a concurrent draft version, which will be displayed in development mode, and a promoted live version, which will be displayed in production mode.
|
4
4
|
|
5
5
|
Created by: Andrew vonderLuft and Sean Cribbs, August 2008, in Portland Oregon
|
6
6
|
|
7
|
-
|
7
|
+
h2. Version History
|
8
8
|
|
9
|
-
* 1.0.
|
9
|
+
* 1.0.x - Compatible with Blade UI - 0.9 and above
|
10
10
|
* 0.8.0 - Compatible with Radiant 0.8.0 and above
|
11
11
|
* 0.7.1 - Compatible with Radiant 0.7.1
|
12
12
|
|
13
|
-
|
13
|
+
h2. Requirements
|
14
14
|
|
15
|
-
* Radiant 0.
|
15
|
+
* Radiant 0.9 or greater
|
16
|
+
* Radiant 0.7.x - 0.8.x use appropriate tag
|
16
17
|
|
17
|
-
|
18
|
+
h2. Installation
|
18
19
|
|
19
|
-
|
20
|
+
h3. From the Radiant Extension Registry
|
20
21
|
|
21
|
-
|
22
|
+
# From your RAILS_ROOT run:
|
23
|
+
<pre>script/extension install concurrent_draft</pre>
|
24
|
+
# Restart your app
|
25
|
+
NOTE: In some earlier versions of Radiant, the migrations may not run, and the assets may not be copied and you may therefore need to run:
|
26
|
+
<pre>rake radiant:extensions:concurrent_draft:migrate
|
27
|
+
rake radiant:extensions:concurrent_draft:update</pre>
|
22
28
|
|
23
|
-
|
29
|
+
h3. From Github
|
30
|
+
|
31
|
+
# From your RAILS_ROOT run:
|
32
|
+
<pre>cd vendor/extensions
|
33
|
+
git clone git://github.com/avonderluft/radiant-concurrent_draft-extension.git ./concurrent_draft
|
34
|
+
cd ../../
|
24
35
|
rake radiant:extensions:concurrent_draft:migrate
|
25
|
-
rake radiant:extensions:concurrent_draft:update
|
36
|
+
rake radiant:extensions:concurrent_draft:update
|
26
37
|
</pre>
|
38
|
+
# Restart your app
|
27
39
|
|
28
|
-
|
29
|
-
|
30
|
-
h4. Using the gem
|
31
|
-
|
32
|
-
* Install the gem
|
40
|
+
h3. Using the gem
|
33
41
|
|
42
|
+
# Install the gem
|
34
43
|
<pre>gem install radiant-concurrent_draft-extension</pre>
|
35
|
-
|
36
|
-
* Update your Radiant config: add to environment.rb with other gem.configs
|
37
|
-
|
44
|
+
# Update your Radiant config: add to environment.rb with other gem.configs
|
38
45
|
<pre>config.gem 'radiant-concurrent_draft-extension', :lib => false</pre>
|
46
|
+
# Run database migrations
|
47
|
+
<pre>rake db:migrate:extensions</pre>
|
48
|
+
# Copy assets
|
49
|
+
<pre>rake radiant:extensions:update_all</pre>
|
50
|
+
# Restart your app
|
39
51
|
|
40
|
-
|
41
|
-
h3. Caveats
|
52
|
+
h2. Caveats
|
42
53
|
|
43
54
|
Scheduled times are dependent on the ActiveRecord time setting. If you want to use local time, add this to your environment.rb:
|
44
55
|
|
45
56
|
<pre>config.active_record.default_timezone = :local</pre>
|
46
57
|
|
47
|
-
|
58
|
+
h2. Acknowledgments
|
48
59
|
|
49
60
|
* Andrew conceived of the ideas for this extension and its initial design, and did model changes, migrations, and initial code for pages.
|
50
61
|
* Sean collaborated on its expansion and refactoring to include snippets and layouts, and produced most of the final code, including all of the UI.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
@@ -33,7 +33,7 @@
|
|
33
33
|
- content_for :popups do
|
34
34
|
- if @controller.authorized_user?
|
35
35
|
.popup#schedule-draft-popup{:style => 'display:none'}
|
36
|
-
|
36
|
+
.popup_title
|
37
37
|
= image('clock')
|
38
38
|
= t('schedule_promotion')
|
39
39
|
- form_for @controller.model, :url => {:action => 'schedule_draft_promotion'}, :html => {:method => :post, 'data-onsubmit_status' => "Scheduling promotion of #{resource}"} do |f|
|
@@ -61,7 +61,7 @@
|
|
61
61
|
width: 300px
|
62
62
|
background: #7E7E7E
|
63
63
|
table.index
|
64
|
-
margin: 0
|
64
|
+
margin: -2px 0 0 0
|
65
65
|
border: none
|
66
66
|
tr, td.label, td.actions
|
67
67
|
border: none
|
File without changes
|
@@ -4,7 +4,7 @@ require_dependency 'application_controller'
|
|
4
4
|
class ConcurrentDraftExtension < Radiant::Extension
|
5
5
|
version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
|
6
6
|
description "Enables default draft versions of pages, snippets and layouts, which can be scheduled for promotion to Production"
|
7
|
-
url "https://github.com/avonderluft/radiant-concurrent_draft-extension
|
7
|
+
url "https://github.com/avonderluft/radiant-concurrent_draft-extension"
|
8
8
|
|
9
9
|
def activate
|
10
10
|
[Page, Snippet, Layout, PagePart].each do |klass|
|
@@ -21,10 +21,10 @@ class ConcurrentDraftExtension < Radiant::Extension
|
|
21
21
|
SiteController.send :include, ConcurrentDraft::SiteControllerExtensions
|
22
22
|
%w{page snippet layout}.each do |view|
|
23
23
|
admin.send(view).edit.add :main, "admin/draft_controls", :before => "edit_header"
|
24
|
-
admin.send(view).edit.form_bottom.delete 'edit_buttons'
|
25
|
-
admin.send(view).edit.add :form_bottom, 'admin/edit_buttons'
|
24
|
+
# admin.send(view).edit.form_bottom.delete 'edit_buttons'
|
25
|
+
# admin.send(view).edit.add :form_bottom, 'admin/edit_buttons'
|
26
26
|
end
|
27
|
-
admin.page.edit.add :extended_metadata, 'published_meta'
|
27
|
+
# admin.page.edit.add :extended_metadata, 'published_meta'
|
28
28
|
Time::DATE_FORMATS[:long_civilian] = lambda {|time| time.strftime("%B %d, %Y %I:%M%p").gsub(/(\s+)0(\d+)/, '\1\2') }
|
29
29
|
end
|
30
30
|
end
|
@@ -22,18 +22,18 @@ module ConcurrentDraft::HelperExtensions
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def save_model_button(_model)
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def save_model_and_continue_editing_button(_model)
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def save_model_and_promote_button(_model)
|
36
|
-
|
37
|
-
|
38
|
-
end
|
25
|
+
# def save_model_button(_model)
|
26
|
+
# label = _model.new_record? ? "Create" : "Save"
|
27
|
+
# submit_tag "#{label} and Exit", :class => 'button'
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# def save_model_and_continue_editing_button(_model)
|
31
|
+
# label = _model.new_record? ? "Create" : "Save"
|
32
|
+
# submit_tag label, :name => 'continue', :class => 'button'
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def save_model_and_promote_button(_model)
|
36
|
+
# label = _model.new_record? ? "Create" : "Save"
|
37
|
+
# submit_tag "#{label} and Promote Now", :name => 'promote', :class => 'button'
|
38
|
+
# end
|
39
39
|
end
|
Binary file
|
File without changes
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-concurrent_draft-extension}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew vonderLuft", "Sean Cribbs"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-04}
|
13
13
|
s.description = %q{Enables draft versions of pages, snippets and layouts, which can be scheduled for promotion.}
|
14
14
|
s.email = %q{avonderluft@avlux.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"lib/concurrent_draft/site_controller_extensions.rb",
|
43
43
|
"lib/concurrent_draft/tags.rb",
|
44
44
|
"lib/tasks/concurrent_draft_extension_tasks.rake",
|
45
|
-
"pkg/radiant-concurrent_draft-extension-1.0.
|
45
|
+
"pkg/radiant-concurrent_draft-extension-1.0.1.gem",
|
46
46
|
"public/images/admin/cancel.png",
|
47
47
|
"public/images/admin/clock.png",
|
48
48
|
"public/images/admin/page_delete.png",
|
@@ -60,9 +60,6 @@ Gem::Specification.new do |s|
|
|
60
60
|
"spec/models/tags_spec.rb",
|
61
61
|
"spec/spec.opts",
|
62
62
|
"spec/spec_helper.rb",
|
63
|
-
"test/helpers/caching_test_helper.rb",
|
64
|
-
"test/helpers/page_part_test_helper.rb",
|
65
|
-
"test/helpers/page_test_helper.rb",
|
66
63
|
"vendor/plugins/12_hour_time/CHANGELOG",
|
67
64
|
"vendor/plugins/12_hour_time/README",
|
68
65
|
"vendor/plugins/12_hour_time/Rakefile",
|
@@ -73,7 +70,7 @@ Gem::Specification.new do |s|
|
|
73
70
|
]
|
74
71
|
s.homepage = %q{https://github.com/avonderluft/radiant-concurrent_draft-extension}
|
75
72
|
s.require_paths = ["lib"]
|
76
|
-
s.rubygems_version = %q{1.
|
73
|
+
s.rubygems_version = %q{1.6.2}
|
77
74
|
s.summary = %q{Concurrent Draft Extension for Radiant CMS}
|
78
75
|
s.test_files = [
|
79
76
|
"spec/controllers/admin_controller_extensions_spec.rb",
|
@@ -82,10 +79,7 @@ Gem::Specification.new do |s|
|
|
82
79
|
"spec/models/model_extensions_spec.rb",
|
83
80
|
"spec/models/page_extensions_spec.rb",
|
84
81
|
"spec/models/tags_spec.rb",
|
85
|
-
"spec/spec_helper.rb"
|
86
|
-
"test/helpers/caching_test_helper.rb",
|
87
|
-
"test/helpers/page_part_test_helper.rb",
|
88
|
-
"test/helpers/page_test_helper.rb"
|
82
|
+
"spec/spec_helper.rb"
|
89
83
|
]
|
90
84
|
|
91
85
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-concurrent_draft-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew vonderLuft
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-04-04 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,7 @@ files:
|
|
70
70
|
- lib/concurrent_draft/site_controller_extensions.rb
|
71
71
|
- lib/concurrent_draft/tags.rb
|
72
72
|
- lib/tasks/concurrent_draft_extension_tasks.rake
|
73
|
-
- pkg/radiant-concurrent_draft-extension-1.0.
|
73
|
+
- pkg/radiant-concurrent_draft-extension-1.0.1.gem
|
74
74
|
- public/images/admin/cancel.png
|
75
75
|
- public/images/admin/clock.png
|
76
76
|
- public/images/admin/page_delete.png
|
@@ -88,9 +88,6 @@ files:
|
|
88
88
|
- spec/models/tags_spec.rb
|
89
89
|
- spec/spec.opts
|
90
90
|
- spec/spec_helper.rb
|
91
|
-
- test/helpers/caching_test_helper.rb
|
92
|
-
- test/helpers/page_part_test_helper.rb
|
93
|
-
- test/helpers/page_test_helper.rb
|
94
91
|
- vendor/plugins/12_hour_time/CHANGELOG
|
95
92
|
- vendor/plugins/12_hour_time/README
|
96
93
|
- vendor/plugins/12_hour_time/Rakefile
|
@@ -128,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
125
|
requirements: []
|
129
126
|
|
130
127
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.6.2
|
132
129
|
signing_key:
|
133
130
|
specification_version: 3
|
134
131
|
summary: Concurrent Draft Extension for Radiant CMS
|
@@ -140,6 +137,3 @@ test_files:
|
|
140
137
|
- spec/models/page_extensions_spec.rb
|
141
138
|
- spec/models/tags_spec.rb
|
142
139
|
- spec/spec_helper.rb
|
143
|
-
- test/helpers/caching_test_helper.rb
|
144
|
-
- test/helpers/page_part_test_helper.rb
|
145
|
-
- test/helpers/page_test_helper.rb
|
Binary file
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class FakeResponseCache
|
2
|
-
attr_accessor :expired_path, :expired_paths
|
3
|
-
|
4
|
-
def initialize
|
5
|
-
@expired_paths = []
|
6
|
-
@cached_responses = {}
|
7
|
-
end
|
8
|
-
|
9
|
-
def clear
|
10
|
-
@cached_responses.clear
|
11
|
-
@cleared = true
|
12
|
-
end
|
13
|
-
|
14
|
-
def cache_response(path, response)
|
15
|
-
@cached_responses[path] = response
|
16
|
-
response
|
17
|
-
end
|
18
|
-
|
19
|
-
def update_response(path, response)
|
20
|
-
if r = @cached_response[path]
|
21
|
-
response.headers.merge!(r.headers)
|
22
|
-
response.body = r.body
|
23
|
-
end
|
24
|
-
response
|
25
|
-
end
|
26
|
-
|
27
|
-
def expire_response(path)
|
28
|
-
@expired_paths << path
|
29
|
-
@expired_path = path
|
30
|
-
end
|
31
|
-
|
32
|
-
def response_cached?(path)
|
33
|
-
@cached_responses.keys.include?(path)
|
34
|
-
end
|
35
|
-
|
36
|
-
def cleared?
|
37
|
-
!!@cleared
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
module CachingTestHelper
|
42
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module PagePartTestHelper
|
2
|
-
VALID_PAGE_PART_PARAMS = {
|
3
|
-
:name => 'custom',
|
4
|
-
:content => 'Some simple content.',
|
5
|
-
:page_id => '1'
|
6
|
-
}
|
7
|
-
|
8
|
-
def part_params(options = {})
|
9
|
-
params = VALID_PAGE_PART_PARAMS.dup
|
10
|
-
params.delete(:page_id)
|
11
|
-
params.merge!(:name => @part_name) if @part_name
|
12
|
-
params.merge!(options)
|
13
|
-
params
|
14
|
-
end
|
15
|
-
|
16
|
-
def destroy_test_part(title = @part_name)
|
17
|
-
while part = get_test_part(title) do
|
18
|
-
part.destroy
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def get_test_part(name = @part_name)
|
23
|
-
PagePart.find_by_name(name)
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_test_part(name = @part_name)
|
27
|
-
params = part_params
|
28
|
-
params.merge!(:name => name)
|
29
|
-
part = PagePart.new(params)
|
30
|
-
if part.save
|
31
|
-
part
|
32
|
-
else
|
33
|
-
raise "part <#{part.inspect}> could not be saved"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# must be included after PageTestHelper to work
|
38
|
-
def create_test_page(options = {})
|
39
|
-
no_part = options.delete(:no_part)
|
40
|
-
page = super(options)
|
41
|
-
unless no_part
|
42
|
-
part = PagePart.new part_params(:name => 'body', :content => 'test')
|
43
|
-
page.parts << part
|
44
|
-
page.save
|
45
|
-
part.save
|
46
|
-
end
|
47
|
-
page
|
48
|
-
end
|
49
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
class NoCachePage < Page
|
2
|
-
description 'Turns caching off for testing.'
|
3
|
-
|
4
|
-
def cache?
|
5
|
-
false
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class CustomFileNotFoundPage < FileNotFoundPage
|
10
|
-
end
|
11
|
-
|
12
|
-
class TestPage < Page
|
13
|
-
description 'this is just a test page'
|
14
|
-
|
15
|
-
tag 'test1' do
|
16
|
-
'Hello world!'
|
17
|
-
end
|
18
|
-
|
19
|
-
tag 'test2' do
|
20
|
-
'Another test.'
|
21
|
-
end
|
22
|
-
|
23
|
-
def headers
|
24
|
-
{
|
25
|
-
'cool' => 'beans',
|
26
|
-
'request' => @request.inspect[20..30],
|
27
|
-
'response' => @response.inspect[20..31]
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
class VirtualPage < Page
|
34
|
-
def virtual?
|
35
|
-
true
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module PageTestHelper
|
40
|
-
|
41
|
-
VALID_PAGE_PARAMS = {
|
42
|
-
:title => 'New Page',
|
43
|
-
:slug => 'page',
|
44
|
-
:breadcrumb => 'New Page',
|
45
|
-
:status_id => '1',
|
46
|
-
:parent_id => nil
|
47
|
-
}
|
48
|
-
|
49
|
-
def page_params(options = {})
|
50
|
-
params = VALID_PAGE_PARAMS.dup
|
51
|
-
params.merge!(:title => @page_title) if @page_title
|
52
|
-
params.merge!(:status_id => '5')
|
53
|
-
params.merge!(options)
|
54
|
-
end
|
55
|
-
|
56
|
-
def destroy_test_page(title = @page_title)
|
57
|
-
while page = get_test_page(title) do
|
58
|
-
page.destroy
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def get_test_page(title = @page_title)
|
63
|
-
Page.find_by_title(title)
|
64
|
-
end
|
65
|
-
|
66
|
-
def create_test_page(options = {})
|
67
|
-
options[:title] ||= @page_title
|
68
|
-
klass = options.delete(:class_name) || Page
|
69
|
-
klass = Kernel.eval(klass) if klass.kind_of? String
|
70
|
-
page = klass.new page_params(options)
|
71
|
-
if page.save
|
72
|
-
page
|
73
|
-
else
|
74
|
-
raise "page <#{page.inspect}> could not be saved"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|