Sha256: 51890e5a64bc8d9e07e2de01f37cab73550176ad7c66f52f48d8743c9166312b

Contents?: true

Size: 1.34 KB

Versions: 79

Compression:

Stored size: 1.34 KB

Contents

module EffectiveIconsHelper

  # icon('check', class: 'big-4')
  # icon('check', class: 'small-3')
  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_tag("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

79 entries across 79 versions & 1 rubygems

Version Path
effective_bootstrap-0.9.48 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.47 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.46 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.45 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.44 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.43 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.42 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.41 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.40 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.39 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.38 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.37 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.36 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.35 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.34 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.33 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.32 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.31 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.30 app/helpers/effective_icons_helper.rb
effective_bootstrap-0.9.29 app/helpers/effective_icons_helper.rb