Sha256: d0ab2c4e1762bdf1b5941aef52e9887ca0f7ffeda1ba4e478215a1e98d42f778
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module TaoOnRails module ActionView module Helpers include ::ActionView::Helpers include ::ActionView::Context def page_id controller_names = controller_path.split('/') [controller_names, action_name].compact.flatten.join('-') end def icon_tag(name, attributes = {}) if attributes[:class].present? attributes[:class] += " icon icon-#{name}" else attributes[:class] = "icon icon-#{name}" end use_tag = %Q(<use xlink:href="#icon-#{name}"/>).html_safe content_tag(:svg, use_tag, attributes).html_safe end def tao_page(tag, attributes = nil, &block) if tag.is_a? Hash attributes = tag tag = "#{page_id.dasherize}-page" end if attributes[:class].present? attributes[:class] += " tao-page #{tag}" else attributes[:class] = "tao-page #{tag}" end content_tag(tag, capture(&block), attributes) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tao_on_rails-0.6.13 | lib/tao_on_rails/action_view/helpers.rb |