Sha256: 451a7f4be0a2ce3654ec074d9fd233dbd1f18a3ab8119a3a7ece9896af4d6d1d
Contents?: true
Size: 1020 Bytes
Versions: 8
Compression:
Stored size: 1020 Bytes
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" else attributes[:class] = "tao-page" end content_tag(tag, capture(&block), attributes) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems