Sha256: f97420efaf6152bdfaf1cc3c92520880efe8717cf6f81f0462736ed50340b1a1

Contents?: true

Size: 1.27 KB

Versions: 15

Compression:

Stored size: 1.27 KB

Contents

module EffectiveIconsHelper

  def icon(svg, options = {})
    svg = svg.to_s.chomp('.svg')

    options.reverse_merge!(nocomment: true)
    options[:class] = [options[:class], "eb-icon eb-icon-#{svg}"].compact.join(' ')

    inline_svg("icons/#{svg}.svg", options)
  end

  def icon_to(svg, url, options = {})
    link_to(icon(svg), url, options)
  end

  def new_icon_to(path, options = {})
    icon_to('plus', path, { title: 'New' }.merge(options))
  end

  def show_icon_to(path, options = {})
    icon_to('eye', path, { title: 'Show' }.merge(options))
  end

  def edit_icon_to(path, options = {})
    icon_to('edit', path, { title: 'Edit' }.merge(options))
  end

  def destroy_icon_to(path, options = {})
    defaults = { title: 'Destroy', data: { method: :delete, confirm: 'Delete this item?' } }
    icon_to('trash', path, defaults.merge(options))
  end

  def settings_icon_to(path, options = {})
    icon_to('cog', path, { title: 'Settings' }.merge(options))
  end

  def ok_icon_to(path, options = {})
    icon_to('ok', path, { title: 'OK' }.merge(options))
  end

  def approve_icon_to(path, options = {})
    icon_to('ok', path, { title: 'Approve' }.merge(options))
  end

  def remove_icon_to(path, options = {})
    icon_to('remove', path, { title: 'Remove' }.merge(options))
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
effective_bootstrap-0.0.21 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.20 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.19 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.18 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.17 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.16 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.15 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.14 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.13 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.12 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.11 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.10 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.9 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.8 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.0.7 app/helpers/effective_icons_helper.rb