application_helper.rb 681 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. module ApplicationHelper
  3. def active_nav_class(path)
  4. current_page?(path) ? 'active' : ''
  5. end
  6. def show_landing_strip?
  7. !user_signed_in? && !single_user_mode?
  8. end
  9. def add_rtl_body_class(other_classes)
  10. other_classes = "#{other_classes} rtl" if [:ar, :fa, :he].include?(I18n.locale)
  11. other_classes
  12. end
  13. def favicon_path
  14. env_suffix = Rails.env.production? ? '' : '-dev'
  15. asset_path "favicon#{env_suffix}.ico"
  16. end
  17. def title
  18. Rails.env.production? ? site_title : "#{site_title} (Dev)"
  19. end
  20. def fa_icon(icon)
  21. content_tag(:i, nil, class: 'fa ' + icon.split(' ').map { |cl| "fa-#{cl}" }.join(' '))
  22. end
  23. end