comfortable_mexican_sofa 1.2.2 → 1.2.3
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.
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +8 -1
- data/app/views/layouts/cms_admin/_head.html.erb +2 -1
- data/comfortable_mexican_sofa.gemspec +2 -2
- data/config/initializers/comfortable_mexican_sofa.rb +3 -2
- data/config/initializers/paperclip.rb +1 -1
- data/lib/comfortable_mexican_sofa/fixtures.rb +1 -2
- data/public/javascripts/comfortable_mexican_sofa/cms.js +21 -21
- data/test/integration/fixtures_test.rb +18 -0
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.3
|
|
@@ -6,7 +6,8 @@ class CmsAdmin::BaseController < ApplicationController
|
|
|
6
6
|
include ComfortableMexicanSofa.config.authentication.to_s.constantize
|
|
7
7
|
|
|
8
8
|
before_filter :authenticate,
|
|
9
|
-
:load_admin_cms_site
|
|
9
|
+
:load_admin_cms_site,
|
|
10
|
+
:load_fixtures
|
|
10
11
|
|
|
11
12
|
layout 'cms_admin'
|
|
12
13
|
|
|
@@ -31,4 +32,10 @@ protected
|
|
|
31
32
|
return redirect_to(cms_admin_sites_path)
|
|
32
33
|
end
|
|
33
34
|
end
|
|
35
|
+
|
|
36
|
+
def load_fixtures
|
|
37
|
+
return unless ComfortableMexicanSofa.config.enable_fixtures
|
|
38
|
+
ComfortableMexicanSofa::Fixtures.sync(@cms_site)
|
|
39
|
+
flash.now[:error] = 'CMS Fixtures are enabled. All changes done here will be discarded.'
|
|
40
|
+
end
|
|
34
41
|
end
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
3
3
|
<title><%= ComfortableMexicanSofa.config.cms_title %></title>
|
|
4
4
|
<%= csrf_meta_tag %>
|
|
5
|
+
<meta name="cms-admin-path" content="<%= ComfortableMexicanSofa.config.admin_route_prefix %>" />
|
|
5
6
|
<%= stylesheet_link_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
|
6
7
|
<%= javascript_include_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
|
7
8
|
<%= javascript_include_tag :tiny_mce %>
|
|
8
9
|
|
|
9
10
|
<%= yield :head %>
|
|
10
11
|
<%= cms_hook :html_head %>
|
|
11
|
-
</head>
|
|
12
|
+
</head>
|
|
@@ -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.2.
|
|
8
|
+
s.version = "1.2.3"
|
|
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-16}
|
|
13
13
|
s.description = %q{}
|
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ComfortableMexicanSofa.configure do |config|
|
|
2
2
|
# Title of the admin area
|
|
3
|
-
config.cms_title
|
|
3
|
+
# config.cms_title = 'ComfortableMexicanSofa MicroCMS'
|
|
4
4
|
|
|
5
5
|
# Module responsible for authentication. You can replace it with your own.
|
|
6
6
|
# It simply needs to have #authenticate method. See http_auth.rb for reference.
|
|
7
|
-
config.authentication = 'ComfortableMexicanSofa::HttpAuth'
|
|
7
|
+
# config.authentication = 'ComfortableMexicanSofa::HttpAuth'
|
|
8
8
|
|
|
9
9
|
# Default url to access admin area is http://yourhost/cms-admin/
|
|
10
10
|
# You can change 'cms-admin' to 'admin', for example. To disable admin area
|
|
@@ -55,6 +55,7 @@ ComfortableMexicanSofa.configure do |config|
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# Default credentials for ComfortableMexicanSofa::HttpAuth
|
|
58
|
+
# YOU REALLY WANT TO CHANGE THIS BEFORE PUTTING YOUR SITE LIVE
|
|
58
59
|
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
|
59
60
|
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
|
60
61
|
|
|
@@ -80,8 +80,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
80
80
|
end
|
|
81
81
|
elsif page.new_record?
|
|
82
82
|
page.label = slug.titleize
|
|
83
|
-
page.layout =
|
|
84
|
-
|
|
83
|
+
page.layout = parent.try(:layout)
|
|
85
84
|
end
|
|
86
85
|
|
|
87
86
|
# updating content
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
$.CMS = function(){
|
|
2
2
|
var current_path = window.location.pathname;
|
|
3
|
-
var admin_path_prefix =
|
|
4
|
-
|
|
3
|
+
var admin_path_prefix = $('meta[name="cms-admin-path"]').attr('content');
|
|
4
|
+
|
|
5
5
|
$(function(){
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
$.CMS.slugify();
|
|
8
8
|
$.CMS.tree_methods();
|
|
9
9
|
$.CMS.load_page_blocks();
|
|
@@ -16,9 +16,9 @@ $.CMS = function(){
|
|
|
16
16
|
if($('#page_save').get(0)) $.CMS.enable_page_save_widget();
|
|
17
17
|
if($('#uploader_button').get(0)) $.CMS.enable_uploader();
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
return {
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
enable_sortable_list: function(){
|
|
23
23
|
$('ul.sortable, ul.sortable ul').sortable({
|
|
24
24
|
handle: 'div.dragger',
|
|
@@ -28,7 +28,7 @@ $.CMS = function(){
|
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
slugify: function(){
|
|
33
33
|
$('input#slugify').bind('keyup.cms', function() {
|
|
34
34
|
var slug_input = $('input#slug');
|
|
@@ -51,7 +51,7 @@ $.CMS = function(){
|
|
|
51
51
|
return str;
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
// Load Page Blocks on layout change
|
|
56
56
|
load_page_blocks: function(){
|
|
57
57
|
$('select#cms_page_layout_id').bind('change.cms', function() {
|
|
@@ -60,14 +60,14 @@ $.CMS = function(){
|
|
|
60
60
|
data: ({
|
|
61
61
|
layout_id: $(this).val()
|
|
62
62
|
}),
|
|
63
|
-
complete: function(){
|
|
63
|
+
complete: function(){
|
|
64
64
|
$.CMS.enable_rich_text();
|
|
65
65
|
$.CMS.enable_date_picker();
|
|
66
66
|
}
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
enable_rich_text: function(){
|
|
72
72
|
$('textarea.rich_text').tinymce({
|
|
73
73
|
theme : "advanced",
|
|
@@ -83,7 +83,7 @@ $.CMS = function(){
|
|
|
83
83
|
theme_advanced_resize_horizontal : false
|
|
84
84
|
});
|
|
85
85
|
},
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
enable_codemirror: function(){
|
|
88
88
|
$('textarea.code').each(function(i, element){
|
|
89
89
|
CodeMirror.fromTextArea(element, {
|
|
@@ -97,7 +97,7 @@ $.CMS = function(){
|
|
|
97
97
|
stylesheet: "/javascripts/comfortable_mexican_sofa/codemirror/codemirror.css"
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
$('textarea.code_css').each(function(i, element){
|
|
102
102
|
CodeMirror.fromTextArea(element, {
|
|
103
103
|
basefiles: [
|
|
@@ -107,7 +107,7 @@ $.CMS = function(){
|
|
|
107
107
|
stylesheet: "/javascripts/comfortable_mexican_sofa/codemirror/codemirror.css"
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
$('textarea.code_js').each(function(i, element){
|
|
112
112
|
CodeMirror.fromTextArea(element, {
|
|
113
113
|
basefiles: [
|
|
@@ -118,18 +118,18 @@ $.CMS = function(){
|
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
enable_date_picker: function(){
|
|
123
123
|
$('input[type=datetime]').datepicker();
|
|
124
124
|
},
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
enable_desc_toggle: function(){
|
|
127
127
|
$('.form_element .desc .desc_toggle').click(function(){
|
|
128
128
|
$(this).toggle();
|
|
129
129
|
$(this).siblings('.desc_content').toggle();
|
|
130
130
|
})
|
|
131
131
|
},
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
tree_methods: function(){
|
|
134
134
|
$('a.tree_toggle').bind('click.cms', function() {
|
|
135
135
|
$(this).siblings('ul').toggle();
|
|
@@ -137,7 +137,7 @@ $.CMS = function(){
|
|
|
137
137
|
// object_id are set in the helper (check cms_helper.rb)
|
|
138
138
|
$.ajax({url: [current_path, object_id, 'toggle'].join('/')});
|
|
139
139
|
});
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
$('ul.sortable').each(function(){
|
|
142
142
|
$(this).sortable({
|
|
143
143
|
handle: 'div.dragger',
|
|
@@ -148,11 +148,11 @@ $.CMS = function(){
|
|
|
148
148
|
})
|
|
149
149
|
});
|
|
150
150
|
},
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
enable_page_save_widget : function(){
|
|
153
153
|
$('#page_save input').attr('checked', $('input#cms_page_is_published').is(':checked'));
|
|
154
154
|
$('#page_save button').html($('input#cms_page_submit').val());
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
$('#page_save input').bind('click', function(){
|
|
157
157
|
$('input#cms_page_is_published').attr('checked', $(this).is(':checked'));
|
|
158
158
|
})
|
|
@@ -163,7 +163,7 @@ $.CMS = function(){
|
|
|
163
163
|
$('input#cms_page_submit').click();
|
|
164
164
|
})
|
|
165
165
|
},
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
enable_page_save_form : function(){
|
|
168
168
|
$('input[name=commit]').click(function() {
|
|
169
169
|
$(this).parents('form').attr('target', '');
|
|
@@ -172,7 +172,7 @@ $.CMS = function(){
|
|
|
172
172
|
$(this).parents('form').attr('target', '_blank');
|
|
173
173
|
});
|
|
174
174
|
},
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
enable_uploader : function(){
|
|
177
177
|
auth_token = $("meta[name=csrf-token]").attr('content');
|
|
178
178
|
var uploader = new plupload.Uploader({
|
|
@@ -201,4 +201,4 @@ $.CMS = function(){
|
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
}();
|
|
204
|
+
}();
|
|
@@ -40,4 +40,22 @@ class FixturesTest < ActionDispatch::IntegrationTest
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def test_fixtures_enabled_in_admin
|
|
44
|
+
ComfortableMexicanSofa.config.enable_fixtures = true
|
|
45
|
+
Cms::Layout.destroy_all
|
|
46
|
+
Cms::Page.destroy_all
|
|
47
|
+
Cms::Snippet.destroy_all
|
|
48
|
+
|
|
49
|
+
assert_difference 'Cms::Page.count', 2 do
|
|
50
|
+
assert_difference 'Cms::Layout.count', 2 do
|
|
51
|
+
assert_difference 'Cms::Snippet.count', 1 do
|
|
52
|
+
http_auth :get, '/cms-admin/pages'
|
|
53
|
+
assert_response :success
|
|
54
|
+
assert_equal 'CMS Fixtures are enabled. All changes done here will be discarded.', flash[:error]
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
43
61
|
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: comfortable_mexican_sofa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 1.2.
|
|
5
|
+
version: 1.2.3
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Oleg Khabarov
|
|
@@ -11,7 +11,7 @@ autorequire:
|
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
|
|
14
|
-
date: 2011-05-
|
|
14
|
+
date: 2011-05-16 00:00:00 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|
|
@@ -321,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
321
321
|
requirements:
|
|
322
322
|
- - ">="
|
|
323
323
|
- !ruby/object:Gem::Version
|
|
324
|
-
hash:
|
|
324
|
+
hash: -4254881136775173761
|
|
325
325
|
segments:
|
|
326
326
|
- 0
|
|
327
327
|
version: "0"
|