comfortable_mexican_sofa 1.0.37 → 1.0.38
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +4 -18
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +16 -4
- data/app/controllers/cms_admin/layouts_controller.rb +1 -0
- data/app/controllers/cms_admin/pages_controller.rb +26 -0
- data/app/models/cms_layout.rb +0 -9
- data/app/models/cms_page.rb +13 -1
- data/app/views/cms_admin/common/desc/_layout_content.html.erb +25 -0
- data/app/views/cms_admin/common/desc/_layout_css.html.erb +1 -0
- data/app/views/cms_admin/common/desc/_layout_js.html.erb +1 -0
- data/app/views/cms_admin/layouts/_form.html.erb +4 -3
- data/app/views/cms_admin/pages/_index_branch.html.erb +18 -6
- data/app/views/cms_admin/pages/form_blocks.js.erb +1 -1
- data/app/views/cms_admin/pages/index.html.erb +1 -1
- data/app/views/cms_admin/pages/toggle_branch.js.erb +11 -0
- data/app/views/layouts/cms_admin.html.erb +3 -1
- data/comfortable_mexican_sofa.gemspec +11 -3
- data/config/initializers/comfortable_mexican_sofa.rb +4 -1
- data/config/routes.rb +6 -2
- data/lib/comfortable_mexican_sofa/acts_as_tree.rb +5 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +4 -0
- data/lib/comfortable_mexican_sofa/form_builder.rb +10 -1
- data/lib/comfortable_mexican_sofa/view_methods.rb +0 -1
- data/public/images/comfortable_mexican_sofa/arrow_bottom.gif +0 -0
- data/public/images/comfortable_mexican_sofa/arrow_right.gif +0 -0
- data/public/images/comfortable_mexican_sofa/icon_move.gif +0 -0
- data/public/javascripts/comfortable_mexican_sofa/cms.js +19 -0
- data/public/stylesheets/comfortable_mexican_sofa/structure.css +117 -48
- data/public/stylesheets/comfortable_mexican_sofa/typography.css +8 -2
- data/test/functional/cms_admin/layouts_controller_test.rb +1 -0
- data/test/functional/cms_admin/pages_controller_test.rb +49 -0
- data/test/integration/sites_test.rb +44 -5
- data/test/test_helper.rb +13 -7
- data/test/unit/cms_layout_test.rb +0 -8
- data/test/unit/cms_page_test.rb +11 -0
- metadata +13 -5
- data/public/images/comfortable_mexican_sofa/body_bg.jpg +0 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2011 Oleg Khabarov, The Working Group Inc
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -19,27 +19,13 @@ Then from the Rails project's root run:
|
|
19
19
|
rails g cms
|
20
20
|
rake db:migrate
|
21
21
|
|
22
|
-
At this point you should have database structure created, some assets copied to /public directory and initializer set up
|
23
|
-
|
24
|
-
ComfortableMexicanSofa.configure do |config|
|
25
|
-
config.cms_title = 'ComfortableMexicanSofa'
|
26
|
-
config.authentication = 'ComfortableMexicanSofa::HttpAuth'
|
27
|
-
end
|
28
|
-
|
29
|
-
# Credentials for HttpAuth
|
30
|
-
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
31
|
-
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
32
|
-
|
33
|
-
For a full list of available configuration options and their defaults take a peek in here: [configuration.rb](http://https://github.com/theworkinggroup/comfortable-mexican-sofa/blob/master/lib/comfortable_mexican_sofa/configuration.rb)
|
22
|
+
At this point you should have database structure created, some assets copied to /public directory and [initializer](https://github.com/twg/comfortable-mexican-sofa/blob/master/config/initializers/comfortable_mexican_sofa.rb) set up.
|
34
23
|
|
35
24
|
Usage
|
36
25
|
-----
|
37
26
|
Now you should be able to navigate to http://yoursite/cms-admin
|
38
27
|
|
39
|
-
### Step 1: Create
|
40
|
-
CMS allows you to run multiple sites from a single installation. Each site is attached to a hostname. For the first time you'll be prompted to set up the initial site. Hostname will be pre-populated so just choose a label.
|
41
|
-
|
42
|
-
### Step 2: Create Layout
|
28
|
+
### Step 1: Create Layout
|
43
29
|
Before creating pages and populating them with content we need to create a layout. Layout is the template of your pages. It defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:
|
44
30
|
|
45
31
|
<html>
|
@@ -88,7 +74,7 @@ are exactly that. You don't want to do IRB inside CMS so there's a handy tag:
|
|
88
74
|
{{ cms:partial:path/to/partial:x:y }} # gets translated to <%= render :partial => 'path/to/partial',
|
89
75
|
# :locals => { :param_1 => 'x', :param_2 => 'y'} %>
|
90
76
|
|
91
|
-
### Step
|
77
|
+
### Step 2: Create Page
|
92
78
|
Now you're ready to create a page. Based on how you defined your layout, you should have form inputs ready to be populated.
|
93
79
|
Save a page, and it will be accessible from the public side.
|
94
80
|
|
@@ -131,7 +117,7 @@ Then it's a matter of populating the content. Few rules to remember:
|
|
131
117
|
- parent pages are identified by full_path (slug for layouts)
|
132
118
|
- folder structure reflects tree structure of the site
|
133
119
|
|
134
|
-
Example fixture files for a [layout](https://github.com/
|
120
|
+
Example fixture files for a [layout](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/layouts/nested.yml), [page](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/pages/child/subchild.yml) and [snippet](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/snippets/default.yml)
|
135
121
|
|
136
122
|
**Note:** If ComfortableMexicanSofa.config.seed\_data\_path is set no content is loaded from database. Only fixture files are used.
|
137
123
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.38
|
@@ -11,12 +11,24 @@ class CmsAdmin::BaseController < ActionController::Base
|
|
11
11
|
layout 'cms_admin'
|
12
12
|
|
13
13
|
protected
|
14
|
-
|
14
|
+
|
15
15
|
def load_admin_cms_site
|
16
16
|
@cms_site = CmsSite.find_by_hostname!(request.host.downcase)
|
17
|
+
|
17
18
|
rescue ActiveRecord::RecordNotFound
|
18
|
-
|
19
|
-
|
19
|
+
|
20
|
+
if ComfortableMexicanSofa.config.auto_manage_sites
|
21
|
+
if CmsSite.count == 0
|
22
|
+
@cms_site = CmsSite.create!(:label => 'Default Site', :hostname => request.host.downcase)
|
23
|
+
elsif CmsSite.count == 1
|
24
|
+
@cms_site = CmsSite.first
|
25
|
+
@cms_site.update_attribute(:hostname, request.host.downcase)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
unless @cms_site
|
30
|
+
flash[:error] = 'No Site defined for this hostname. Create it now.'
|
31
|
+
return redirect_to(cms_admin_sites_path)
|
32
|
+
end
|
20
33
|
end
|
21
|
-
|
22
34
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class CmsAdmin::PagesController < CmsAdmin::BaseController
|
2
2
|
|
3
|
+
before_filter :check_for_layouts, :only => [:new, :edit]
|
3
4
|
before_filter :build_cms_page, :only => [:new, :create]
|
4
5
|
before_filter :load_cms_page, :only => [:edit, :update, :destroy]
|
5
6
|
before_filter :preview_cms_page, :only => [:create, :update]
|
@@ -47,7 +48,32 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
47
48
|
@cms_page.cms_layout = @cms_site.cms_layouts.find_by_id(params[:layout_id])
|
48
49
|
end
|
49
50
|
|
51
|
+
def toggle_branch
|
52
|
+
@cms_page = @cms_site.cms_pages.find(params[:id])
|
53
|
+
s = (session[:cms_page_tree] ||= [])
|
54
|
+
id = @cms_page.id.to_s
|
55
|
+
s.member?(id) ? s.delete(id) : s << id
|
56
|
+
rescue ActiveRecord::RecordNotFound
|
57
|
+
# do nothing
|
58
|
+
end
|
59
|
+
|
60
|
+
def reorder
|
61
|
+
(params[:cms_page] || []).each_with_index do |id, index|
|
62
|
+
if (cms_page = CmsPage.find_by_id(id))
|
63
|
+
cms_page.update_attribute(:position, index)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
render :nothing => true
|
67
|
+
end
|
68
|
+
|
50
69
|
protected
|
70
|
+
|
71
|
+
def check_for_layouts
|
72
|
+
if CmsLayout.count == 0
|
73
|
+
flash[:error] = 'No Layouts found. Please create one.'
|
74
|
+
redirect_to new_cms_admin_layout_path
|
75
|
+
end
|
76
|
+
end
|
51
77
|
|
52
78
|
def build_cms_page
|
53
79
|
@cms_page = @cms_site.cms_pages.new(params[:cms_page])
|
data/app/models/cms_layout.rb
CHANGED
@@ -93,14 +93,6 @@ class CmsLayout < ActiveRecord::Base
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
def merged_css
|
97
|
-
self.parent ? [self.parent.merged_css, self.css].join("\n") : self.css.to_s
|
98
|
-
end
|
99
|
-
|
100
|
-
def merged_js
|
101
|
-
self.parent ? [self.parent.merged_js, self.js].join("\n") : self.js.to_s
|
102
|
-
end
|
103
|
-
|
104
96
|
protected
|
105
97
|
|
106
98
|
def check_content_tag_presence
|
@@ -115,7 +107,6 @@ protected
|
|
115
107
|
def clear_cache
|
116
108
|
FileUtils.rm File.expand_path("cms-css/#{self.slug}.css", Rails.public_path), :force => true
|
117
109
|
FileUtils.rm File.expand_path("cms-js/#{self.slug}.js", Rails.public_path), :force => true
|
118
|
-
self.children.each{ |child| child.save! }
|
119
110
|
end
|
120
111
|
|
121
112
|
# Forcing page content reload. This will happen in cascade due to #clear_cache mathod above.
|
data/app/models/cms_page.rb
CHANGED
@@ -16,7 +16,8 @@ class CmsPage < ActiveRecord::Base
|
|
16
16
|
|
17
17
|
# -- Callbacks ------------------------------------------------------------
|
18
18
|
before_validation :assign_parent,
|
19
|
-
:assign_full_path
|
19
|
+
:assign_full_path,
|
20
|
+
:assign_position
|
20
21
|
before_save :set_cached_content
|
21
22
|
after_save :sync_child_pages
|
22
23
|
|
@@ -115,6 +116,11 @@ class CmsPage < ActiveRecord::Base
|
|
115
116
|
@cms_tags ||= []
|
116
117
|
end
|
117
118
|
|
119
|
+
# Full url for a page
|
120
|
+
def url
|
121
|
+
"http://#{self.cms_site.hostname}#{self.full_path}"
|
122
|
+
end
|
123
|
+
|
118
124
|
protected
|
119
125
|
|
120
126
|
def assign_parent
|
@@ -125,6 +131,12 @@ protected
|
|
125
131
|
self.full_path = self.parent ? "#{self.parent.full_path}/#{self.slug}".squeeze('/') : '/'
|
126
132
|
end
|
127
133
|
|
134
|
+
def assign_position
|
135
|
+
return unless self.parent
|
136
|
+
max = self.parent.children.maximum(:position)
|
137
|
+
self.position = max ? max + 1 : 0
|
138
|
+
end
|
139
|
+
|
128
140
|
def validate_target_page
|
129
141
|
return unless self.target_page
|
130
142
|
p = self
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<table>
|
2
|
+
<tr>
|
3
|
+
<td>
|
4
|
+
<strong>Renderable Page Elements:</strong>
|
5
|
+
<br/>{{ cms:page:<em>some_label</em>:text }}
|
6
|
+
<br/>{{ cms:page:<em>some_label</em>:rich_text }}
|
7
|
+
<br/>{{ cms:page:<em>some_label</em>:string }}
|
8
|
+
<br/>{{ cms:page:<em>some_label</em>:datetime }}
|
9
|
+
<br/>{{ cms:page:<em>some_label</em>:integer }}
|
10
|
+
</td>
|
11
|
+
<td>
|
12
|
+
<strong>Internal Field Elements:</strong>
|
13
|
+
<br/>{{ cms:field:<em>some_label</em>:text }}
|
14
|
+
<br/>{{ cms:field:<em>some_label</em>:string }}
|
15
|
+
<br/>{{ cms:field:<em>some_label</em>:datetime }}
|
16
|
+
<br/>{{ cms:field:<em>some_label</em>:integer }}
|
17
|
+
</td>
|
18
|
+
<td>
|
19
|
+
<strong>Snippets, Helpers and Partials:</strong>
|
20
|
+
<br/>{{ cms:snippet:<em>slug</em> }}
|
21
|
+
<br/>{{ cms:helper:<em>method_name</em> }}
|
22
|
+
<br/>{{ cms:partial:<em>path/to/partial</em> }}
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
CSS is available at <%= auto_link cms_css_url((@cms_layout.slug || 'layout-slug'), :format => 'css'), :html => { :target => '_blank' } %>
|
@@ -0,0 +1 @@
|
|
1
|
+
JS is available at <%= auto_link cms_js_url((@cms_layout.slug || 'layout-slug'), :format => 'css'), :html => { :target => '_blank' } %>
|
@@ -10,6 +10,7 @@
|
|
10
10
|
<% if (options = CmsLayout.app_layouts_for_select).present? %>
|
11
11
|
<%= form.select :app_layout, [['---- Select Application Layout ----', nil]] + options %>
|
12
12
|
<% end %>
|
13
|
-
|
14
|
-
<%= form.text_area :
|
15
|
-
<%= form.text_area :
|
13
|
+
|
14
|
+
<%= form.text_area :content, :desc => render(:partial => '/cms_admin/common/desc/layout_content'), :desc_toggle => '[ help ]' %>
|
15
|
+
<%= form.text_area :css, :desc => render(:partial => '/cms_admin/common/desc/layout_css'), :desc_toggle => '[ help ]' %>
|
16
|
+
<%= form.text_area :js, :desc => render(:partial => '/cms_admin/common/desc/layout_js'), :desc_toggle => '[ help ]' %>
|
@@ -1,10 +1,22 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
cms_page ||= index_branch
|
3
|
+
has_children = cms_page.children.present?
|
4
|
+
has_siblings = cms_page.siblings.present?
|
5
|
+
branch_open = (session[:cms_page_tree] || []).member?(cms_page.id.to_s) || cms_page.root?
|
6
|
+
%>
|
2
7
|
|
3
|
-
<li id='
|
8
|
+
<li id='<%= dom_id(cms_page) %>'>
|
4
9
|
<div class='item'>
|
10
|
+
<div class='toggle <%= 'open' if branch_open %>'>
|
11
|
+
<%=
|
12
|
+
if has_children && !cms_page.root?
|
13
|
+
link_to span_tag('toggle'), toggle_branch_cms_admin_page_path(cms_page), :remote => true
|
14
|
+
end
|
15
|
+
%>
|
16
|
+
</div>
|
5
17
|
<div class='icon'>
|
6
|
-
<% if
|
7
|
-
<div class='dragger'></div>
|
18
|
+
<% if has_siblings %>
|
19
|
+
<div class='dragger'><span>drag</span></div>
|
8
20
|
<% end %>
|
9
21
|
</div>
|
10
22
|
<div class='action_links'>
|
@@ -15,11 +27,11 @@
|
|
15
27
|
<div class='label'>
|
16
28
|
<%= link_to cms_page.label, edit_cms_admin_page_path(cms_page) %>
|
17
29
|
<div class='sublabel'>
|
18
|
-
<%= link_to cms_page.
|
30
|
+
<%= link_to cms_page.url, cms_page.full_path, :target => '_blank' %>
|
19
31
|
</div>
|
20
32
|
</div>
|
21
33
|
</div>
|
22
|
-
<% if
|
34
|
+
<% if has_children && branch_open %>
|
23
35
|
<ul>
|
24
36
|
<%= render :partial => 'index_branch', :collection => cms_page.children %>
|
25
37
|
</ul>
|
@@ -1 +1 @@
|
|
1
|
-
$('#form_blocks').replaceWith('<%= escape_javascript(render(:partial => "form_blocks")) %>')
|
1
|
+
$('#form_blocks').replaceWith('<%= escape_javascript(render(:partial => "form_blocks")) %>');
|
@@ -0,0 +1,11 @@
|
|
1
|
+
var li = $('li#cms_page_<%=@cms_page.id%>');
|
2
|
+
li.find('.item .toggle').first().toggleClass('open');
|
3
|
+
|
4
|
+
<% if session[:cms_page_tree].member?(@cms_page.id.to_s) %>
|
5
|
+
if(!li.find('ul')[0]) {
|
6
|
+
li.append('<ul><%= escape_javascript(render :partial => "index_branch", :collection => @cms_page.children) %></ul>');
|
7
|
+
$.CMS.enable_sortable_list();
|
8
|
+
}
|
9
|
+
<% else %>
|
10
|
+
li.find('ul').remove();
|
11
|
+
<% end %>
|
@@ -13,7 +13,9 @@
|
|
13
13
|
<div class='body_wrapper'>
|
14
14
|
<div class='left_column'>
|
15
15
|
<div class='left_column_content'>
|
16
|
-
|
16
|
+
<% unless ComfortableMexicanSofa.config.auto_manage_sites %>
|
17
|
+
<%= active_link_to 'Sites', cms_admin_sites_path %>
|
18
|
+
<% end %>
|
17
19
|
<%= active_link_to 'Layouts', cms_admin_layouts_path %>
|
18
20
|
<%= active_link_to 'Pages', cms_admin_pages_path %>
|
19
21
|
<%= active_link_to 'Snippets', cms_admin_snippets_path %>
|
@@ -5,19 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.38"
|
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-01-
|
12
|
+
s.date = %q{2011-01-28}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
16
17
|
"README.md"
|
17
18
|
]
|
18
19
|
s.files = [
|
19
20
|
"Gemfile",
|
20
21
|
"Gemfile.lock",
|
22
|
+
"LICENSE",
|
21
23
|
"README.md",
|
22
24
|
"Rakefile",
|
23
25
|
"VERSION",
|
@@ -35,6 +37,9 @@ Gem::Specification.new do |s|
|
|
35
37
|
"app/models/cms_site.rb",
|
36
38
|
"app/models/cms_snippet.rb",
|
37
39
|
"app/models/cms_upload.rb",
|
40
|
+
"app/views/cms_admin/common/desc/_layout_content.html.erb",
|
41
|
+
"app/views/cms_admin/common/desc/_layout_css.html.erb",
|
42
|
+
"app/views/cms_admin/common/desc/_layout_js.html.erb",
|
38
43
|
"app/views/cms_admin/layouts/_form.html.erb",
|
39
44
|
"app/views/cms_admin/layouts/_index_branch.html.erb",
|
40
45
|
"app/views/cms_admin/layouts/edit.html.erb",
|
@@ -47,6 +52,7 @@ Gem::Specification.new do |s|
|
|
47
52
|
"app/views/cms_admin/pages/form_blocks.js.erb",
|
48
53
|
"app/views/cms_admin/pages/index.html.erb",
|
49
54
|
"app/views/cms_admin/pages/new.html.erb",
|
55
|
+
"app/views/cms_admin/pages/toggle_branch.js.erb",
|
50
56
|
"app/views/cms_admin/sites/_form.html.erb",
|
51
57
|
"app/views/cms_admin/sites/edit.html.erb",
|
52
58
|
"app/views/cms_admin/sites/index.html.erb",
|
@@ -106,7 +112,9 @@ Gem::Specification.new do |s|
|
|
106
112
|
"public/422.html",
|
107
113
|
"public/500.html",
|
108
114
|
"public/favicon.ico",
|
109
|
-
"public/images/comfortable_mexican_sofa/
|
115
|
+
"public/images/comfortable_mexican_sofa/arrow_bottom.gif",
|
116
|
+
"public/images/comfortable_mexican_sofa/arrow_right.gif",
|
117
|
+
"public/images/comfortable_mexican_sofa/icon_move.gif",
|
110
118
|
"public/images/comfortable_mexican_sofa/icon_regular.gif",
|
111
119
|
"public/javascripts/comfortable_mexican_sofa/cms.js",
|
112
120
|
"public/javascripts/comfortable_mexican_sofa/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png",
|
@@ -11,12 +11,15 @@ ComfortableMexicanSofa.configure do |config|
|
|
11
11
|
# config.admin_route_prefix = 'cms-admin'
|
12
12
|
|
13
13
|
# Path: /cms-admin redirects to /cms-admin/pages but you can change it
|
14
|
-
# to
|
14
|
+
# You don't need to change it when changing admin_route_prefix
|
15
15
|
# config.admin_route_redirect = '/cms-admin/pages'
|
16
16
|
|
17
17
|
# Location of YAML files that can be used to render pages instead of pulling
|
18
18
|
# data from the database. Not active if not specified.
|
19
19
|
# config.seed_data_path = File.expand_path('db/cms_seeds', Rails.root)
|
20
|
+
|
21
|
+
# Let CMS handle site creation and management. Enabled by default.
|
22
|
+
# config.auto_manage_sites = true
|
20
23
|
end
|
21
24
|
|
22
25
|
# Default credentials for ComfortableMexicanSofa::HttpAuth
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,10 @@ Rails.application.routes.draw do
|
|
5
5
|
resources :pages do
|
6
6
|
member do
|
7
7
|
match :form_blocks
|
8
|
+
match :toggle_branch
|
9
|
+
end
|
10
|
+
collection do
|
11
|
+
match :reorder
|
8
12
|
end
|
9
13
|
end
|
10
14
|
resources :sites
|
@@ -14,8 +18,8 @@ Rails.application.routes.draw do
|
|
14
18
|
end
|
15
19
|
|
16
20
|
scope :controller => :cms_content do
|
17
|
-
get '/cms-css/:id' => :render_css, :as => 'cms_css'
|
18
|
-
get '/cms-js/:id' => :render_js, :as => 'cms_js'
|
21
|
+
get '/cms-css/:id' => :render_css, :as => 'cms_css'
|
22
|
+
get '/cms-js/:id' => :render_js, :as => 'cms_js'
|
19
23
|
get '/' => :render_html, :as => 'cms_html', :path => '(*cms_path)'
|
20
24
|
end
|
21
25
|
|
@@ -18,6 +18,9 @@ class ComfortableMexicanSofa::Configuration
|
|
18
18
|
# to something else
|
19
19
|
attr_accessor :admin_route_redirect
|
20
20
|
|
21
|
+
# Let CMS handle site creation and management. Enabled by default.
|
22
|
+
attr_accessor :auto_manage_sites
|
23
|
+
|
21
24
|
# Configuration defaults
|
22
25
|
def initialize
|
23
26
|
@cms_title = 'ComfortableMexicanSofa'
|
@@ -25,6 +28,7 @@ class ComfortableMexicanSofa::Configuration
|
|
25
28
|
@seed_data_path = nil
|
26
29
|
@admin_route_prefix = 'cms-admin'
|
27
30
|
@admin_route_redirect = "/#{@admin_route_prefix}/pages"
|
31
|
+
@auto_manage_sites = true
|
28
32
|
end
|
29
33
|
|
30
34
|
end
|
@@ -16,10 +16,19 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def default_field(type, field, options = {}, &block)
|
19
|
+
if desc = options.delete(:desc)
|
20
|
+
desc_toggle = options.delete(:desc_toggle)
|
21
|
+
desc_toggle = "<div class='desc_toggle'>#{desc_toggle}</div>" if desc_toggle
|
22
|
+
desc = %(
|
23
|
+
<div class='desc #{desc_toggle ? 'with_toggle' : nil}'>
|
24
|
+
#{desc_toggle} <div class='desc_content'>#{desc}</div>
|
25
|
+
</div>
|
26
|
+
)
|
27
|
+
end
|
19
28
|
%(
|
20
29
|
<div class='form_element #{type}_element'>
|
21
30
|
<div class='label'>#{label_for(field, options)}</div>
|
22
|
-
<div class='value'>#{yield}</div>
|
31
|
+
<div class='value'>#{yield}</div> #{desc}
|
23
32
|
</div>
|
24
33
|
).html_safe
|
25
34
|
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -9,6 +9,8 @@ $.CMS = function(){
|
|
9
9
|
$.CMS.load_page_blocks();
|
10
10
|
$.CMS.enable_rich_text();
|
11
11
|
$.CMS.enable_date_picker();
|
12
|
+
$.CMS.enable_desc_toggle();
|
13
|
+
$.CMS.enable_sortable_list();
|
12
14
|
if($('form.new_cms_page, form.edit_cms_page').get(0)) $.CMS.enable_page_save_form();
|
13
15
|
if($('#page_save').get(0)) $.CMS.enable_page_save_widget();
|
14
16
|
if($('#uploader_button').get(0)) $.CMS.enable_uploader();
|
@@ -17,6 +19,16 @@ $.CMS = function(){
|
|
17
19
|
|
18
20
|
return {
|
19
21
|
|
22
|
+
enable_sortable_list: function(){
|
23
|
+
$('ul.sortable, ul.sortable ul').sortable({
|
24
|
+
handle: 'div.dragger',
|
25
|
+
axis: 'y',
|
26
|
+
update: function(){
|
27
|
+
$.post(current_path + '/reorder', '_method=put&'+$(this).sortable('serialize'));
|
28
|
+
}
|
29
|
+
})
|
30
|
+
},
|
31
|
+
|
20
32
|
slugify: function(){
|
21
33
|
$('input#slugify').bind('keyup.cms', function() {
|
22
34
|
$('input#slug').val( slugify( $(this).val() ) );
|
@@ -70,6 +82,13 @@ $.CMS = function(){
|
|
70
82
|
$('input[type=datetime]').datepicker();
|
71
83
|
},
|
72
84
|
|
85
|
+
enable_desc_toggle: function(){
|
86
|
+
$('.form_element .desc .desc_toggle').click(function(){
|
87
|
+
$(this).toggle();
|
88
|
+
$(this).siblings('.desc_content').toggle();
|
89
|
+
})
|
90
|
+
},
|
91
|
+
|
73
92
|
tree_methods: function(){
|
74
93
|
$('a.tree_toggle').bind('click.cms', function() {
|
75
94
|
$(this).siblings('ul').toggle();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -- Containers --------------------------------------------------------- */
|
2
2
|
html, body {
|
3
3
|
height: 100%;
|
4
|
-
background:
|
4
|
+
background-color: #252525;
|
5
5
|
}
|
6
6
|
.body_wrapper {
|
7
7
|
height: 100%;
|
@@ -13,11 +13,10 @@ html, body {
|
|
13
13
|
.center_column {
|
14
14
|
margin: 0px 250px 0px 175px;
|
15
15
|
min-height: 100%;
|
16
|
-
background-color: #ececec;
|
17
16
|
overflow: hidden;
|
18
|
-
|
19
|
-
-
|
20
|
-
-
|
17
|
+
background-color: #D8D8D8;
|
18
|
+
border-left: 1px solid #484844;
|
19
|
+
border-right: 1px solid #484848;
|
21
20
|
}
|
22
21
|
.center_column_content {
|
23
22
|
padding: 25px;
|
@@ -38,19 +37,22 @@ html, body {
|
|
38
37
|
}
|
39
38
|
.left_column_content a {
|
40
39
|
display: block;
|
41
|
-
|
42
|
-
padding: 0px 10px;
|
40
|
+
padding: 3px 10px;
|
43
41
|
margin-bottom: 5px;
|
44
|
-
font: 15px/25px
|
45
|
-
color: #1C1F22;
|
42
|
+
font: 15px/25px 'Lucida Grande', 'Tahoma', serif;
|
46
43
|
border-top-left-radius: 4px;
|
47
|
-
border-bottom-left-radius: 4px
|
44
|
+
border-bottom-left-radius: 4px;
|
48
45
|
-moz-border-radius-topleft: 4px;
|
49
46
|
-moz-border-radius-bottomleft: 4px;
|
50
|
-
|
47
|
+
background: #2D2D2D;
|
48
|
+
background: -moz-linear-gradient(left, #2D2D2D 0%, #3A3A3A 100%);
|
49
|
+
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#2D2D2D), color-stop(100%,#3A3A3A));
|
50
|
+
color: #fff;
|
51
|
+
opacity: 0.3;
|
51
52
|
}
|
52
53
|
.left_column_content a:hover,
|
53
54
|
.left_column_content a.active {
|
55
|
+
color: #fff;
|
54
56
|
opacity: 1;
|
55
57
|
}
|
56
58
|
/* -- Right Column ------------------------------------------------------- */
|
@@ -126,16 +128,18 @@ html, body {
|
|
126
128
|
}
|
127
129
|
.big_button {
|
128
130
|
float: right;
|
129
|
-
padding:
|
131
|
+
padding: 4px 10px;
|
130
132
|
font-size: 10px;
|
133
|
+
font-weight: bold;
|
131
134
|
text-transform: uppercase;
|
132
|
-
background: url(/images/comfortable_mexican_sofa/body_bg.jpg);
|
133
135
|
border-radius: 3px;
|
134
136
|
-moz-border-radius: 3px;
|
137
|
+
border: 1px solid #9f9f9f;
|
138
|
+
background: -moz-linear-gradient(top, #F9F9F9 0%, #D5D5D5 34%, #B4B4B4 100%);
|
139
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F9F9F9), color-stop(34%,#D5D5D5), color-stop(100%,#B4B4B4));
|
140
|
+
text-shadow: #f5f5f5 1px 1px;
|
135
141
|
letter-spacing: 0.5px;
|
136
|
-
|
137
|
-
.big_button span {
|
138
|
-
color: #fff;
|
142
|
+
color: #1b1b1b;
|
139
143
|
}
|
140
144
|
|
141
145
|
/* -- Forms -------------------------------------------------------------- */
|
@@ -147,7 +151,7 @@ html, body {
|
|
147
151
|
width: 137px;
|
148
152
|
float: left;
|
149
153
|
text-align: right;
|
150
|
-
font: 15px/21px
|
154
|
+
font: 15px/21px 'Lucida Grande', 'Tahoma', serif;
|
151
155
|
text-shadow: #fff 1px 1px;
|
152
156
|
padding-right: 10px;
|
153
157
|
background-color: #e0e0e0;
|
@@ -164,14 +168,16 @@ html, body {
|
|
164
168
|
.form_element .value input[type='password'],
|
165
169
|
.form_element .value textarea,
|
166
170
|
.form_element .value select {
|
167
|
-
width:
|
171
|
+
width: 100%;
|
168
172
|
}
|
169
173
|
.form_element .value input[type='text'],
|
170
174
|
.form_element .value input[type='password'],
|
171
175
|
.form_element .value select,
|
172
176
|
.form_element .value textarea {
|
173
|
-
border:
|
174
|
-
|
177
|
+
border: 0px;
|
178
|
+
border-top: 1px solid #ccc;
|
179
|
+
border-bottom: 1px solid #ccc;
|
180
|
+
padding: 2px 0px;
|
175
181
|
font-family: 'Courier New', Courier, monospace;
|
176
182
|
}
|
177
183
|
.form_element .value textarea {
|
@@ -220,62 +226,125 @@ html, body {
|
|
220
226
|
.form_element.form_save label {
|
221
227
|
margin: 0px 5px;
|
222
228
|
}
|
229
|
+
.form_element .desc {
|
230
|
+
margin: 3px 0px 0px 160px;
|
231
|
+
font-size: 11px;
|
232
|
+
color: #777;
|
233
|
+
}
|
234
|
+
.form_element .desc .desc_toggle {
|
235
|
+
float: right;
|
236
|
+
}
|
237
|
+
.form_element .desc .desc_toggle:hover {
|
238
|
+
text-decoration: underline;
|
239
|
+
cursor: pointer;
|
240
|
+
}
|
241
|
+
.form_element .desc .desc_content {
|
242
|
+
background-color: #fff;
|
243
|
+
padding: 5px;
|
244
|
+
border-radius: 3px;
|
245
|
+
-moz-border-radius: 3px;
|
246
|
+
}
|
247
|
+
.form_element .desc.with_toggle .desc_content {
|
248
|
+
display: none;
|
249
|
+
}
|
250
|
+
.form_element .desc.with_toggle .desc_content table td {
|
251
|
+
vertical-align: top;
|
252
|
+
padding: 5px;
|
253
|
+
}
|
223
254
|
|
224
255
|
/* -- Listings ----------------------------------------------------------- */
|
225
256
|
ul.list li .item {
|
226
257
|
overflow: hidden;
|
227
258
|
padding: 5px;
|
228
|
-
|
259
|
+
background-color: #ececec;
|
260
|
+
border-radius: 3px;
|
261
|
+
-moz-border-radius: 3px;
|
262
|
+
margin-bottom: 5px;
|
229
263
|
}
|
230
|
-
ul.list li .
|
264
|
+
ul.list li .item .toggle {
|
265
|
+
float: left;
|
266
|
+
height: 28px;
|
267
|
+
width: 28px;
|
268
|
+
}
|
269
|
+
ul.list li .item .toggle a {
|
270
|
+
display: block;
|
271
|
+
height: 28px;
|
272
|
+
width: 28px;
|
273
|
+
background: url(/images/comfortable_mexican_sofa/arrow_right.gif) center center no-repeat;
|
274
|
+
}
|
275
|
+
ul.list li .item .toggle a span {
|
276
|
+
display: none;
|
277
|
+
}
|
278
|
+
ul.list li .item .toggle.open a {
|
279
|
+
background-image: url(/images/comfortable_mexican_sofa/arrow_bottom.gif);
|
280
|
+
}
|
281
|
+
ul.list li .item .icon {
|
282
|
+
float: left;
|
231
283
|
width: 28px;
|
232
284
|
height: 28px;
|
233
285
|
background: url(/images/comfortable_mexican_sofa/icon_regular.gif);
|
234
|
-
float: left;
|
235
286
|
}
|
236
|
-
ul.list li .
|
237
|
-
|
238
|
-
|
287
|
+
ul.list li .item .icon .dragger {
|
288
|
+
width: 28px;
|
289
|
+
height: 28px;
|
290
|
+
background: url(/images/comfortable_mexican_sofa/icon_move.gif);
|
291
|
+
display: none;
|
239
292
|
}
|
240
|
-
|
241
|
-
|
293
|
+
ul.list li .item .icon:hover .dragger {
|
294
|
+
display: block;
|
295
|
+
}
|
296
|
+
ul.list li .item .icon .dragger span {
|
297
|
+
display: none;
|
298
|
+
}
|
299
|
+
ul.list li .item .label {
|
300
|
+
margin-left: 60px;
|
301
|
+
font-size: 14px;
|
302
|
+
font-weight: bold;
|
303
|
+
}
|
304
|
+
ul.list li .item .label .sublabel {
|
305
|
+
font-size: 10px;
|
306
|
+
font-weight: normal;
|
307
|
+
}
|
308
|
+
ul.list li ul {
|
309
|
+
margin-left: 28px;
|
242
310
|
}
|
243
311
|
ul.list .action_links a,
|
244
312
|
table.formatted td.action_links a {
|
245
313
|
margin-left: 3px;
|
246
|
-
background-color: #
|
247
|
-
color: #
|
314
|
+
background-color: #b4b4b4;
|
315
|
+
color: #1b1b1b;
|
248
316
|
padding: 3px 5px;
|
249
317
|
font-size: 9px;
|
250
318
|
text-transform: uppercase;
|
251
319
|
border-radius: 3px;
|
252
320
|
-moz-border-radius: 3px;
|
321
|
+
border: 1px solid #9f9f9f;
|
322
|
+
background: -moz-linear-gradient(top, #F9F9F9 0%, #D5D5D5 34%, #B4B4B4 100%);
|
323
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F9F9F9), color-stop(34%,#D5D5D5), color-stop(100%,#B4B4B4));
|
324
|
+
text-shadow: #f5f5f5 1px 1px;
|
325
|
+
}
|
326
|
+
ul.list .action_links a:hover,
|
327
|
+
table.formatted td.action_links a:hover {
|
328
|
+
box-shadow: inset 0px 0px 5px #aaa;
|
329
|
+
-moz-box-shadow: inset 0px 0px 5px #aaa;
|
330
|
+
-webkit-box-shadow: inset 0px 0px 5px #aaa;
|
331
|
+
border-color: #484848;
|
253
332
|
}
|
254
|
-
ul.list li .
|
255
|
-
|
256
|
-
|
257
|
-
font: 16px/18px Georgia, serif;
|
258
|
-
color: #1C1F22;
|
259
|
-
}
|
260
|
-
table.formatted td .label {
|
261
|
-
margin-left: 0px;
|
333
|
+
ul.list li .action_links {
|
334
|
+
float: right;
|
335
|
+
opacity: 0.2;
|
262
336
|
}
|
263
|
-
|
264
|
-
|
265
|
-
font: 11px/14px Arial, sans-serif;
|
266
|
-
color: #1C1F22;
|
337
|
+
table.formatted td.action_links a {
|
338
|
+
opacity: 0.2;
|
267
339
|
}
|
268
|
-
ul.list li
|
269
|
-
|
340
|
+
ul.list li .item:hover .action_links,
|
341
|
+
table.formatted tr:hover td.action_links a {
|
342
|
+
opacity: 1;
|
270
343
|
}
|
271
344
|
ul.list li .item:hover,
|
272
345
|
table.formatted tr:hover td {
|
273
346
|
background-color: #fff;
|
274
347
|
}
|
275
|
-
ul.list li .item:hover .action_links,
|
276
|
-
table.formatted tr:hover td.action_links a {
|
277
|
-
opacity: 1;
|
278
|
-
}
|
279
348
|
table.formatted {
|
280
349
|
clear: both;
|
281
350
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
body {
|
2
|
-
font: 13px
|
2
|
+
font: 13px 'Lucida Grande', 'Tahoma', sans-serif;
|
3
3
|
}
|
4
4
|
|
5
5
|
h1 {
|
6
|
-
font: bold 25px/25px
|
6
|
+
font: bold 25px/25px 'Lucida Grande', 'Tahoma', serif;
|
7
7
|
margin-bottom: 25px;
|
8
8
|
padding-bottom: 5px;
|
9
9
|
color: #1C1F22;
|
@@ -16,4 +16,10 @@ a {
|
|
16
16
|
}
|
17
17
|
a:hover {
|
18
18
|
color: #1C2733;
|
19
|
+
}
|
20
|
+
strong {
|
21
|
+
font-weight: bold;
|
22
|
+
}
|
23
|
+
em {
|
24
|
+
font-style: italic;
|
19
25
|
}
|
@@ -20,6 +20,7 @@ class CmsAdmin::LayoutsControllerTest < ActionController::TestCase
|
|
20
20
|
get :new
|
21
21
|
assert_response :success
|
22
22
|
assert assigns(:cms_layout)
|
23
|
+
assert_equal '{{ cms:page:content }}', assigns(:cms_layout).content
|
23
24
|
assert_template :new
|
24
25
|
assert_select 'form[action=/cms-admin/layouts]'
|
25
26
|
end
|
@@ -282,4 +282,53 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
282
282
|
assert_not_equal 'Updated Label', page.label
|
283
283
|
end
|
284
284
|
end
|
285
|
+
|
286
|
+
def test_get_new_with_no_layout
|
287
|
+
CmsLayout.destroy_all
|
288
|
+
get :new
|
289
|
+
assert_response :redirect
|
290
|
+
assert_redirected_to new_cms_admin_layout_path
|
291
|
+
assert_equal 'No Layouts found. Please create one.', flash[:error]
|
292
|
+
end
|
293
|
+
|
294
|
+
def test_get_edit_with_no_layout
|
295
|
+
CmsLayout.destroy_all
|
296
|
+
page = cms_pages(:default)
|
297
|
+
get :edit, :id => page
|
298
|
+
assert_response :redirect
|
299
|
+
assert_redirected_to new_cms_admin_layout_path
|
300
|
+
assert_equal 'No Layouts found. Please create one.', flash[:error]
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_get_toggle_branch
|
304
|
+
page = cms_pages(:default)
|
305
|
+
get :toggle_branch, :id => page, :format => :js
|
306
|
+
assert_response :success
|
307
|
+
assert_equal [page.id.to_s], session[:cms_page_tree]
|
308
|
+
|
309
|
+
get :toggle_branch, :id => page, :format => :js
|
310
|
+
assert_response :success
|
311
|
+
assert_equal [], session[:cms_page_tree]
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_reorder
|
315
|
+
page_one = cms_pages(:child)
|
316
|
+
page_two = cms_sites(:default).cms_pages.create!(
|
317
|
+
:parent => cms_pages(:default),
|
318
|
+
:cms_layout => cms_layouts(:default),
|
319
|
+
:label => 'test',
|
320
|
+
:slug => 'test'
|
321
|
+
)
|
322
|
+
assert_equal 0, page_one.position
|
323
|
+
assert_equal 1, page_two.position
|
324
|
+
|
325
|
+
post :reorder, :cms_page => [page_two.id, page_one.id]
|
326
|
+
assert_response :success
|
327
|
+
page_one.reload
|
328
|
+
page_two.reload
|
329
|
+
|
330
|
+
assert_equal 1, page_one.position
|
331
|
+
assert_equal 0, page_two.position
|
332
|
+
end
|
333
|
+
|
285
334
|
end
|
@@ -2,16 +2,55 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
class SitesTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
|
-
def
|
5
|
+
def test_get_admin
|
6
6
|
http_auth :get, cms_admin_pages_path
|
7
7
|
assert_response :success
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def test_get_admin_with_no_site
|
11
11
|
CmsSite.delete_all
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
assert_difference 'CmsSite.count' do
|
13
|
+
http_auth :get, cms_admin_pages_path
|
14
|
+
assert_response :redirect
|
15
|
+
assert_redirected_to new_cms_admin_page_path
|
16
|
+
site = CmsSite.first
|
17
|
+
assert_equal 'test.host', site.hostname
|
18
|
+
assert_equal 'Default Site', site.label
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_get_admin_with_wrong_site
|
23
|
+
site = cms_sites(:default)
|
24
|
+
site.update_attribute(:hostname, 'remote.host')
|
25
|
+
assert_no_difference 'CmsSite.count' do
|
26
|
+
http_auth :get, cms_admin_pages_path
|
27
|
+
assert_response :success
|
28
|
+
site.reload
|
29
|
+
assert_equal 'test.host', site.hostname
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_get_admin_with_two_wrong_sites
|
34
|
+
CmsSite.delete_all
|
35
|
+
CmsSite.create!(:label => 'Site1', :hostname => 'site1.host')
|
36
|
+
CmsSite.create!(:label => 'Site2', :hostname => 'site2.host')
|
37
|
+
assert_no_difference 'CmsSite.count' do
|
38
|
+
http_auth :get, cms_admin_pages_path
|
39
|
+
assert_response :redirect
|
40
|
+
assert_redirected_to cms_admin_sites_path
|
41
|
+
assert_equal 'No Site defined for this hostname. Create it now.', flash[:error]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_get_admin_with_no_site_and_no_auto_manage
|
46
|
+
ComfortableMexicanSofa.config.auto_manage_sites = false
|
47
|
+
CmsSite.delete_all
|
48
|
+
assert_no_difference 'CmsSite.count' do
|
49
|
+
http_auth :get, cms_admin_pages_path
|
50
|
+
assert_response :redirect
|
51
|
+
assert_redirected_to cms_admin_sites_path
|
52
|
+
assert_equal 'No Site defined for this hostname. Create it now.', flash[:error]
|
53
|
+
end
|
15
54
|
end
|
16
55
|
|
17
56
|
def test_get_public_page_for_non_existent_site
|
data/test/test_helper.rb
CHANGED
@@ -3,15 +3,23 @@ require File.expand_path('../../config/environment', __FILE__)
|
|
3
3
|
require 'rails/test_help'
|
4
4
|
|
5
5
|
class ActiveSupport::TestCase
|
6
|
+
|
6
7
|
fixtures :all
|
7
8
|
include ActionDispatch::TestProcess
|
8
9
|
|
9
10
|
def setup
|
10
|
-
|
11
|
+
reset_config
|
12
|
+
end
|
13
|
+
|
14
|
+
# resetting default configuration
|
15
|
+
def reset_config
|
11
16
|
ComfortableMexicanSofa.configure do |config|
|
12
|
-
config.cms_title
|
13
|
-
config.authentication
|
14
|
-
config.seed_data_path
|
17
|
+
config.cms_title = 'ComfortableMexicanSofa'
|
18
|
+
config.authentication = 'ComfortableMexicanSofa::HttpAuth'
|
19
|
+
config.seed_data_path = nil
|
20
|
+
config.admin_route_prefix = 'cms-admin'
|
21
|
+
config.admin_route_redirect = "/cms-admin/pages"
|
22
|
+
config.auto_manage_sites = true
|
15
23
|
end
|
16
24
|
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
17
25
|
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
@@ -69,9 +77,7 @@ class ActionDispatch::IntegrationTest
|
|
69
77
|
|
70
78
|
def setup
|
71
79
|
host! 'test.host'
|
72
|
-
|
73
|
-
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
74
|
-
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
80
|
+
reset_config
|
75
81
|
end
|
76
82
|
|
77
83
|
# Attaching http_auth stuff with request. Example use:
|
@@ -84,14 +84,6 @@ class CmsLayoutTest < ActiveSupport::TestCase
|
|
84
84
|
assert_equal '{{cms:page:content}}', child_layout.merged_content
|
85
85
|
end
|
86
86
|
|
87
|
-
def test_merged_css
|
88
|
-
assert_equal "nested_css\nchild_css", cms_layouts(:child).merged_css
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_merged_js
|
92
|
-
assert_equal "nested_js\nchild_js", cms_layouts(:child).merged_js
|
93
|
-
end
|
94
|
-
|
95
87
|
def test_load_from_file
|
96
88
|
assert !CmsLayout.load_from_file(cms_sites(:default), 'default')
|
97
89
|
|
data/test/unit/cms_page_test.rb
CHANGED
@@ -57,6 +57,7 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
57
57
|
]
|
58
58
|
)
|
59
59
|
assert page.is_published?
|
60
|
+
assert_equal 1, page.position
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -231,6 +232,16 @@ class CmsPageTest < ActiveSupport::TestCase
|
|
231
232
|
assert_equal 1, CmsPage.published.count
|
232
233
|
end
|
233
234
|
|
235
|
+
def test_root?
|
236
|
+
assert cms_pages(:default).root?
|
237
|
+
assert !cms_pages(:child).root?
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_url
|
241
|
+
assert_equal 'http://test.host/', cms_pages(:default).url
|
242
|
+
assert_equal 'http://test.host/child-page', cms_pages(:child).url
|
243
|
+
end
|
244
|
+
|
234
245
|
protected
|
235
246
|
|
236
247
|
def new_params(options = {})
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 38
|
9
|
+
version: 1.0.38
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Oleg Khabarov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -141,10 +141,12 @@ executables: []
|
|
141
141
|
extensions: []
|
142
142
|
|
143
143
|
extra_rdoc_files:
|
144
|
+
- LICENSE
|
144
145
|
- README.md
|
145
146
|
files:
|
146
147
|
- Gemfile
|
147
148
|
- Gemfile.lock
|
149
|
+
- LICENSE
|
148
150
|
- README.md
|
149
151
|
- Rakefile
|
150
152
|
- VERSION
|
@@ -162,6 +164,9 @@ files:
|
|
162
164
|
- app/models/cms_site.rb
|
163
165
|
- app/models/cms_snippet.rb
|
164
166
|
- app/models/cms_upload.rb
|
167
|
+
- app/views/cms_admin/common/desc/_layout_content.html.erb
|
168
|
+
- app/views/cms_admin/common/desc/_layout_css.html.erb
|
169
|
+
- app/views/cms_admin/common/desc/_layout_js.html.erb
|
165
170
|
- app/views/cms_admin/layouts/_form.html.erb
|
166
171
|
- app/views/cms_admin/layouts/_index_branch.html.erb
|
167
172
|
- app/views/cms_admin/layouts/edit.html.erb
|
@@ -174,6 +179,7 @@ files:
|
|
174
179
|
- app/views/cms_admin/pages/form_blocks.js.erb
|
175
180
|
- app/views/cms_admin/pages/index.html.erb
|
176
181
|
- app/views/cms_admin/pages/new.html.erb
|
182
|
+
- app/views/cms_admin/pages/toggle_branch.js.erb
|
177
183
|
- app/views/cms_admin/sites/_form.html.erb
|
178
184
|
- app/views/cms_admin/sites/edit.html.erb
|
179
185
|
- app/views/cms_admin/sites/index.html.erb
|
@@ -233,7 +239,9 @@ files:
|
|
233
239
|
- public/422.html
|
234
240
|
- public/500.html
|
235
241
|
- public/favicon.ico
|
236
|
-
- public/images/comfortable_mexican_sofa/
|
242
|
+
- public/images/comfortable_mexican_sofa/arrow_bottom.gif
|
243
|
+
- public/images/comfortable_mexican_sofa/arrow_right.gif
|
244
|
+
- public/images/comfortable_mexican_sofa/icon_move.gif
|
237
245
|
- public/images/comfortable_mexican_sofa/icon_regular.gif
|
238
246
|
- public/javascripts/comfortable_mexican_sofa/cms.js
|
239
247
|
- public/javascripts/comfortable_mexican_sofa/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png
|
@@ -359,7 +367,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
359
367
|
requirements:
|
360
368
|
- - ">="
|
361
369
|
- !ruby/object:Gem::Version
|
362
|
-
hash:
|
370
|
+
hash: 1387758075576454082
|
363
371
|
segments:
|
364
372
|
- 0
|
365
373
|
version: "0"
|
Binary file
|