application_helper.rb 735 B

123456789101112131415161718192021222324252627282930313233
  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 open_registrations?
  10. Setting.open_registrations
  11. end
  12. def add_rtl_body_class(other_classes)
  13. other_classes = "#{other_classes} rtl" if [:ar, :fa, :he].include?(I18n.locale)
  14. other_classes
  15. end
  16. def favicon_path
  17. env_suffix = Rails.env.production? ? '' : '-dev'
  18. "/favicon#{env_suffix}.ico"
  19. end
  20. def title
  21. Rails.env.production? ? site_title : "#{site_title} (Dev)"
  22. end
  23. def fa_icon(icon)
  24. content_tag(:i, nil, class: 'fa ' + icon.split(' ').map { |cl| "fa-#{cl}" }.join(' '))
  25. end
  26. end