You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
927 B

8 years ago
8 years ago
  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 open_deletion?
  13. Setting.open_deletion
  14. end
  15. def add_rtl_body_class(other_classes)
  16. other_classes = "#{other_classes} rtl" if [:ar, :fa, :he].include?(I18n.locale)
  17. other_classes
  18. end
  19. def favicon_path
  20. env_suffix = Rails.env.production? ? '' : '-dev'
  21. "/favicon#{env_suffix}.ico"
  22. end
  23. def title
  24. Rails.env.production? ? site_title : "#{site_title} (Dev)"
  25. end
  26. def fa_icon(icon, attributes = {})
  27. class_names = attributes[:class]&.split(' ') || []
  28. class_names << 'fa'
  29. class_names += icon.split(' ').map { |cl| "fa-#{cl}" }
  30. content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
  31. end
  32. end