branding_helper.rb 936 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. module BrandingHelper
  3. def logo_as_symbol(version = :icon)
  4. case version
  5. when :icon
  6. _logo_as_symbol_icon
  7. when :wordmark
  8. _logo_as_symbol_wordmark
  9. end
  10. end
  11. def _logo_as_symbol_wordmark
  12. content_tag(:svg, tag.use(href: '#logo-symbol-wordmark'), viewBox: '0 0 261 66', class: 'logo logo--wordmark')
  13. end
  14. def _logo_as_symbol_icon
  15. content_tag(:svg, tag.use(href: '#logo-symbol-icon'), viewBox: '0 0 79 79', class: 'logo logo--icon')
  16. end
  17. def render_logo
  18. image_pack_tag('logo.svg', alt: 'Mastodon', class: 'logo logo--icon')
  19. end
  20. def render_symbol(version = :icon)
  21. path = case version
  22. when :icon
  23. 'logo-symbol-icon.svg'
  24. when :wordmark
  25. 'logo-symbol-wordmark.svg'
  26. end
  27. render(file: Rails.root.join('app', 'javascript', 'images', path)).html_safe # rubocop:disable Rails/OutputSafety
  28. end
  29. end