闭社主体 forked from https://github.com/tootsuite/mastodon
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.

45 lines
1.0 KiB

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