instance_helper.rb 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # frozen_string_literal: true
  2. module InstanceHelper
  3. def site_title
  4. Setting.site_title
  5. end
  6. def site_hostname
  7. @site_hostname ||= Addressable::URI.parse("//#{Rails.configuration.x.local_domain}").display_uri.host
  8. end
  9. def description_for_sign_up(invite = nil)
  10. safe_join([description_prefix(invite), I18n.t('auth.description.suffix')], ' ')
  11. end
  12. def instance_presenter
  13. @instance_presenter ||= InstancePresenter.new
  14. end
  15. def favicon_path(size = '48')
  16. instance_presenter.favicon&.file&.url(size)
  17. end
  18. def app_icon_path(size = '48')
  19. instance_presenter.app_icon&.file&.url(size)
  20. end
  21. def use_mask_icon?
  22. instance_presenter.app_icon.blank?
  23. end
  24. private
  25. def description_prefix(invite)
  26. if invite.present?
  27. I18n.t('auth.description.prefix_invited_by_user', name: invite.user.account.username)
  28. else
  29. I18n.t('auth.description.prefix_sign_up')
  30. end
  31. end
  32. end