Class: Middleman::MetaPages::SitemapResource
- Inherits:
-
Object
- Object
- Middleman::MetaPages::SitemapResource
- Defined in:
- lib/middleman-core/meta_pages/sitemap_resource.rb
Overview
View class for a sitemap resource
Constant Summary
Constants included from Padrino::Helpers::TagHelpers
Padrino::Helpers::TagHelpers::BOOLEAN_ATTRIBUTES, Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES, Padrino::Helpers::TagHelpers::ESCAPE_REGEXP, Padrino::Helpers::TagHelpers::ESCAPE_VALUES, Padrino::Helpers::TagHelpers::NEWLINE
Instance Method Summary collapse
- #css_classes ⇒ Object
-
#initialize(resource) ⇒ SitemapResource
constructor
A new instance of SitemapResource.
- #render ⇒ Object
-
#resource_properties ⇒ Object
A hash of label to value for all the properties we want to display.
Methods included from Padrino::Helpers::TagHelpers
#content_tag, #input_tag, #safe_content_tag, #tag
Methods included from Padrino::Helpers::OutputHelpers
#block_is_template?, #capture_html, #concat_content, #concat_safe_content, #content_for, #content_for?, handlers, included, register, #yield_content
Constructor Details
#initialize(resource) ⇒ SitemapResource
Returns a new instance of SitemapResource.
13 14 15 |
# File 'lib/middleman-core/meta_pages/sitemap_resource.rb', line 13 def initialize(resource) @resource = resource end |
Instance Method Details
#css_classes ⇒ Object
52 53 54 |
# File 'lib/middleman-core/meta_pages/sitemap_resource.rb', line 52 def css_classes ['resource'] end |
#render ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/middleman-core/meta_pages/sitemap_resource.rb', line 17 def render content_tag :div, :class => 'resource-details' do content_tag :table do content = "" resource_properties.each do |label, value| content << content_tag(:tr) do row_content = "" row_content << content_tag(:th, label) row_content << content_tag(:td, value) row_content.html_safe end end content.html_safe end end end |
#resource_properties ⇒ Object
A hash of label to value for all the properties we want to display
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/middleman-core/meta_pages/sitemap_resource.rb', line 35 def resource_properties props = { 'Path' => @resource.path, 'Build Path' => @resource.destination_path, 'URL' => content_tag(:a, @resource.url, :href => @resource.url), 'Source File' => @resource.source_file, } data = @resource.data props['Data'] = data unless data.empty? = @resource.[:options] props['Options'] = unless .empty? props end |