Tag#indentifier instead of #label
Oleg
committed Dec 09, 2011
commit e0647dadeb96c4360bebe08e604abda49da55a32
Showing 37
changed files with
126 additions
and 128 deletions
app/models/cms/block.rb
+1
-1
| @@ | @@ -21,7 +21,7 @@ class Cms::Block < ActiveRecord::Base |
| # -- Instance Methods ----------------------------------------------------- | |
| # Tag object that is using this block | |
| def tag | |
| - | @tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.label == identifier} |
| + | @tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.identifier == identifier} |
| end | |
| protected | |
app/views/cms_admin/pages/_form_blocks.html.erb
+1
-1
| @@ | @@ -1,4 +1,4 @@ |
| - | <% block_tags = @page.tags(true).select{ |t| t.is_cms_block? }.uniq_by{|t| t.label} %> |
| + | <% block_tags = @page.tags(true).select{ |t| t.is_cms_block? }.uniq_by{|t| t.identifier} %> |
| <div id='form_blocks'> | |
| <% if block_tags.empty? %> | |
comfortable_mexican_sofa/form_builder.rb b/lib/comfortable_mexican_sofa/form_builder.rb
+4
-4
| @@ | @@ -57,7 +57,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder |
| # -- Tag Field Fields ----------------------------------------------------- | |
| def default_tag_field(tag, index, options = {}) | |
| method = options.delete(:method) || :text_field_tag | |
| - | label = tag.label.to_s.titleize |
| + | label = tag.identifier.to_s.titleize |
| css_class = tag.class.to_s.demodulize.underscore | |
| content = '' | |
| @@ | @@ -81,7 +81,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder |
| else | |
| content << @template.send(method, "page[blocks_attributes][#{index}][content]", tag.content, :id => nil, :class => input_class) | |
| end | |
| - | content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.label, :id => nil) |
| + | content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil) |
| simple_field(label, content, :class => css_class) | |
| end | |
| @@ | @@ -141,8 +141,8 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder |
| @template.options_for_select(options, :selected => tag.content), | |
| :id => nil | |
| ) | |
| - | content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.label, :id => nil) |
| - | simple_field(tag.label.titleize, content, :class => tag.class.to_s.demodulize.underscore ) |
| + | content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil) |
| + | simple_field(tag.identifier.titleize, content, :class => tag.class.to_s.demodulize.underscore ) |
| end | |
| end | |
comfortable_mexican_sofa/tag.rb b/lib/comfortable_mexican_sofa/tag.rb
+12
-12
| @@ | @@ -11,7 +11,7 @@ module ComfortableMexicanSofa::Tag |
| TOKENIZER_REGEX = /(\{\{\s*cms:[^{}]*\}\})|((?:\{?[^{])+|\{+)/ | |
| attr_accessor :page, | |
| - | :label, |
| + | :identifier, |
| :params, | |
| :parent | |
| @@ | @@ -20,19 +20,19 @@ module ComfortableMexicanSofa::Tag |
| # Example: | |
| # /\{\{\s*?cms:page:(\w+)\}\}/ | |
| # will match tags like these: | |
| - | # {{cms:page:my_label}} |
| - | def regex_tag_signature(label = nil) |
| + | # {{cms:page:my_identifier}} |
| + | def regex_tag_signature(identifier = nil) |
| nil | |
| end | |
| # Initializing tag object for a particular Tag type | |
| - | # First capture group in the regex is the tag label |
| + | # First capture group in the regex is the tag identifier |
| def initialize_tag(page, tag_signature) | |
| if match = tag_signature.match(regex_tag_signature) | |
| tag = self.new | |
| - | tag.page = page |
| - | tag.label = match[1] |
| - | tag.params = match[2].to_s.split(':') |
| + | tag.page = page |
| + | tag.identifier = match[1] |
| + | tag.params = match[2].to_s.split(':') |
| tag | |
| end | |
| end | |
| @@ | @@ -42,7 +42,7 @@ module ComfortableMexicanSofa::Tag |
| # String indentifier of the tag | |
| def id | |
| - | "#{self.class.to_s.demodulize.underscore}_#{self.label}" |
| + | "#{self.class.to_s.demodulize.underscore}_#{self.identifier}" |
| end | |
| # Ancestors of this tag constructed during rendering process. | |
| @@ | @@ -54,9 +54,9 @@ module ComfortableMexicanSofa::Tag |
| # Regex that is used to identify instance of the tag | |
| # Example: | |
| - | # /<\{\s*?cms:page:tag_label\}/ |
| + | # /<\{\s*?cms:page:tag_identifier\}/ |
| def regex_tag_signature | |
| - | self.class.regex_tag_signature(label) |
| + | self.class.regex_tag_signature(identifier) |
| end | |
| # Content that is accociated with Tag instance. | |
| @@ | @@ -73,8 +73,8 @@ module ComfortableMexicanSofa::Tag |
| # Find or initialize Cms::Block object | |
| def block | |
| - | page.blocks.detect{|b| b.identifier == self.label.to_s} || |
| - | page.blocks.build(:identifier => self.label.to_s) |
| + | page.blocks.detect{|b| b.identifier == self.identifier.to_s} || |
| + | page.blocks.build(:identifier => self.identifier.to_s) |
| end | |
| # Checks if this tag is using Cms::Block | |
comfortable_mexican_sofa/tags/asset.rb b/lib/comfortable_mexican_sofa/tags/asset.rb
+6
-6
| @@ | @@ -1,23 +1,23 @@ |
| class ComfortableMexicanSofa::Tag::Asset | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:asset:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:asset:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| def content | |
| - | return unless (layout = Cms::Layout.find_by_identifier(label)) |
| + | return unless (layout = Cms::Layout.find_by_identifier(identifier)) |
| type = params[0] | |
| format = params[1] | |
| case type | |
| when 'css' | |
| - | out = "/cms-css/#{page.site.id}/#{label}.css" |
| + | out = "/cms-css/#{page.site.id}/#{identifier}.css" |
| out = "<link href='#{out}' media='screen' rel='stylesheet' type='text/css' />" if format == 'html_tag' | |
| out | |
| when 'js' | |
| - | out = "/cms-js/#{page.site.id}/#{label}.js" |
| + | out = "/cms-js/#{page.site.id}/#{identifier}.js" |
| out = "<script src='#{out}' type='text/javascript'></script>" if format == 'html_tag' | |
| out | |
| end | |
comfortable_mexican_sofa/tags/collection.rb b/lib/comfortable_mexican_sofa/tags/collection.rb
+3
-3
| @@ | @@ -7,9 +7,9 @@ class ComfortableMexicanSofa::Tag::Collection |
| # {{ cms:collection:album:foo/my_album }} | |
| # A more complete example of the above: | |
| # {{ cms:collection:album:foo/my_album:albums/show:title:slug:param_a:param_b }} | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\/\-]+/ |
| - | /\{\{\s*cms:collection:(#{label}):(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\/\-]+/ |
| + | /\{\{\s*cms:collection:(#{identifier}):(.*?)\s*\}\}/ |
| end | |
| # Class definitition. It's basically `Herp::DerpityDerp.undescore` so an example | |
comfortable_mexican_sofa/tags/field_datetime.rb b/lib/comfortable_mexican_sofa/tags/field_datetime.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::FieldDateTime | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:field:(#{label}):datetime\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:field:(#{identifier}):datetime\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/field_integer.rb b/lib/comfortable_mexican_sofa/tags/field_integer.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::FieldInteger | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:field:(#{label}):integer\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:field:(#{identifier}):integer\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/field_string.rb b/lib/comfortable_mexican_sofa/tags/field_string.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::FieldString | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:field:(#{label}):?(?:string)?\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:field:(#{identifier}):?(?:string)?\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/field_text.rb b/lib/comfortable_mexican_sofa/tags/field_text.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::FieldText | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:field:(#{label}):?(?:text)?\s*?\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:field:(#{identifier}):?(?:text)?\s*?\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/file.rb b/lib/comfortable_mexican_sofa/tags/file.rb
+5
-5
| @@ | @@ -1,21 +1,21 @@ |
| class ComfortableMexicanSofa::Tag::File | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-\.]+/ |
| - | /\{\{\s*cms:file:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-\.]+/ |
| + | /\{\{\s*cms:file:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| # Initializing Cms::File object | |
| def file | |
| - | page.site.files.detect{|f| f.file_file_name == self.label.to_s} |
| + | page.site.files.detect{|f| f.file_file_name == self.identifier.to_s} |
| end | |
| def content | |
| return unless file | |
| format = params[0] | |
| - | text = params[1] || label |
| + | text = params[1] || identifier |
| case format | |
| when 'link' | |
comfortable_mexican_sofa/tags/helper.rb b/lib/comfortable_mexican_sofa/tags/helper.rb
+4
-4
| @@ | @@ -1,13 +1,13 @@ |
| class ComfortableMexicanSofa::Tag::Helper | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:helper:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:helper:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| def content | |
| - | "<%= #{label}(#{params.collect{|p| "'#{p}'"}.join(', ')}) %>" |
| + | "<%= #{identifier}(#{params.collect{|p| "'#{p}'"}.join(', ')}) %>" |
| end | |
| end | |
| \ No newline at end of file | |
comfortable_mexican_sofa/tags/page_datetime.rb b/lib/comfortable_mexican_sofa/tags/page_datetime.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageDateTime | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page:(#{label}):datetime\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page:(#{identifier}):datetime\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/page_file.rb b/lib/comfortable_mexican_sofa/tags/page_file.rb
+5
-5
| @@ | @@ -5,9 +5,9 @@ class ComfortableMexicanSofa::Tag::PageFile |
| # {{ cms:page_file:some_label:type:params }} | |
| # Simple tag can be: | |
| # {{ cms:page_file:some_label }} | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page_file:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page_file:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| # Type of the tag controls how file is rendered | |
| @@ | @@ -32,11 +32,11 @@ class ComfortableMexicanSofa::Tag::PageFile |
| file.file.url | |
| when 'link' | |
| return '' unless file | |
| - | text = params[1] || label |
| + | text = params[1] || identifier |
| "<a href='#{file.file.url}' target='_blank'>#{text}</a>" | |
| when 'image' | |
| return '' unless file | |
| - | text = params[1] || label |
| + | text = params[1] || identifier |
| "<img src='#{file.file.url}' alt='#{text}' />" | |
| when 'partial' | |
| path = params[1] || 'partials/page_file' | |
comfortable_mexican_sofa/tags/page_files.rb b/lib/comfortable_mexican_sofa/tags/page_files.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageFiles | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page_files:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page_files:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| # Type of the tag controls how file is rendered | |
comfortable_mexican_sofa/tags/page_integer.rb b/lib/comfortable_mexican_sofa/tags/page_integer.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageInteger | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page:(#{label}):integer\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page:(#{identifier}):integer\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/page_rich_text.rb b/lib/comfortable_mexican_sofa/tags/page_rich_text.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageRichText | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page:(#{label}):rich_text\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page:(#{identifier}):rich_text\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/page_string.rb b/lib/comfortable_mexican_sofa/tags/page_string.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageString | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page:(#{label}):string\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page:(#{identifier}):string\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/page_text.rb b/lib/comfortable_mexican_sofa/tags/page_text.rb
+3
-3
| @@ | @@ -1,9 +1,9 @@ |
| class ComfortableMexicanSofa::Tag::PageText | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:page:(#{label}):?(?:text)?\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:page:(#{identifier}):?(?:text)?\s*\}\}/ |
| end | |
| def content | |
comfortable_mexican_sofa/tags/partial.rb b/lib/comfortable_mexican_sofa/tags/partial.rb
+4
-4
| @@ | @@ -1,14 +1,14 @@ |
| class ComfortableMexicanSofa::Tag::Partial | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\/\-]+/ |
| - | /\{\{\s*cms:partial:(#{label}):?(.*?)\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\/\-]+/ |
| + | /\{\{\s*cms:partial:(#{identifier}):?(.*?)\s*\}\}/ |
| end | |
| def content | |
| ps = params.collect_with_index{|p, i| ":param_#{i+1} => '#{p}'"}.join(', ') | |
| - | "<%= render :partial => '#{label}'#{ps.blank?? nil : ", :locals => {#{ps}}"} %>" |
| + | "<%= render :partial => '#{identifier}'#{ps.blank?? nil : ", :locals => {#{ps}}"} %>" |
| end | |
| end | |
| \ No newline at end of file | |
comfortable_mexican_sofa/tags/snippet.rb b/lib/comfortable_mexican_sofa/tags/snippet.rb
+5
-4
| @@ | @@ -1,14 +1,15 @@ |
| class ComfortableMexicanSofa::Tag::Snippet | |
| include ComfortableMexicanSofa::Tag | |
| - | def self.regex_tag_signature(label = nil) |
| - | label ||= /[\w\-]+/ |
| - | /\{\{\s*cms:snippet:(#{label})\s*\}\}/ |
| + | def self.regex_tag_signature(identifier = nil) |
| + | identifier ||= /[\w\-]+/ |
| + | /\{\{\s*cms:snippet:(#{identifier})\s*\}\}/ |
| end | |
| # Find or initialize Cms::Snippet object | |
| def snippet | |
| - | page.site.snippets.detect{|s| s.identifier == self.label.to_s} || page.site.snippets.build(:identifier => self.label.to_s) |
| + | page.site.snippets.detect{|s| s.identifier == self.identifier.to_s} || |
| + | page.site.snippets.build(:identifier => self.identifier.to_s) |
| end | |
| def content | |
test/unit/tag_test.rb
+3
-6
| @@ | @@ -120,16 +120,13 @@ class TagTest < ActiveSupport::TestCase |
| assert page.blocks.blank? | |
| assert page.tags.blank? | |
| page.blocks_attributes = [ | |
| - | { |
| - | :identifier => 'default_field_text', |
| + | { :identifier => 'default_field_text', |
| :content => 'new_default_field_content' | |
| }, | |
| - | { |
| - | :identifier => 'default_page_text', |
| + | { :identifier => 'default_page_text', |
| :content => "new_default_page_text_content\n{{cms:snippet:default}}" | |
| }, | |
| - | { |
| - | :identifier => 'bogus_field_that_never_will_get_rendered', |
| + | { :identifier => 'bogus_field_that_never_will_get_rendered', |
| :content => 'some_content_that_doesnot_matter' | |
| } | |
| ] | |
test/unit/tags/asset_test.rb
+1
-1
| @@ | @@ -6,7 +6,7 @@ class AssetTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::Asset.initialize_tag( | |
| cms_pages(:default), '{{ cms:asset:default:css:html_tag }}' | |
| ) | |
| - | assert_equal 'default', tag.label |
| + | assert_equal 'default', tag.identifier |
| assert_equal ['css', 'html_tag'], tag.params | |
| end | |
test/unit/tags/collection_test.rb
+2
-2
| @@ | @@ -13,7 +13,7 @@ class CollectionTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::Collection.initialize_tag( | |
| cms_pages(:default), '{{ cms:collection:snippet:cms/snippet }}' | |
| ) | |
| - | assert_equal 'snippet', tag.label |
| + | assert_equal 'snippet', tag.identifier |
| assert_equal 'Cms::Snippet', tag.collection_class | |
| assert_equal 'partials/cms/snippets', tag.collection_partial | |
| assert_equal 'label', tag.collection_title | |
| @@ | @@ -26,7 +26,7 @@ class CollectionTagTest < ActiveSupport::TestCase |
| cms_pages(:default), | |
| '{{ cms:collection:snippet:cms/snippet:path/to/partial:title:identifier:param_a:param_b }}' | |
| ) | |
| - | assert_equal 'snippet', tag.label |
| + | assert_equal 'snippet', tag.identifier |
| assert_equal 'Cms::Snippet', tag.collection_class | |
| assert_equal 'path/to/partial', tag.collection_partial | |
| assert_equal 'title', tag.collection_title | |
test/unit/tags/field_datetime_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class FieldDateTimeTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::FieldDateTime.initialize_tag( | |
| cms_pages(:default), '{{ cms:field:content:datetime }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:datetime}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:field:dash-content:datetime}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/field_integer_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class FieldIntegerTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::FieldInteger.initialize_tag( | |
| cms_pages(:default), '{{ cms:field:content:integer }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:integer}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:field:dash-content:integer}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/field_string_test.rb
+4
-4
| @@ | @@ -6,19 +6,19 @@ class FieldStringTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::FieldString.initialize_tag( | |
| cms_pages(:default), '{{ cms:field:content:string }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldString.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:string}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldString.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldString.initialize_tag( | |
| cms_pages(:default), '{{cms:field:dash-content}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/field_text_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class FieldTextTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::FieldText.initialize_tag( | |
| cms_pages(:default), '{{ cms:field:content:text }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldText.initialize_tag( | |
| cms_pages(:default), '{{cms:field:content:text}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::FieldText.initialize_tag( | |
| cms_pages(:default), '{{cms:field:dash-content:text}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/file_test.rb
+1
-1
| @@ | @@ -7,7 +7,7 @@ class FileTagTest < ActiveSupport::TestCase |
| cms_pages(:default), '{{ cms:file:sample.jpg:image:alt text }}' | |
| ) | |
| assert_equal cms_files(:default), tag.file | |
| - | assert_equal 'sample.jpg', tag.label |
| + | assert_equal 'sample.jpg', tag.identifier |
| assert_equal ['image', 'alt text'], tag.params | |
| end | |
test/unit/tags/helper_test.rb
+3
-3
| @@ | @@ -6,18 +6,18 @@ class HelperTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::Helper.initialize_tag( | |
| cms_pages(:default), '{{ cms:helper:method_name }}' | |
| ) | |
| - | assert_equal 'method_name', tag.label |
| + | assert_equal 'method_name', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::Helper.initialize_tag( | |
| cms_pages(:default), '{{ cms:helper:method-name }}' | |
| ) | |
| - | assert_equal 'method-name', tag.label |
| + | assert_equal 'method-name', tag.identifier |
| end | |
| def test_initialize_tag_with_parameters | |
| assert tag = ComfortableMexicanSofa::Tag::Helper.initialize_tag( | |
| cms_pages(:default), '{{ cms:helper:method_name:param1:param2 }}' | |
| ) | |
| - | assert_equal 'method_name', tag.label |
| + | assert_equal 'method_name', tag.identifier |
| assert_equal ['param1', 'param2'], tag.params | |
| end | |
test/unit/tags/page_datetime_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class PageDateTimeTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::PageDateTime.initialize_tag( | |
| cms_pages(:default), '{{ cms:page:content:datetime }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:datetime}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageDateTime.initialize_tag( | |
| cms_pages(:default), '{{cms:page:dash-content:datetime}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/page_integer_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class PageIntegerTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::PageInteger.initialize_tag( | |
| cms_pages(:default), '{{ cms:page:content:integer }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:integer}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageInteger.initialize_tag( | |
| cms_pages(:default), '{{cms:page:dash-content:integer}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/page_rich_text_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class PageRichTextTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::PageRichText.initialize_tag( | |
| cms_pages(:default), '{{ cms:page:content:rich_text }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageRichText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:rich_text}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageRichText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:dash-content:rich_text}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/page_string_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class PageStringTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::PageString.initialize_tag( | |
| cms_pages(:default), '{{ cms:page:content:string }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageString.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:string}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageString.initialize_tag( | |
| cms_pages(:default), '{{cms:page:dash-content:string}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/page_text_test.rb
+4
-4
| @@ | @@ -6,19 +6,19 @@ class PageTextTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag( | |
| cms_pages(:default), '{{ cms:page:content:text }}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:content:text}}' | |
| ) | |
| - | assert_equal 'content', tag.label |
| + | assert_equal 'content', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag( | |
| cms_pages(:default), '{{cms:page:dash-content}}' | |
| ) | |
| - | assert_equal 'dash-content', tag.label |
| + | assert_equal 'dash-content', tag.identifier |
| end | |
| def test_initialize_tag_failure | |
test/unit/tags/partial_test.rb
+4
-4
| @@ | @@ -6,22 +6,22 @@ class PartialTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::Partial.initialize_tag( | |
| cms_pages(:default), '{{ cms:partial:partial_name }}' | |
| ) | |
| - | assert_equal 'partial_name', tag.label |
| + | assert_equal 'partial_name', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::Partial.initialize_tag( | |
| cms_pages(:default), '{{cms:partial:path/to/partial}}' | |
| ) | |
| - | assert_equal 'path/to/partial', tag.label |
| + | assert_equal 'path/to/partial', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::Partial.initialize_tag( | |
| cms_pages(:default), '{{cms:partial:path/to/dashed-partial}}' | |
| ) | |
| - | assert_equal 'path/to/dashed-partial', tag.label |
| + | assert_equal 'path/to/dashed-partial', tag.identifier |
| end | |
| def test_initialize_tag_with_parameters | |
| assert tag = ComfortableMexicanSofa::Tag::Partial.initialize_tag( | |
| cms_pages(:default), '{{cms:partial:path/to/partial:param1:param2}}' | |
| ) | |
| - | assert tag.label = 'path/to/partial' |
| + | assert tag.identifier = 'path/to/partial' |
| assert tag.params = 'param1:param2' | |
| end | |
test/unit/tags/snippet_test.rb
+3
-3
| @@ | @@ -6,15 +6,15 @@ class SnippetTagTest < ActiveSupport::TestCase |
| assert tag = ComfortableMexicanSofa::Tag::Snippet.initialize_tag( | |
| cms_pages(:default), '{{ cms:snippet:label }}' | |
| ) | |
| - | assert_equal 'label', tag.label |
| + | assert_equal 'label', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::Snippet.initialize_tag( | |
| cms_pages(:default), '{{cms:snippet:label}}' | |
| ) | |
| - | assert_equal 'label', tag.label |
| + | assert_equal 'label', tag.identifier |
| assert tag = ComfortableMexicanSofa::Tag::Snippet.initialize_tag( | |
| cms_pages(:default), '{{cms:snippet:dash-label}}' | |
| ) | |
| - | assert_equal 'dash-label', tag.label |
| + | assert_equal 'dash-label', tag.identifier |
| end | |
| def test_initialize_tag_failure | |