comfortable_mexican_sofa 1.4.14 → 1.4.15

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 CHANGED
@@ -1 +1 @@
1
- 1.4.14
1
+ 1.4.15
@@ -34,6 +34,7 @@ protected
34
34
  end
35
35
 
36
36
  def categorize_file
37
+ return unless ComfortableMexicanSofa.config.auto_file_categorization
37
38
  category = if layout_id && layout = site.layouts.find_by_id(layout_id)
38
39
  Cms::Category.find_or_create_by_label_and_categorized_type("[layout] #{layout.slug}", 'Cms::File')
39
40
  elsif page_id && page = site.pages.find_by_id(page_id)
@@ -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.4.14"
8
+ s.version = "1.4.15"
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-09-20}
12
+ s.date = %q{2011-09-21}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -59,6 +59,10 @@ ComfortableMexicanSofa.configure do |config|
59
59
  # definition in your database.yml file
60
60
  # config.database_config = nil
61
61
 
62
+ # When enabled files upload via the side widget will get automatically categorized for
63
+ # the current layout/page/snippet (as long as it's already saved). It's disabled by default.
64
+ # config.file_categorization = false
65
+
62
66
  end
63
67
 
64
68
  # Default credentials for ComfortableMexicanSofa::HttpAuth
@@ -49,23 +49,27 @@ class ComfortableMexicanSofa::Configuration
49
49
  # in your database.yml file
50
50
  attr_accessor :database_config
51
51
 
52
+ # When enabled files upload via the side widget will get automatically categorized for
53
+ # the current layout/page/snippet (as long as it's already saved). It's disabled by default.
54
+ attr_accessor :auto_file_categorization
55
+
52
56
  # Configuration defaults
53
57
  def initialize
54
- @cms_title = 'ComfortableMexicanSofa MicroCMS'
55
- @admin_auth = 'ComfortableMexicanSofa::HttpAuth'
56
- @public_auth = 'ComfortableMexicanSofa::DummyAuth'
57
- @seed_data_path = nil
58
- @admin_route_prefix = 'cms-admin'
59
- @admin_route_redirect = ''
60
- @enable_multiple_sites = false
61
- @allow_irb = false
62
- @upload_file_options = {}
63
- @enable_fixtures = false
64
- @fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
65
- @revisions_limit = 25
66
- @locales = { :en => 'English', :es => 'Español' }
67
- @admin_locale = nil
68
- @database_config = nil
58
+ @cms_title = 'ComfortableMexicanSofa MicroCMS'
59
+ @admin_auth = 'ComfortableMexicanSofa::HttpAuth'
60
+ @public_auth = 'ComfortableMexicanSofa::DummyAuth'
61
+ @seed_data_path = nil
62
+ @admin_route_prefix = 'cms-admin'
63
+ @admin_route_redirect = ''
64
+ @allow_irb = false
65
+ @upload_file_options = {}
66
+ @enable_fixtures = false
67
+ @fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
68
+ @revisions_limit = 25
69
+ @locales = { :en => 'English', :es => 'Español' }
70
+ @admin_locale = nil
71
+ @database_config = nil
72
+ @auto_file_categorization = false
69
73
  end
70
74
 
71
75
  end
@@ -124,6 +124,7 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
124
124
  end
125
125
 
126
126
  def test_create_as_xhr_with_page_id
127
+ ComfortableMexicanSofa.config.auto_file_categorization = true
127
128
  request.env['HTTP_X_FILE_NAME'] = 'test.pdf'
128
129
  request.env['CONTENT_TYPE'] = 'application/pdf'
129
130
 
@@ -16,17 +16,18 @@ class ActiveSupport::TestCase
16
16
  # resetting default configuration
17
17
  def reset_config
18
18
  ComfortableMexicanSofa.configure do |config|
19
- config.cms_title = 'ComfortableMexicanSofa MicroCMS'
20
- config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
21
- config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
22
- config.admin_route_prefix = 'cms-admin'
23
- config.admin_route_redirect = ''
24
- config.allow_irb = false
25
- config.enable_fixtures = false
26
- config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
27
- config.revisions_limit = 25
28
- config.locales = { :en => 'English', :es => 'Español' }
29
- config.admin_locale = nil
19
+ config.cms_title = 'ComfortableMexicanSofa MicroCMS'
20
+ config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
21
+ config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
22
+ config.admin_route_prefix = 'cms-admin'
23
+ config.admin_route_redirect = ''
24
+ config.allow_irb = false
25
+ config.enable_fixtures = false
26
+ config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
27
+ config.revisions_limit = 25
28
+ config.locales = { :en => 'English', :es => 'Español' }
29
+ config.admin_locale = nil
30
+ config.auto_file_categorization = false
30
31
  end
31
32
  ComfortableMexicanSofa::HttpAuth.username = 'username'
32
33
  ComfortableMexicanSofa::HttpAuth.password = 'password'
@@ -18,6 +18,7 @@ class ConfigurationTest < ActiveSupport::TestCase
18
18
  assert_equal ({:en => 'English', :es => 'Español'}), config.locales
19
19
  assert_equal nil, config.admin_locale
20
20
  assert_equal nil, config.database_config
21
+ assert_equal false, config.auto_file_categorization
21
22
  end
22
23
 
23
24
  def test_initialization_overrides
@@ -25,7 +25,20 @@ class CmsFileTest < ActiveSupport::TestCase
25
25
  end
26
26
  end
27
27
 
28
+ def test_creation_with_layout_link_and_config_disabled
29
+ assert !ComfortableMexicanSofa.config.auto_file_categorization
30
+ assert_difference 'Cms::File.count' do
31
+ assert_no_difference ['Cms::Category.count', 'Cms::Categorization.count'] do
32
+ file = cms_sites(:default).files.create(
33
+ :file => fixture_file_upload('files/valid_image.jpg'),
34
+ :layout_id => cms_layouts(:default)
35
+ )
36
+ end
37
+ end
38
+ end
39
+
28
40
  def test_creation_with_layout_link
41
+ ComfortableMexicanSofa.config.auto_file_categorization = true
29
42
  assert_difference ['Cms::File.count', 'Cms::Category.count', 'Cms::Categorization.count'] do
30
43
  file = cms_sites(:default).files.create(
31
44
  :file => fixture_file_upload('files/valid_image.jpg'),
@@ -38,6 +51,7 @@ class CmsFileTest < ActiveSupport::TestCase
38
51
  end
39
52
 
40
53
  def test_creation_with_page_link
54
+ ComfortableMexicanSofa.config.auto_file_categorization = true
41
55
  assert_difference ['Cms::File.count', 'Cms::Category.count', 'Cms::Categorization.count'] do
42
56
  file = cms_sites(:default).files.create(
43
57
  :file => fixture_file_upload('files/valid_image.jpg'),
@@ -50,6 +64,7 @@ class CmsFileTest < ActiveSupport::TestCase
50
64
  end
51
65
 
52
66
  def test_creation_with_snippet_link
67
+ ComfortableMexicanSofa.config.auto_file_categorization = true
53
68
  assert_difference ['Cms::File.count', 'Cms::Category.count', 'Cms::Categorization.count'] do
54
69
  file = cms_sites(:default).files.create(
55
70
  :file => fixture_file_upload('files/valid_image.jpg'),
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.14
4
+ version: 1.4.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-20 00:00:00.000000000 -04:00
13
+ date: 2011-09-21 00:00:00.000000000 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &70246633386860 !ruby/object:Gem::Requirement
18
+ requirement: &70243611919920 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 3.0.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70246633386860
26
+ version_requirements: *70243611919920
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_link_to
29
- requirement: &70246633385460 !ruby/object:Gem::Requirement
29
+ requirement: &70243611919420 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 1.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70246633385460
37
+ version_requirements: *70243611919420
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: paperclip
40
- requirement: &70246633384540 !ruby/object:Gem::Requirement
40
+ requirement: &70243611918940 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: 2.3.14
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70246633384540
48
+ version_requirements: *70243611918940
49
49
  description: ''
50
50
  email: oleg@theworkinggroup.ca
51
51
  executables: []
@@ -349,7 +349,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
349
349
  version: '0'
350
350
  segments:
351
351
  - 0
352
- hash: 3075297949995048561
352
+ hash: 1685272158562817940
353
353
  required_rubygems_version: !ruby/object:Gem::Requirement
354
354
  none: false
355
355
  requirements: