comfortable_mexican_sofa 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/cms_admin/layouts_controller.rb +13 -13
- data/app/controllers/cms_admin/pages_controller.rb +17 -17
- data/app/controllers/cms_admin/sites_controller.rb +14 -14
- data/app/controllers/cms_admin/snippets_controller.rb +12 -12
- data/app/views/cms_admin/layouts/_form.html.erb +5 -0
- data/app/views/cms_admin/layouts/edit.html.erb +0 -1
- data/app/views/cms_admin/layouts/new.html.erb +0 -1
- data/app/views/cms_admin/pages/_form.html.erb +3 -2
- data/app/views/cms_admin/sites/_form.html.erb +6 -1
- data/app/views/cms_admin/sites/edit.html.erb +0 -1
- data/app/views/cms_admin/sites/new.html.erb +0 -1
- data/app/views/cms_admin/snippets/_form.html.erb +6 -1
- data/app/views/cms_admin/snippets/edit.html.erb +0 -1
- data/app/views/cms_admin/snippets/new.html.erb +0 -1
- data/comfortable_mexican_sofa.gemspec +4 -2
- data/config/initializers/comfortable_mexican_sofa.rb +5 -0
- data/config/routes.rb +4 -3
- data/lib/comfortable_mexican_sofa.rb +7 -3
- data/lib/comfortable_mexican_sofa/configuration.rb +5 -0
- data/lib/comfortable_mexican_sofa/fixtures.rb +4 -2
- data/lib/comfortable_mexican_sofa/view_methods.rb +2 -2
- data/public/stylesheets/comfortable_mexican_sofa/form.css +5 -0
- data/test/functional/cms_admin/layouts_controller_test.rb +37 -8
- data/test/functional/cms_admin/pages_controller_test.rb +74 -37
- data/test/functional/cms_admin/sites_controller_test.rb +37 -11
- data/test/functional/cms_admin/snippets_controller_test.rb +40 -11
- data/test/integration/render_cms_test.rb +0 -4
- data/test/integration/routing_extensions_test.rb +34 -0
- data/test/test_helper.rb +1 -0
- data/test/unit/configuration_test.rb +1 -0
- data/test/unit/fixtures_test.rb +16 -0
- data/test/unit/view_methods_test.rb +12 -0
- metadata +5 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
@@ -1,58 +1,58 @@
|
|
1
1
|
class CmsAdmin::LayoutsController < CmsAdmin::BaseController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :build_cms_layout, :only => [:new, :create]
|
4
4
|
before_filter :load_cms_layout, :only => [:edit, :update, :destroy]
|
5
|
-
|
5
|
+
|
6
6
|
def index
|
7
7
|
return redirect_to :action => :new if @cms_site.layouts.count == 0
|
8
8
|
@cms_layouts = @cms_site.layouts.roots
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
render
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def edit
|
16
16
|
render
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def create
|
20
20
|
@cms_layout.save!
|
21
21
|
flash[:notice] = 'Layout created'
|
22
|
-
redirect_to :action => :edit, :id => @cms_layout
|
22
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_layout})
|
23
23
|
rescue ActiveRecord::RecordInvalid
|
24
24
|
flash.now[:error] = 'Failed to create layout'
|
25
25
|
render :action => :new
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def update
|
29
29
|
@cms_layout.update_attributes!(params[:cms_layout])
|
30
30
|
flash[:notice] = 'Layout updated'
|
31
|
-
redirect_to :action => :edit, :id => @cms_layout
|
31
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_layout})
|
32
32
|
rescue ActiveRecord::RecordInvalid
|
33
33
|
flash.now[:error] = 'Failed to update layout'
|
34
34
|
render :action => :edit
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def destroy
|
38
38
|
@cms_layout.destroy
|
39
39
|
flash[:notice] = 'Layout deleted'
|
40
40
|
redirect_to :action => :index
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
protected
|
44
|
-
|
44
|
+
|
45
45
|
def build_cms_layout
|
46
46
|
@cms_layout = @cms_site.layouts.new(params[:cms_layout])
|
47
47
|
@cms_layout.parent ||= Cms::Layout.find_by_id(params[:parent_id])
|
48
48
|
@cms_layout.content ||= '{{ cms:page:content:text }}'
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def load_cms_layout
|
52
52
|
@cms_layout = @cms_site.layouts.find(params[:id])
|
53
53
|
rescue ActiveRecord::RecordNotFound
|
54
54
|
flash[:error] = 'Layout not found'
|
55
55
|
redirect_to :action => :index
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
end
|
@@ -1,53 +1,53 @@
|
|
1
1
|
class CmsAdmin::PagesController < CmsAdmin::BaseController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :check_for_layouts, :only => [:new, :edit]
|
4
4
|
before_filter :build_cms_page, :only => [:new, :create]
|
5
5
|
before_filter :load_cms_page, :only => [:edit, :update, :destroy]
|
6
6
|
before_filter :preview_cms_page, :only => [:create, :update]
|
7
7
|
before_filter :build_upload_file, :only => [:new, :edit]
|
8
|
-
|
8
|
+
|
9
9
|
def index
|
10
10
|
return redirect_to :action => :new if @cms_site.pages.count == 0
|
11
11
|
@cms_pages = [@cms_site.pages.root].compact
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def new
|
15
15
|
render
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def edit
|
19
19
|
render
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def create
|
23
23
|
@cms_page.save!
|
24
24
|
flash[:notice] = 'Page saved'
|
25
|
-
redirect_to :action => :edit, :id => @cms_page
|
25
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_page})
|
26
26
|
rescue ActiveRecord::RecordInvalid
|
27
27
|
flash.now[:error] = 'Failed to create page'
|
28
28
|
render :action => :new
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def update
|
32
32
|
@cms_page.save!
|
33
33
|
flash[:notice] = 'Page updated'
|
34
|
-
redirect_to :action => :edit, :id => @cms_page
|
34
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_page})
|
35
35
|
rescue ActiveRecord::RecordInvalid
|
36
36
|
flash.now[:error] = 'Failed to update page'
|
37
37
|
render :action => :edit
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def destroy
|
41
41
|
@cms_page.destroy
|
42
42
|
flash[:notice] = 'Page deleted'
|
43
43
|
redirect_to :action => :index
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def form_blocks
|
47
47
|
@cms_page = @cms_site.pages.find_by_id(params[:id]) || @cms_site.pages.new
|
48
48
|
@cms_page.layout = @cms_site.layouts.find_by_id(params[:layout_id])
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def toggle_branch
|
52
52
|
@cms_page = @cms_site.pages.find(params[:id])
|
53
53
|
s = (session[:cms_page_tree] ||= [])
|
@@ -56,7 +56,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
56
56
|
rescue ActiveRecord::RecordNotFound
|
57
57
|
# do nothing
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def reorder
|
61
61
|
(params[:cms_page] || []).each_with_index do |id, index|
|
62
62
|
if (cms_page = Cms::Page.find_by_id(id))
|
@@ -65,7 +65,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
65
65
|
end
|
66
66
|
render :nothing => true
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
protected
|
70
70
|
|
71
71
|
def check_for_layouts
|
@@ -74,17 +74,17 @@ protected
|
|
74
74
|
redirect_to new_cms_admin_layout_path
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
def build_cms_page
|
79
79
|
@cms_page = @cms_site.pages.new(params[:cms_page])
|
80
80
|
@cms_page.parent ||= (@cms_site.pages.find_by_id(params[:parent_id]) || @cms_site.pages.root)
|
81
81
|
@cms_page.layout ||= (@cms_page.parent && @cms_page.parent.layout || @cms_site.layouts.first)
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
def build_upload_file
|
85
85
|
@upload = Cms::Upload.new
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def load_cms_page
|
89
89
|
@cms_page = @cms_site.pages.find(params[:id])
|
90
90
|
@cms_page.attributes = params[:cms_page]
|
@@ -93,7 +93,7 @@ protected
|
|
93
93
|
flash[:error] = 'Page not found'
|
94
94
|
redirect_to :action => :index
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
def preview_cms_page
|
98
98
|
if params[:preview]
|
99
99
|
layout = @cms_page.layout.app_layout.blank?? false : @cms_page.layout.app_layout
|
@@ -1,59 +1,59 @@
|
|
1
1
|
class CmsAdmin::SitesController < CmsAdmin::BaseController
|
2
|
-
|
2
|
+
|
3
3
|
skip_before_filter :load_admin_cms_site
|
4
|
-
|
4
|
+
|
5
5
|
before_filter :build_cms_site, :only => [:new, :create]
|
6
6
|
before_filter :load_cms_site, :only => [:edit, :update, :destroy]
|
7
|
-
|
7
|
+
|
8
8
|
def index
|
9
9
|
return redirect_to :action => :new if Cms::Site.count == 0
|
10
10
|
@cms_sites = Cms::Site.all
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def new
|
14
14
|
render
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def edit
|
18
18
|
render
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def create
|
22
22
|
@cms_site.save!
|
23
23
|
flash[:notice] = 'Site created'
|
24
|
-
redirect_to :action => :edit, :id => @cms_site
|
24
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_site})
|
25
25
|
rescue ActiveRecord::RecordInvalid
|
26
26
|
flash.now[:error] = 'Failed to create site'
|
27
27
|
render :action => :new
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def update
|
31
31
|
@cms_site.update_attributes!(params[:cms_site])
|
32
32
|
flash[:notice] = 'Site updated'
|
33
|
-
redirect_to :action => :edit, :id => @cms_site
|
33
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_site})
|
34
34
|
rescue ActiveRecord::RecordInvalid
|
35
35
|
flash.now[:error] = 'Failed to update site'
|
36
36
|
render :action => :edit
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def destroy
|
40
40
|
@cms_site.destroy
|
41
41
|
flash[:notice] = 'Site deleted'
|
42
42
|
redirect_to :action => :index
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
protected
|
46
|
-
|
46
|
+
|
47
47
|
def build_cms_site
|
48
48
|
@cms_site = Cms::Site.new(params[:cms_site])
|
49
49
|
@cms_site.hostname ||= request.host.downcase
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def load_cms_site
|
53
53
|
@cms_site = Cms::Site.find(params[:id])
|
54
54
|
rescue ActiveRecord::RecordNotFound
|
55
55
|
flash[:error] = 'Site not found'
|
56
56
|
redirect_to :action => :index
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
class CmsAdmin::SnippetsController < CmsAdmin::BaseController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :build_cms_snippet, :only => [:new, :create]
|
4
4
|
before_filter :load_cms_snippet, :only => [:edit, :update, :destroy]
|
5
|
-
|
5
|
+
|
6
6
|
def index
|
7
7
|
return redirect_to :action => :new if @cms_site.snippets.count == 0
|
8
8
|
@cms_snippets = @cms_site.snippets.all(:order => 'label')
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
render
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def edit
|
16
16
|
render
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def create
|
20
20
|
@cms_snippet.save!
|
21
21
|
flash[:notice] = 'Snippet created'
|
22
|
-
redirect_to :action => :edit, :id => @cms_snippet
|
22
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_snippet})
|
23
23
|
rescue ActiveRecord::RecordInvalid
|
24
24
|
flash.now[:error] = 'Failed to create snippet'
|
25
25
|
render :action => :new
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def update
|
29
29
|
@cms_snippet.update_attributes!(params[:cms_snippet])
|
30
30
|
flash[:notice] = 'Snippet updated'
|
31
|
-
redirect_to :action => :edit, :id => @cms_snippet
|
31
|
+
redirect_to (params[:commit] ? {:action => :index} : {:action => :edit, :id => @cms_snippet})
|
32
32
|
rescue ActiveRecord::RecordInvalid
|
33
33
|
flash.now[:error] = 'Failed to update snippet'
|
34
34
|
render :action => :edit
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def destroy
|
38
38
|
@cms_snippet.destroy
|
39
39
|
flash[:notice] = 'Snippet deleted'
|
40
40
|
redirect_to :action => :index
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
protected
|
44
|
-
|
44
|
+
|
45
45
|
def build_cms_snippet
|
46
46
|
@cms_snippet = @cms_site.snippets.new(params[:cms_snippet])
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def load_cms_snippet
|
50
50
|
@cms_snippet = @cms_site.snippets.find(params[:id])
|
51
51
|
rescue ActiveRecord::RecordNotFound
|
@@ -14,3 +14,8 @@
|
|
14
14
|
<%= form.text_area :content, :class => 'code' %>
|
15
15
|
<%= form.text_area :css, :class => 'code_css' %>
|
16
16
|
<%= form.text_area :js, :class => 'code_js' %>
|
17
|
+
|
18
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
19
|
+
<%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
|
20
|
+
<%= form.submit @cms_layout.new_record?? 'Create Layout' : 'Update Layout', :disable_builder => true %>
|
21
|
+
<% end %>
|
@@ -32,6 +32,7 @@
|
|
32
32
|
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
33
33
|
<%= form.check_box :is_published, :disable_builder => true %>
|
34
34
|
<%= form.label_for :is_published, :label => 'Published' %>
|
35
|
-
<%= form.submit
|
36
|
-
<%= form.submit '
|
35
|
+
<%= form.submit 'Preview', :name => 'preview', :id => nil, :disable_builder => true %>
|
36
|
+
<%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
|
37
|
+
<%= form.submit @cms_page.new_record? ? 'Create Page' : 'Update Page', :disable_builder => true %>
|
37
38
|
<% end %>
|
@@ -1,2 +1,7 @@
|
|
1
1
|
<%= form.text_field :label %>
|
2
|
-
<%= form.text_field :hostname %>
|
2
|
+
<%= form.text_field :hostname %>
|
3
|
+
|
4
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
5
|
+
<%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
|
6
|
+
<%= form.submit @cms_site.new_record?? 'Create Site' : 'Update Site', :disable_builder => true %>
|
7
|
+
<% end %>
|
@@ -4,4 +4,9 @@
|
|
4
4
|
|
5
5
|
<%= form.text_field :label, :id => (@cms_snippet.new_record?? 'slugify' : nil) %>
|
6
6
|
<%= form.text_field :slug, :id => 'slug', :class => 'delimiter-underscore' %>
|
7
|
-
<%= form.text_area :content, :class => 'code' %>
|
7
|
+
<%= form.text_area :content, :class => 'code' %>
|
8
|
+
|
9
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
10
|
+
<%= form.submit 'and continue', :id => nil, :name => 'save', :disable_builder => true %>
|
11
|
+
<%= form.submit @cms_snippet.new_record?? 'Create Snippet' : 'Update Snippet', :disable_builder => true %>
|
12
|
+
<% end %>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-05}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -225,6 +225,7 @@ Gem::Specification.new do |s|
|
|
225
225
|
"test/integration/authentication_test.rb",
|
226
226
|
"test/integration/fixtures_test.rb",
|
227
227
|
"test/integration/render_cms_test.rb",
|
228
|
+
"test/integration/routing_extensions_test.rb",
|
228
229
|
"test/integration/sites_test.rb",
|
229
230
|
"test/integration/view_hooks_test.rb",
|
230
231
|
"test/test_helper.rb",
|
@@ -265,6 +266,7 @@ Gem::Specification.new do |s|
|
|
265
266
|
"test/integration/authentication_test.rb",
|
266
267
|
"test/integration/fixtures_test.rb",
|
267
268
|
"test/integration/render_cms_test.rb",
|
269
|
+
"test/integration/routing_extensions_test.rb",
|
268
270
|
"test/integration/sites_test.rb",
|
269
271
|
"test/integration/view_hooks_test.rb",
|
270
272
|
"test/test_helper.rb",
|
@@ -10,6 +10,11 @@ ComfortableMexicanSofa.configure do |config|
|
|
10
10
|
# You can change 'cms-admin' to 'admin', for example.
|
11
11
|
# config.admin_route_prefix = 'cms-admin'
|
12
12
|
|
13
|
+
# By default Cms content is served directly from the root. Change this setting
|
14
|
+
# if you wish to restrict all content to a section of your site.
|
15
|
+
# To have root page served from http://yourhost/content/ set config below to 'content'
|
16
|
+
# config.content_route_prefix = ''
|
17
|
+
|
13
18
|
# Path: /cms-admin redirects to /cms-admin/pages but you can change it
|
14
19
|
# You don't need to change it when changing admin_route_prefix
|
15
20
|
# config.admin_route_redirect = '/cms-admin/pages'
|