about summary refs log tree commit diff
path: root/app/helpers/branding_helper.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-06-09 22:25:23 +0200
committerGitHub <noreply@github.com>2022-06-09 22:25:23 +0200
commit45aa5781ce611ea411e34e3b18358a9fe15f67ce (patch)
tree0db5891187dd468f8d7ef9034eb666aea4182527 /app/helpers/branding_helper.rb
parenta2871cd74719a7a5a104daaa3dcc0e2670b7c2df (diff)
Change brand color and logotypes (#18592)
- Add rake task for generating Apple/Android icons and favicons from SVG
- Add rake task for generating PNG icons and logos for e-mails from SVG
- Remove obsolete Microsoft icons and configuration
- Remove PWA shortcut icons
Diffstat (limited to 'app/helpers/branding_helper.rb')
-rw-r--r--app/helpers/branding_helper.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/helpers/branding_helper.rb b/app/helpers/branding_helper.rb
new file mode 100644
index 000000000..c91661e56
--- /dev/null
+++ b/app/helpers/branding_helper.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+module BrandingHelper
+  def logo_as_symbol(version = :icon)
+    case version
+    when :icon
+      _logo_as_symbol_icon
+    when :wordmark
+      _logo_as_symbol_wordmark
+    end
+  end
+
+  def _logo_as_symbol_wordmark
+    content_tag(:svg, tag(:use, href: '#logo-symbol-wordmark'), viewBox: '0 0 261 66', class: 'logo logo--wordmark')
+  end
+
+  def _logo_as_symbol_icon
+    content_tag(:svg, tag(:use, href: '#logo-symbol-icon'), viewBox: '0 0 79 75', class: 'logo logo--icon')
+  end
+
+  def render_logo
+    image_pack_tag('logo.svg', alt: 'Mastodon', class: 'logo logo--icon')
+  end
+
+  def render_symbol(version = :icon)
+    path = begin
+      case version
+      when :icon
+        'logo-symbol-icon.svg'
+      when :wordmark
+        'logo-symbol-wordmark.svg'
+      end
+    end
+
+    render(file: Rails.root.join('app', 'javascript', 'images', path)).html_safe # rubocop:disable Rails/OutputSafety
+  end
+end