comfortable_mexican_sofa 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.5.1
@@ -39,6 +39,7 @@ protected
39
39
  self.files.collect{|f| f.mark_for_destruction } if single_file
40
40
  self.files.build(:site => self.page.site, :file => file)
41
41
  end
42
+
42
43
  self.content = nil unless self.content.is_a?(String)
43
44
  end
44
45
  end
@@ -18,8 +18,10 @@ class Cms::File < ActiveRecord::Base
18
18
  validates_attachment_presence :file
19
19
 
20
20
  # -- Callbacks ------------------------------------------------------------
21
- before_save :assign_label
21
+ before_save :assign_label
22
22
  before_create :assign_position
23
+ after_save :reload_page_cache
24
+ after_destroy :reload_page_cache
23
25
 
24
26
  # -- Scopes ---------------------------------------------------------------
25
27
  default_scope order(:position)
@@ -35,4 +37,10 @@ protected
35
37
  self.position = max ? max + 1 : 0
36
38
  end
37
39
 
40
+ # FIX: Terrible, but no way of creating cached page content overwise
41
+ def reload_page_cache
42
+ return unless self.block
43
+ self.block.page.save!
44
+ end
45
+
38
46
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfortable_mexican_sofa"
8
- s.version = "1.5.0"
8
+ s.version = "1.5.1"
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 = "2011-09-28"
12
+ s.date = "2011-09-29"
13
13
  s.description = ""
14
14
  s.email = "oleg@theworkinggroup.ca"
15
15
  s.extra_rdoc_files = [
@@ -142,7 +142,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
142
142
  :id => nil
143
143
  )
144
144
  content << @template.hidden_field_tag("page[blocks_attributes][#{index}][label]", tag.label, :id => nil)
145
- simple_field(tag.label, content, :class => tag.class.to_s.demodulize.underscore )
145
+ simple_field(tag.label.titleize, content, :class => tag.class.to_s.demodulize.underscore )
146
146
  end
147
147
 
148
148
  end
@@ -81,6 +81,9 @@ class CmsBlockTest < ActiveSupport::TestCase
81
81
  assert_equal nil, block.content
82
82
  assert_equal 1, block.files.count
83
83
  assert_equal 'valid_image.jpg', block.files.first.file_file_name
84
+
85
+ page.reload
86
+ assert_equal block.files.first.file.url, page.content
84
87
  end
85
88
 
86
89
  assert_no_difference ['Cms::Block.count', 'Cms::File.count'] do
@@ -94,6 +97,7 @@ class CmsBlockTest < ActiveSupport::TestCase
94
97
  block = page.blocks.first
95
98
  assert_equal 1, block.files.count
96
99
  assert_equal 'invalid_file.gif', block.files.first.file_file_name
100
+ assert_equal block.files.first.file.url, page.content
97
101
  end
98
102
  end
99
103
 
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.5.0
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-28 00:00:00.000000000Z
13
+ date: 2011-09-29 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70317417314480 !ruby/object:Gem::Requirement
17
+ requirement: &70107792060400 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70317417314480
25
+ version_requirements: *70107792060400
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: active_link_to
28
- requirement: &70317417312680 !ruby/object:Gem::Requirement
28
+ requirement: &70107792059760 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70317417312680
36
+ version_requirements: *70107792059760
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: paperclip
39
- requirement: &70317417309920 !ruby/object:Gem::Requirement
39
+ requirement: &70107792058960 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 2.4.2
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70317417309920
47
+ version_requirements: *70107792058960
48
48
  description: ''
49
49
  email: oleg@theworkinggroup.ca
50
50
  executables: []
@@ -355,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
355
355
  version: '0'
356
356
  segments:
357
357
  - 0
358
- hash: -1963305696869515669
358
+ hash: -4124442329296358220
359
359
  required_rubygems_version: !ruby/object:Gem::Requirement
360
360
  none: false
361
361
  requirements: