removing content= from tags
Oleg
committed Sep 27, 2011
commit 93166c51fb07c57aa044c276cf8fef3d68e0f4a8
Showing 21
changed files with
35 additions
and 57 deletions
comfortable_mexican_sofa/form_builder.rb b/lib/comfortable_mexican_sofa/form_builder.rb
+3
-2
| @@ | @@ -118,8 +118,9 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder |
| default_tag_field(tag, :content_field_method => :text_area_tag) | |
| end | |
| - | def file(tag) |
| - | default_tag_field(tag, :content_field_method => :file_field) |
| + | def page_file(tag) |
| + | default_tag_field(tag, :content_field_method => :file_field) + |
| + | "FILES: #{tag.block.files.to_yaml}" |
| end | |
| def collection(tag) | |
comfortable_mexican_sofa/tag.rb b/lib/comfortable_mexican_sofa/tag.rb
+1
-1
| @@ | @@ -81,7 +81,7 @@ module ComfortableMexicanSofa::Tag |
| page.site.snippets.detect{|s| s.slug == self.label.to_s} || page.site.snippets.build(:slug => self.label.to_s) | |
| end | |
| - | # Initializing Cms::Upload object |
| + | # Initializing Cms::File object |
| def file | |
| page.site.files.detect{|f| f.file_file_name == self.label.to_s} | |
| end | |
comfortable_mexican_sofa/tags/field_datetime.rb b/lib/comfortable_mexican_sofa/tags/field_datetime.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::FieldDateTime |
| /\{\{\s*cms:field:(#{label}):datetime\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/field_integer.rb b/lib/comfortable_mexican_sofa/tags/field_integer.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::FieldInteger |
| /\{\{\s*cms:field:(#{label}):integer\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/field_string.rb b/lib/comfortable_mexican_sofa/tags/field_string.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::FieldString |
| /\{\{\s*cms:field:(#{label}):?(?:string)?\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/field_text.rb b/lib/comfortable_mexican_sofa/tags/field_text.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::FieldText |
| /\{\{\s*cms:field:(#{label}):?(?:text)?\s*?\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/page_datetime.rb b/lib/comfortable_mexican_sofa/tags/page_datetime.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::PageDateTime |
| /\{\{\s*cms:page:(#{label}):datetime\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/page_file.rb b/lib/comfortable_mexican_sofa/tags/page_file.rb
+13
-0
| @@ | @@ -0,0 +1,13 @@ |
| + | class ComfortableMexicanSofa::Tag::PageFile |
| + | include ComfortableMexicanSofa::Tag |
| + | |
| + | def self.regex_tag_signature(label = nil) |
| + | label ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page_file:(#{label}):?(.*?)\s*\}\}/ |
| + | end |
| + | |
| + | def content |
| + | # ... |
| + | end |
| + | |
| + | end |
| \ No newline at end of file | |
comfortable_mexican_sofa/tags/page_integer.rb b/lib/comfortable_mexican_sofa/tags/page_integer.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::PageInteger |
| /\{\{\s*cms:page:(#{label}):integer\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/page_rich_text.rb b/lib/comfortable_mexican_sofa/tags/page_rich_text.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::PageRichText |
| /\{\{\s*cms:page:(#{label}):rich_text\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/page_string.rb b/lib/comfortable_mexican_sofa/tags/page_string.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::PageString |
| /\{\{\s*cms:page:(#{label}):string\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
comfortable_mexican_sofa/tags/page_text.rb b/lib/comfortable_mexican_sofa/tags/page_text.rb
+0
-4
| @@ | @@ -6,10 +6,6 @@ class ComfortableMexicanSofa::Tag::PageText |
| /\{\{\s*cms:page:(#{label}):?(?:text)?\s*\}\}/ | |
| end | |
| - | def content=(value) |
| - | block.content = value |
| - | end |
| - | |
| def content | |
| block.content | |
| end | |
test/unit/tags/field_datetime_test.rb
+2
-2
| @@ | @@ -34,9 +34,9 @@ class FieldDateTimeTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::FieldDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:datetime}}' | |
| ) | |
| - | assert tag.content.blank? |
| + | assert tag.block.content.blank? |
| time = 2.days.ago | |
| - | tag.content = time |
| + | tag.block.content = time |
| assert_equal time, tag.content | |
| assert_equal '', tag.render | |
| end | |
test/unit/tags/field_integer_test.rb
+2
-2
| @@ | @@ -34,8 +34,8 @@ class FieldIntegerTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::FieldInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:integer}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = '5' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = '5' |
| assert_equal '5', tag.content | |
| assert_equal '', tag.render | |
| end | |
test/unit/tags/field_string_test.rb
+2
-2
| @@ | @@ -37,8 +37,8 @@ class FieldStringTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::FieldString.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = 'test_content' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = 'test_content' |
| assert_equal 'test_content', tag.content | |
| assert_equal '', tag.render | |
| end | |
test/unit/tags/field_text_test.rb
+2
-2
| @@ | @@ -33,8 +33,8 @@ class FieldTextTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::FieldText.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:text}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = 'test_content' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = 'test_content' |
| assert_equal 'test_content', tag.content | |
| assert_equal '', tag.render | |
| end | |
test/unit/tags/page_datetime_test.rb
+2
-2
| @@ | @@ -34,9 +34,9 @@ class PageDateTimeTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::PageDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:datetime}}' | |
| ) | |
| - | assert tag.content.blank? |
| + | assert tag.block.content.blank? |
| time = 2.days.ago | |
| - | tag.content = time |
| + | tag.block.content = time |
| assert_equal time, tag.content | |
| assert_equal time.to_s, tag.render | |
| end | |
test/unit/tags/page_integer_test.rb
+2
-2
| @@ | @@ -34,8 +34,8 @@ class PageIntegerTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::PageInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:integer}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = '5' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = '5' |
| assert_equal '5', tag.content | |
| assert_equal '5', tag.render | |
| end | |
test/unit/tags/page_rich_text_test.rb
+2
-2
| @@ | @@ -34,8 +34,8 @@ class PageRichTextTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::PageRichText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:rich_text}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = 'test_content' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = 'test_content' |
| assert_equal 'test_content', tag.content | |
| assert_equal 'test_content', tag.render | |
| end | |
test/unit/tags/page_string_test.rb
+2
-2
| @@ | @@ -34,8 +34,8 @@ class PageStringTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::PageString.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:string}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = 'test_content' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = 'test_content' |
| assert_equal 'test_content', tag.content | |
| assert_equal 'test_content', tag.render | |
| end | |
test/unit/tags/page_text_test.rb
+2
-2
| @@ | @@ -37,8 +37,8 @@ class PageTextTagTest < ActiveSupport::TestCase |
| tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content}}' | |
| ) | |
| - | assert tag.content.blank? |
| - | tag.content = 'test_content' |
| + | assert tag.block.content.blank? |
| + | tag.block.content = 'test_content' |
| assert_equal 'test_content', tag.content | |
| assert_equal 'test_content', tag.render | |
| end | |