Sha256: 02402c11f3db275696897b899f560d88743d4001383ea93060461d253725e065
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require 'silk_icons/info' module SilkIconsHelper BLANK_GIF = 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==' # Returns an IMG tag of the silk icon which has the given +name+. # In fact, the tag generated by this method displays a 1x1 transparent GIF image and # the requested icon is displayed as its background. # # silk_icon_tag('tick') # #=> <img alt="" class="silk_icon-tick" height="16" src="data:..." title="" width="16" /> # # Note that both width and height attributes are set to 16. # # silk_icon_tag(:tick, title: 'OK', width: 20) # #=> <img alt="" class="silk_icon-tick" height="16" src="data:..." title="OK" width="16" /> def silk_icon_tag(name, options={}) options = options.reverse_merge(alt: '', title: '') clazz = options[:class].to_s.split(/\s+/) clazz << "silk_icon-#{name}" options = options.merge(src: BLANK_GIF, width: 16, height: 16, :class => clazz.join(' ')) tag :img, options end # Renders CC BY 3.0 license tag for Silk icons. # # TODO: customizable views def silk_license_tag render 'silk_icons/license' end end
Version data entries
4 entries across 4 versions & 1 rubygems