about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/accounts_helper.rb16
-rw-r--r--app/helpers/application_helper.rb11
-rw-r--r--app/helpers/branding_helper.rb37
3 files changed, 44 insertions, 20 deletions
diff --git a/app/helpers/accounts_helper.rb b/app/helpers/accounts_helper.rb
index f0becf8bd..d2e198265 100644
--- a/app/helpers/accounts_helper.rb
+++ b/app/helpers/accounts_helper.rb
@@ -23,20 +23,20 @@ module AccountsHelper
     if user_signed_in?
       if account.id == current_user.account_id
         link_to settings_profile_url, class: 'button logo-button' do
-          safe_join([svg_logo, t('settings.edit_profile')])
+          safe_join([logo_as_symbol, t('settings.edit_profile')])
         end
       elsif current_account.following?(account) || current_account.requested?(account)
         link_to account_unfollow_path(account), class: 'button logo-button button--destructive', data: { method: :post } do
-          safe_join([svg_logo, t('accounts.unfollow')])
+          safe_join([logo_as_symbol, t('accounts.unfollow')])
         end
       elsif !(account.memorial? || account.moved?)
         link_to account_follow_path(account), class: "button logo-button#{account.blocking?(current_account) ? ' disabled' : ''}", data: { method: :post } do
-          safe_join([svg_logo, t('accounts.follow')])
+          safe_join([logo_as_symbol, t('accounts.follow')])
         end
       end
     elsif !(account.memorial? || account.moved?)
       link_to account_remote_follow_path(account), class: 'button logo-button modal-button', target: '_new' do
-        safe_join([svg_logo, t('accounts.follow')])
+        safe_join([logo_as_symbol, t('accounts.follow')])
       end
     end
   end
@@ -105,12 +105,4 @@ module AccountsHelper
 
     [prepend_stats.join(', '), account.note].join(' · ')
   end
-
-  def svg_logo
-    content_tag(:svg, tag(:use, 'xlink:href' => '#mastodon-svg-logo'), 'viewBox' => '0 0 216.4144 232.00976')
-  end
-
-  def svg_logo_full
-    content_tag(:svg, tag(:use, 'xlink:href' => '#mastodon-svg-logo-full'), 'viewBox' => '0 0 713.35878 175.8678')
-  end
 end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a4023733c..62739b964 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -99,11 +99,6 @@ module ApplicationHelper
     end
   end
 
-  def favicon_path
-    env_suffix = Rails.env.production? ? '' : '-dev'
-    "/favicon#{env_suffix}.ico"
-  end
-
   def title
     Rails.env.production? ? site_title : "#{site_title} (Dev)"
   end
@@ -147,8 +142,8 @@ module ApplicationHelper
     end
   end
 
-  def custom_emoji_tag(custom_emoji, animate = true)
-    if animate
+  def custom_emoji_tag(custom_emoji)
+    if prefers_autoplay?
       image_tag(custom_emoji.image.url, class: 'emojione', alt: ":#{custom_emoji.shortcode}:")
     else
       image_tag(custom_emoji.image.url(:static), class: 'emojione custom-emoji', alt: ":#{custom_emoji.shortcode}", 'data-original' => full_asset_url(custom_emoji.image.url), 'data-static' => full_asset_url(custom_emoji.image.url(:static)))
@@ -199,7 +194,7 @@ module ApplicationHelper
 
   def quote_wrap(text, line_width: 80, break_sequence: "\n")
     text = word_wrap(text, line_width: line_width - 2, break_sequence: break_sequence)
-    text.split("\n").map { |line| '> ' + line }.join("\n")
+    text.split("\n").map { |line| "> #{line}" }.join("\n")
   end
 
   def render_initial_state
diff --git a/app/helpers/branding_helper.rb b/app/helpers/branding_helper.rb
new file mode 100644
index 000000000..ad7702aea
--- /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 79', 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