comfortable_mexican_sofa 1.7.3 → 1.8.0
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/.gitignore +2 -1
- data/Gemfile +2 -9
- data/README.md +17 -9
- data/app/assets/javascripts/comfortable_mexican_sofa/admin/application.js +1 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee +147 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/codemirror.js +7 -7
- data/app/assets/stylesheets/comfortable_mexican_sofa/admin/application.css +1 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +0 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/bootstrap_overrides.css.sass +2 -0
- data/app/views/cms_admin/pages/_index_branch.html.haml +1 -1
- data/app/views/cms_admin/pages/form_blocks.js.erb +1 -1
- data/app/views/cms_admin/pages/toggle_branch.js.erb +2 -2
- data/app/views/layouts/cms_admin/_body.html.haml +1 -3
- data/app/views/layouts/cms_admin/_footer.html.haml +7 -0
- data/app/views/layouts/cms_admin/_head.html.haml +2 -3
- data/config/initializers/comfortable_mexican_sofa.rb +0 -13
- data/config/routes.rb +4 -48
- data/lib/comfortable_mexican_sofa.rb +1 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +1 -15
- data/lib/comfortable_mexican_sofa/routing.rb +59 -0
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/lib/generators/comfy/cms/cms_generator.rb +8 -0
- data/test/gemfiles/Gemfile.rails.3.1 +1 -0
- data/test/gemfiles/Gemfile.rails.3.2 +1 -0
- data/test/gemfiles/Gemfile.rails.4.0 +1 -0
- data/test/integration/render_cms_test.rb +2 -2
- data/test/test_helper.rb +3 -3
- data/test/unit/configuration_test.rb +1 -4
- metadata +7 -5
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +0 -194
- data/app/assets/stylesheets/comfortable_mexican_sofa/base_overrides.css.sass +0 -6
- data/test/integration/routing_extensions_test.rb +0 -61
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module ComfortableMexicanSofa::Routing
|
|
2
|
+
|
|
3
|
+
def self.admin(options = {})
|
|
4
|
+
options[:path] ||= 'cms-admin'
|
|
5
|
+
|
|
6
|
+
Rails.application.routes.draw do
|
|
7
|
+
namespace :cms_admin, :path => options[:path], :except => :show do
|
|
8
|
+
get '/', :to => 'base#jump'
|
|
9
|
+
resources :sites do
|
|
10
|
+
resources :pages do
|
|
11
|
+
get :form_blocks, :on => :member
|
|
12
|
+
get :toggle_branch, :on => :member
|
|
13
|
+
put :reorder, :on => :collection
|
|
14
|
+
resources :revisions, :only => [:index, :show, :revert] do
|
|
15
|
+
put :revert, :on => :member
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
resources :files do
|
|
19
|
+
put :reorder, :on => :collection
|
|
20
|
+
end
|
|
21
|
+
resources :layouts do
|
|
22
|
+
put :reorder, :on => :collection
|
|
23
|
+
resources :revisions, :only => [:index, :show, :revert] do
|
|
24
|
+
put :revert, :on => :member
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
resources :snippets do
|
|
28
|
+
put :reorder, :on => :collection
|
|
29
|
+
resources :revisions, :only => [:index, :show, :revert] do
|
|
30
|
+
put :revert, :on => :member
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
resources :categories
|
|
34
|
+
get 'dialog/:type' => 'dialogs#show', :as => 'dialog'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.content(options = {})
|
|
41
|
+
|
|
42
|
+
Rails.application.routes.draw do
|
|
43
|
+
namespace :cms_content, :path => options[:path] do
|
|
44
|
+
get 'cms-css/:site_id/:identifier' => :render_css, :as => 'css'
|
|
45
|
+
get 'cms-js/:site_id/:identifier' => :render_js, :as => 'js'
|
|
46
|
+
|
|
47
|
+
if options[:sitemap]
|
|
48
|
+
get '(:cms_path)/sitemap' => :render_sitemap,
|
|
49
|
+
:as => 'sitemap',
|
|
50
|
+
:constraints => {:format => /xml/},
|
|
51
|
+
:format => :xml
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
get '/' => :render_html, :as => 'html', :path => "(*cms_path)"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -25,6 +25,14 @@ module Comfy
|
|
|
25
25
|
'config/initializers/comfortable_mexican_sofa.rb'
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def generate_routing
|
|
29
|
+
route "
|
|
30
|
+
ComfortableMexicanSofa::Routing.admin(:path => '/cms-admin')
|
|
31
|
+
|
|
32
|
+
# Make sure this routeset is defined last
|
|
33
|
+
ComfortableMexicanSofa::Routing.content(:path => '/', :sitemap => false)"
|
|
34
|
+
end
|
|
35
|
+
|
|
28
36
|
def generate_cms_seeds
|
|
29
37
|
directory 'db/cms_fixtures', 'db/cms_fixtures'
|
|
30
38
|
end
|
|
@@ -3,6 +3,7 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
|
3
3
|
class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
4
4
|
|
|
5
5
|
def setup
|
|
6
|
+
super
|
|
6
7
|
Rails.application.routes.draw do
|
|
7
8
|
get '/render-basic' => 'render_test#render_basic'
|
|
8
9
|
get '/render-page' => 'render_test#render_page'
|
|
@@ -12,11 +13,10 @@ class RenderCmsTest < ActionDispatch::IntegrationTest
|
|
|
12
13
|
cms_pages(:child).update_attributes(:blocks_attributes => [
|
|
13
14
|
{ :identifier => 'content', :content => 'TestBlockContent' }
|
|
14
15
|
])
|
|
15
|
-
super
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def teardown
|
|
19
|
-
|
|
19
|
+
Rails.application.reload_routes!
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def create_site_b
|
data/test/test_helper.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
|
+
require 'coveralls'
|
|
4
|
+
Coveralls.wear!('rails')
|
|
5
|
+
|
|
3
6
|
ENV['RAILS_ENV'] = 'test'
|
|
4
7
|
require File.expand_path('../../config/environment', __FILE__)
|
|
5
8
|
require 'rails/test_help'
|
|
@@ -21,10 +24,7 @@ class ActiveSupport::TestCase
|
|
|
21
24
|
config.cms_title = 'ComfortableMexicanSofa CMS Engine'
|
|
22
25
|
config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
|
23
26
|
config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
|
24
|
-
config.admin_route_prefix = 'cms-admin'
|
|
25
27
|
config.admin_route_redirect = ''
|
|
26
|
-
config.use_default_routes = true
|
|
27
|
-
config.enable_sitemap = true
|
|
28
28
|
config.enable_fixtures = false
|
|
29
29
|
config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
|
|
30
30
|
config.revisions_limit = 25
|
|
@@ -4,14 +4,11 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
|
4
4
|
|
|
5
5
|
class ConfigurationTest < ActiveSupport::TestCase
|
|
6
6
|
|
|
7
|
-
def
|
|
7
|
+
def test_configuration_presence
|
|
8
8
|
assert config = ComfortableMexicanSofa.configuration
|
|
9
9
|
assert_equal 'ComfortableMexicanSofa CMS Engine', config.cms_title
|
|
10
10
|
assert_equal 'ComfortableMexicanSofa::HttpAuth', config.admin_auth
|
|
11
11
|
assert_equal 'ComfortableMexicanSofa::DummyAuth', config.public_auth
|
|
12
|
-
assert_equal 'cms-admin', config.admin_route_prefix
|
|
13
|
-
assert_equal true, config.use_default_routes
|
|
14
|
-
assert_equal true, config.enable_sitemap
|
|
15
12
|
assert_equal '', config.admin_route_redirect
|
|
16
13
|
assert_equal false, config.enable_fixtures
|
|
17
14
|
assert_equal File.expand_path('db/cms_fixtures', Rails.root), config.fixtures_path
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: comfortable_mexican_sofa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-03-
|
|
13
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
@@ -182,15 +182,16 @@ files:
|
|
|
182
182
|
- app/assets/images/comfortable_mexican_sofa/icon_site.gif
|
|
183
183
|
- app/assets/images/comfortable_mexican_sofa/icon_snippet.gif
|
|
184
184
|
- app/assets/images/comfortable_mexican_sofa/nav_arrow.png
|
|
185
|
-
- app/assets/javascripts/comfortable_mexican_sofa/application.js
|
|
185
|
+
- app/assets/javascripts/comfortable_mexican_sofa/admin/application.js
|
|
186
|
+
- app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee
|
|
186
187
|
- app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.js
|
|
187
188
|
- app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-wysihtml5.js
|
|
188
189
|
- app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap.js
|
|
189
190
|
- app/assets/javascripts/comfortable_mexican_sofa/lib/codemirror.js
|
|
190
191
|
- app/assets/javascripts/comfortable_mexican_sofa/lib/wysihtml5.js
|
|
192
|
+
- app/assets/stylesheets/comfortable_mexican_sofa/admin/application.css
|
|
191
193
|
- app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass
|
|
192
194
|
- app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass
|
|
193
|
-
- app/assets/stylesheets/comfortable_mexican_sofa/base_overrides.css.sass
|
|
194
195
|
- app/assets/stylesheets/comfortable_mexican_sofa/bootstrap_overrides.css.sass
|
|
195
196
|
- app/assets/stylesheets/comfortable_mexican_sofa/codemirror_overrides.css.sass
|
|
196
197
|
- app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.css
|
|
@@ -262,6 +263,7 @@ files:
|
|
|
262
263
|
- app/views/layouts/cms_admin.html.haml
|
|
263
264
|
- app/views/layouts/cms_admin/_body.html.haml
|
|
264
265
|
- app/views/layouts/cms_admin/_center.html.haml
|
|
266
|
+
- app/views/layouts/cms_admin/_footer.html.haml
|
|
265
267
|
- app/views/layouts/cms_admin/_head.html.haml
|
|
266
268
|
- app/views/layouts/cms_admin/_left.html.haml
|
|
267
269
|
- app/views/layouts/cms_admin/_right.html.haml
|
|
@@ -326,6 +328,7 @@ files:
|
|
|
326
328
|
- lib/comfortable_mexican_sofa/fixtures.rb
|
|
327
329
|
- lib/comfortable_mexican_sofa/form_builder.rb
|
|
328
330
|
- lib/comfortable_mexican_sofa/render_methods.rb
|
|
331
|
+
- lib/comfortable_mexican_sofa/routing.rb
|
|
329
332
|
- lib/comfortable_mexican_sofa/sitemap.rb
|
|
330
333
|
- lib/comfortable_mexican_sofa/tag.rb
|
|
331
334
|
- lib/comfortable_mexican_sofa/tags/asset.rb
|
|
@@ -388,7 +391,6 @@ files:
|
|
|
388
391
|
- test/integration/fixtures_test.rb
|
|
389
392
|
- test/integration/mirrors_test.rb
|
|
390
393
|
- test/integration/render_cms_test.rb
|
|
391
|
-
- test/integration/routing_extensions_test.rb
|
|
392
394
|
- test/integration/sites_test.rb
|
|
393
395
|
- test/integration/view_hooks_test.rb
|
|
394
396
|
- test/test_helper.rb
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
//= require jquery
|
|
2
|
-
//= require jquery_ujs
|
|
3
|
-
//= require jquery-ui
|
|
4
|
-
//= require comfortable_mexican_sofa/lib/bootstrap
|
|
5
|
-
//= require comfortable_mexican_sofa/lib/codemirror
|
|
6
|
-
//= require comfortable_mexican_sofa/lib/wysihtml5
|
|
7
|
-
//= require comfortable_mexican_sofa/lib/bootstrap-wysihtml5
|
|
8
|
-
//= require comfortable_mexican_sofa/lib/bootstrap-datetimepicker
|
|
9
|
-
|
|
10
|
-
$.CMS = function(){
|
|
11
|
-
|
|
12
|
-
var current_path = window.location.pathname;
|
|
13
|
-
var admin_path_prefix = $('meta[name="cms-admin-path"]').attr('content');
|
|
14
|
-
|
|
15
|
-
$(function(){
|
|
16
|
-
$.CMS.slugify();
|
|
17
|
-
$.CMS.tree_methods();
|
|
18
|
-
$.CMS.load_page_blocks();
|
|
19
|
-
$.CMS.enable_rich_text();
|
|
20
|
-
$.CMS.enable_codemirror();
|
|
21
|
-
$.CMS.enable_date_picker();
|
|
22
|
-
$.CMS.enable_sortable_list();
|
|
23
|
-
if($('#page_new, #page_edit, #new_page, #edit_page').length) $.CMS.enable_page_form();
|
|
24
|
-
if($('#mirrors').length) $.CMS.enable_mirrors_widget();
|
|
25
|
-
if($('#form-save').length) $.CMS.enable_form_save_widget();
|
|
26
|
-
if($('.file-uploader').length) $.CMS.enable_uploader();
|
|
27
|
-
if($('.categories-widget').length) $.CMS.enable_categories_widget();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
|
|
32
|
-
enable_sortable_list: function(){
|
|
33
|
-
$('.sortable, ul.sortable ul').sortable({
|
|
34
|
-
handle: '.dragger',
|
|
35
|
-
axis: 'y',
|
|
36
|
-
update: function(){
|
|
37
|
-
$.post(current_path + '/reorder', '_method=put&'+$(this).sortable('serialize'));
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
slugify: function(){
|
|
43
|
-
$('input[data-slugify=true]').bind('keyup.cms', function() {
|
|
44
|
-
$('input[data-slug=true]').val(slugify($(this).val()));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
function slugify(str){
|
|
48
|
-
str = str.replace(/^\s+|\s+$/g, '');
|
|
49
|
-
var from = "ÀÁÄÂÃÈÉËÊÌÍÏÎÒÓÖÔÕÙÚÜÛàáäâãèéëêìíïîòóöôõùúüûÑñÇç";
|
|
50
|
-
var to = "aaaaaeeeeiiiiooooouuuuaaaaaeeeeiiiiooooouuuunncc";
|
|
51
|
-
for (var i = 0, l = from.length; i < l; i++){
|
|
52
|
-
str = str.replace(new RegExp(from[i], "g"), to[i]);
|
|
53
|
-
}
|
|
54
|
-
var chars_to_replace_with_delimiter = new RegExp('[·/,:;_]', 'g');
|
|
55
|
-
str = str.replace(chars_to_replace_with_delimiter, '-');
|
|
56
|
-
var chars_to_remove = new RegExp('[^a-zA-Z0-9 -]', 'g');
|
|
57
|
-
str = str.replace(chars_to_remove, '').replace(/\s+/g, '-').toLowerCase();
|
|
58
|
-
return str;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
// Load Page Blocks on layout change
|
|
63
|
-
load_page_blocks: function(){
|
|
64
|
-
$('select#page_layout_id').bind('change.cms', function() {
|
|
65
|
-
$.ajax({
|
|
66
|
-
url: $(this).data('url'),
|
|
67
|
-
data: ({
|
|
68
|
-
layout_id: $(this).val()
|
|
69
|
-
}),
|
|
70
|
-
complete: function(){
|
|
71
|
-
$.CMS.enable_rich_text();
|
|
72
|
-
$.CMS.enable_date_picker();
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
enable_rich_text: function(){
|
|
79
|
-
$('textarea[data-rich-text]').each(function(i, element){
|
|
80
|
-
$(element).wysihtml5({
|
|
81
|
-
'html': true,
|
|
82
|
-
'color': false,
|
|
83
|
-
'stylesheets': []
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
enable_codemirror: function(){
|
|
89
|
-
$('textarea[data-cm-mode]').each(function(i, element){
|
|
90
|
-
CodeMirror.fromTextArea(element, {
|
|
91
|
-
mode: $(element).data('cm-mode'),
|
|
92
|
-
lineWrapping: true,
|
|
93
|
-
autoCloseTags: true,
|
|
94
|
-
lineNumbers: true
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
enable_date_picker: function(){
|
|
100
|
-
$('input[type=text][data-datetime]').datetimepicker({
|
|
101
|
-
format: 'yyyy-mm-dd hh:ii',
|
|
102
|
-
minView: 'day',
|
|
103
|
-
autoclose: true
|
|
104
|
-
});
|
|
105
|
-
$('input[type=text][data-date]').datetimepicker({
|
|
106
|
-
format: 'yyyy-mm-dd',
|
|
107
|
-
minView: 'minute',
|
|
108
|
-
autoclose: true
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
tree_methods: function(){
|
|
113
|
-
$('a.tree_toggle').bind('click.cms', function() {
|
|
114
|
-
$(this).siblings('ul').toggle();
|
|
115
|
-
$(this).toggleClass('closed');
|
|
116
|
-
// object_id are set in the helper (check cms_helper.rb)
|
|
117
|
-
$.ajax({url: [current_path, object_id, 'toggle'].join('/')});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
$('ul.sortable').each(function(){
|
|
121
|
-
$(this).sortable({
|
|
122
|
-
handle: 'div.dragger',
|
|
123
|
-
axis: 'y',
|
|
124
|
-
update: function() {
|
|
125
|
-
$.post(current_path + '/reorder', '_method=put&'+$(this).sortable('serialize'));
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
enable_mirrors_widget: function(){
|
|
132
|
-
$('#mirrors select').change(function(){
|
|
133
|
-
window.location = $(this).val();
|
|
134
|
-
})
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
enable_form_save_widget : function(){
|
|
138
|
-
var widget = $('#form-save');
|
|
139
|
-
$('input', widget).prop('checked', $('input#page_is_published').is(':checked'));
|
|
140
|
-
$('button', widget).html($('input[name=commit]').val());
|
|
141
|
-
|
|
142
|
-
$('input', widget).click(function(){
|
|
143
|
-
$('input#page_is_published').prop('checked', $(this).is(':checked'));
|
|
144
|
-
});
|
|
145
|
-
$('input#page_is_published').click(function(){
|
|
146
|
-
$('input', widget).prop('checked', $(this).is(':checked'));
|
|
147
|
-
});
|
|
148
|
-
$('button', widget).click(function(){
|
|
149
|
-
$('input[name=commit]').click();
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
enable_page_form : function(){
|
|
154
|
-
$('input[name=commit]').click(function() {
|
|
155
|
-
$(this).parents('form').attr('target', '');
|
|
156
|
-
});
|
|
157
|
-
$('input[name=preview]').click(function() {
|
|
158
|
-
$(this).parents('form').attr('target', '_blank');
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
enable_uploader : function(){
|
|
163
|
-
var action = $('.file-uploader form').attr('action');
|
|
164
|
-
$('.file-uploader input[type=file]').change(function(){
|
|
165
|
-
var files = $($(this).get(0).files);
|
|
166
|
-
files.each(function(i, file){
|
|
167
|
-
var xhr = new XMLHttpRequest();
|
|
168
|
-
xhr.onreadystatechange = function(e){
|
|
169
|
-
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
170
|
-
eval(xhr.responseText);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
xhr.open('POST', action, true);
|
|
174
|
-
xhr.setRequestHeader('Accept', 'application/javascript');
|
|
175
|
-
xhr.setRequestHeader('X-CSRF-Token', $('meta[name=csrf-token]').attr('content'));
|
|
176
|
-
xhr.setRequestHeader('Content-Type', file.content_type || file.type);
|
|
177
|
-
xhr.setRequestHeader('X-File-Name', file.name);
|
|
178
|
-
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
179
|
-
xhr.send(file);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
enable_categories_widget : function(){
|
|
185
|
-
$('a', '.categories-widget .action-links').click(function(){
|
|
186
|
-
$('.categories.read', '.categories-widget').toggle();
|
|
187
|
-
$('.categories.editable', '.categories-widget').toggle();
|
|
188
|
-
$('.edit', '.categories-widget').toggle();
|
|
189
|
-
$('.done', '.categories-widget').toggle();
|
|
190
|
-
return false;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}();
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
2
|
-
|
|
3
|
-
class RoutingExtensionsTest < ActionDispatch::IntegrationTest
|
|
4
|
-
|
|
5
|
-
def teardown
|
|
6
|
-
reset_config
|
|
7
|
-
Rails.application.reload_routes!
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_get_admin_with_admin_route_prefix
|
|
11
|
-
ComfortableMexicanSofa.config.admin_route_prefix = 'custom-admin'
|
|
12
|
-
Rails.application.reload_routes!
|
|
13
|
-
|
|
14
|
-
assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
|
|
15
|
-
http_auth :get, '/cms-admin/sites'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
http_auth :get, '/custom-admin/sites'
|
|
19
|
-
assert_response :success
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_get_admin_with_admin_route_redirect
|
|
23
|
-
ComfortableMexicanSofa.config.admin_route_redirect = '/cms-admin/sites'
|
|
24
|
-
Rails.application.reload_routes!
|
|
25
|
-
|
|
26
|
-
http_auth :get, '/cms-admin'
|
|
27
|
-
assert_response :redirect
|
|
28
|
-
assert_redirected_to cms_admin_sites_path
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_get_admin_with_admin_route_prefix_disabled
|
|
32
|
-
ComfortableMexicanSofa.config.admin_route_prefix = ''
|
|
33
|
-
Rails.application.reload_routes!
|
|
34
|
-
|
|
35
|
-
assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
|
|
36
|
-
http_auth :get, '/cms-admin'
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_get_admin_with_all_routes_disabled
|
|
41
|
-
ComfortableMexicanSofa.config.use_default_routes = false
|
|
42
|
-
Rails.application.reload_routes!
|
|
43
|
-
|
|
44
|
-
assert_exception_raised ActionController::RoutingError do
|
|
45
|
-
http_auth :get, '/'
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def test_get_sitemap
|
|
50
|
-
get '/sitemap', :format => 'xml'
|
|
51
|
-
assert_response :success
|
|
52
|
-
|
|
53
|
-
ComfortableMexicanSofa.config.enable_sitemap = false
|
|
54
|
-
Rails.application.reload_routes!
|
|
55
|
-
|
|
56
|
-
assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
|
|
57
|
-
get '/sitemap', :format => 'xml'
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
end
|