Sha256: 4aae670894759b58f6187a5bf2f1021fc6382da5dc4cdfb54fa96cbb7a8cafed

Contents?: true

Size: 853 Bytes

Versions: 20

Compression:

Stored size: 853 Bytes

Contents

module IconsHelper
  #FIXME refactor names
  def status_icon(status_like)
    fa_icon *icon_for_status(status_like.to_mumuki_status)
  end

  def fixed_fa_icon(name, options={})
    fa_icon name, options.merge(class: 'fa-fw fixed-icon')
  end

  def exercise_status_icon(exercise)
    link_to exercise_status_fa_icon(exercise),
            exercise_path(exercise) if current_user?
  end

  def language_icon(language)
    tag('span', class: "fa da da-#{language.devicon} lang-icon", alt: language.name)
  end

  private

  def exercise_status_fa_icon(exercise)
    fa_icon(*icon_for_status(exercise.status_for(current_user)))
  end

  def icon_for_status(s)
    iconized = s.iconize
    [iconized[:type], class: "text-#{iconized[:class]} status-icon"]
  end

  def icon_for_read(read)
    tag('i', class: "fa fa-envelope#{read ? '-o' : ''}")
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mumuki-laboratory-5.5.0 app/helpers/icons_helper.rb
mumuki-laboratory-5.4.0 app/helpers/icons_helper.rb
mumuki-laboratory-5.3.0 app/helpers/icons_helper.rb
mumuki-laboratory-5.2.1 app/helpers/icons_helper.rb
mumuki-laboratory-5.2.0 app/helpers/icons_helper.rb
mumuki-laboratory-5.1.1 app/helpers/icons_helper.rb
mumuki-laboratory-5.1.0 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.12 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.11 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.10 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.9 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.8 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.7 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.6 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.5 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.4 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.3 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.2 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.1 app/helpers/icons_helper.rb
mumuki-laboratory-5.0.0 app/helpers/icons_helper.rb