comfortable_mexican_sofa 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -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.1"
8
+ s.version = "1.2.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-11}
12
+ s.date = %q{2011-05-13}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -7,7 +7,8 @@ ComfortableMexicanSofa.configure do |config|
7
7
  config.authentication = 'ComfortableMexicanSofa::HttpAuth'
8
8
 
9
9
  # Default url to access admin area is http://yourhost/cms-admin/
10
- # You can change 'cms-admin' to 'admin', for example.
10
+ # You can change 'cms-admin' to 'admin', for example. To disable admin area
11
+ # entirely set this to '' or nil
11
12
  # config.admin_route_prefix = 'cms-admin'
12
13
 
13
14
  # By default Cms content is served directly from the root. Change this setting
@@ -16,8 +17,7 @@ ComfortableMexicanSofa.configure do |config|
16
17
  # config.content_route_prefix = ''
17
18
 
18
19
  # Path: /cms-admin redirects to /cms-admin/pages but you can change it
19
- # You don't need to change it when changing admin_route_prefix
20
- # config.admin_route_redirect = '/cms-admin/pages'
20
+ # config.admin_route_redirect = 'pages'
21
21
 
22
22
  # If you enable this setting you'll be able to serve completely different set
23
23
  # of sites with their own layouts and pages.
data/config/routes.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  namespace :cms_admin, :path => ComfortableMexicanSofa.config.admin_route_prefix, :except => :show do
4
- get '/' => redirect(ComfortableMexicanSofa.config.admin_route_redirect)
4
+ get '/' => redirect(
5
+ "/#{ComfortableMexicanSofa.config.admin_route_prefix}/#{ComfortableMexicanSofa.config.admin_route_redirect}"
6
+ )
5
7
  resources :pages do
6
8
  member do
7
9
  match :form_blocks
@@ -26,7 +28,7 @@ Rails.application.routes.draw do
26
28
  put :revert, :on => :member
27
29
  end
28
30
  end
29
- end
31
+ end unless ComfortableMexicanSofa.config.admin_route_prefix.blank?
30
32
 
31
33
  scope :controller => :cms_content do
32
34
  prefix = ComfortableMexicanSofa.config.content_route_prefix
@@ -46,8 +46,8 @@ class ComfortableMexicanSofa::Configuration
46
46
  @authentication = 'ComfortableMexicanSofa::HttpAuth'
47
47
  @seed_data_path = nil
48
48
  @admin_route_prefix = 'cms-admin'
49
+ @admin_route_redirect = 'pages'
49
50
  @content_route_prefix = ''
50
- @admin_route_redirect = "/#{@admin_route_prefix}/pages"
51
51
  @enable_multiple_sites = false
52
52
  @allow_irb = false
53
53
  @enable_caching = true
@@ -98,7 +98,7 @@ module ComfortableMexicanSofa::Fixtures
98
98
 
99
99
  # saving
100
100
  page.blocks_attributes = blocks_attributes if blocks_attributes.present?
101
- page.save! if page.changed?
101
+ page.save! if page.changed? || blocks_attributes.present?
102
102
  page_ids << page.id
103
103
 
104
104
  # checking for nested fixtures
@@ -56,7 +56,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
56
56
  # -- Tag Field Fields -----------------------------------------------------
57
57
  def default_tag_field(tag, options = {})
58
58
  label = options[:label] || tag.label.to_s.titleize
59
- css_class = options[:css_class] || tag.class.name.underscore.downcase.idify
59
+ css_class = options[:css_class] || tag.class.to_s.demodulize.underscore
60
60
 
61
61
  field_css_class = case tag
62
62
  when ComfortableMexicanSofa::Tag::PageRichText
@@ -42,17 +42,17 @@
42
42
  .page_form_extras {
43
43
  margin-bottom: 10px;
44
44
  }
45
- .form_element.cms_tag_field_datetime .label,
46
- .form_element.cms_tag_field_integer .label,
47
- .form_element.cms_tag_field_string .label,
48
- .form_element.cms_tag_field_text .label {
45
+ .form_element.field_datetime .label,
46
+ .form_element.field_integer .label,
47
+ .form_element.field_string .label,
48
+ .form_element.field_text .label {
49
49
  border-color: #48699C;
50
50
  }
51
- .form_element.cms_tag_page_datetime .label,
52
- .form_element.cms_tag_page_integer .label,
53
- .form_element.cms_tag_page_string .label,
54
- .form_element.cms_tag_page_text .label,
55
- .form_element.cms_tag_page_rich_text .label {
51
+ .form_element.page_datetime .label,
52
+ .form_element.page_integer .label,
53
+ .form_element.page_string .label,
54
+ .form_element.page_text .label,
55
+ .form_element.page_rich_text .label {
56
56
  border-color: #3F7300;
57
57
  }
58
58
  .form_error {
@@ -31,4 +31,23 @@ class RoutingExtensionsTest < ActionDispatch::IntegrationTest
31
31
  assert_response :success
32
32
  end
33
33
 
34
+ def test_get_admin_with_admin_route_redirect
35
+ ComfortableMexicanSofa.config.admin_route_redirect = 'snippets'
36
+ load(File.expand_path('config/routes.rb', Rails.root))
37
+
38
+ http_auth :get, '/cms-admin'
39
+ assert_response :redirect
40
+ assert_redirected_to cms_admin_snippets_path
41
+ end
42
+
43
+ def test_get_admin_with_admin_route_prefix_disabled
44
+ ComfortableMexicanSofa.config.admin_route_prefix = ''
45
+ load(File.expand_path('config/routes.rb', Rails.root))
46
+
47
+ assert !respond_to?(:cms_admin_path)
48
+
49
+ http_auth :get, '/cms-admin'
50
+ assert_response 404
51
+ end
52
+
34
53
  end
data/test/test_helper.rb CHANGED
@@ -18,7 +18,7 @@ class ActiveSupport::TestCase
18
18
  config.authentication = 'ComfortableMexicanSofa::HttpAuth'
19
19
  config.admin_route_prefix = 'cms-admin'
20
20
  config.content_route_prefix = ''
21
- config.admin_route_redirect = "/cms-admin/pages"
21
+ config.admin_route_redirect = 'pages'
22
22
  config.enable_multiple_sites = false
23
23
  config.allow_irb = false
24
24
  config.enable_caching = true
@@ -8,7 +8,7 @@ class ConfigurationTest < ActiveSupport::TestCase
8
8
  assert_equal 'ComfortableMexicanSofa::HttpAuth', config.authentication
9
9
  assert_equal 'cms-admin', config.admin_route_prefix
10
10
  assert_equal '', config.content_route_prefix
11
- assert_equal '/cms-admin/pages', config.admin_route_redirect
11
+ assert_equal 'pages', config.admin_route_redirect
12
12
  assert_equal false, config.enable_multiple_sites
13
13
  assert_equal false, config.allow_irb
14
14
  assert_equal true, config.enable_caching
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.1
5
+ version: 1.2.2
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-11 00:00:00 Z
14
+ date: 2011-05-13 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: -2061797632960950114
324
+ hash: 1368989658120238952
325
325
  segments:
326
326
  - 0
327
327
  version: "0"