Skip to content

Commit

Permalink
Merge pull request #177 from jesseplusplus/branding-uploads
Browse files Browse the repository at this point in the history
Fix logo customizations to work with new admin branding settings
  • Loading branch information
jesseplusplus authored Feb 25, 2023
2 parents f3748fd + 5aa59a3 commit b2bac05
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/helpers/accounts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def account_description(account)
def svg_logo
logo_url = InstancePresenter.new.logo_transparent&.file&.url
tag = logo_url.present? ? tag(:img, 'src' => logo_url) : nil
tag || content_tag(:svg, tag(:use, 'xlink:href' => '#decodon-logo'), 'viewBox' => '0 0 216.4144 232.00976')
tag || content_tag(:svg, tag(:use, 'xlink:href' => '#decodon-flower-logo'), 'viewBox' => '0 0 216.4144 232.00976')
end

def svg_logo_full
logo_url = InstancePresenter.new.logo&.file&.url
tag = logo_url.present? ? tag(:img, 'src' => logo_url) : nil
tag || content_tag(:svg, tag(:use, 'xlink:href' => '#decodon-logo-full'), 'viewBox' => '0 0 713.35878 175.8678')
tag || content_tag(:svg, tag(:use, 'xlink:href' => '#decodon-logo'), 'viewBox' => '0 0 713.35878 175.8678')
end
end
14 changes: 9 additions & 5 deletions app/helpers/branding_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@ def logo_as_symbol(version = :icon)
end

def _logo_as_symbol_wordmark
content_tag(:svg, tag(:use, href: '#logo-symbol-wordmark'), viewBox: '0 0 261 66', class: 'logo logo--wordmark')
logo_url = InstancePresenter.new.logo&.file&.url
tag = logo_url.present? ? tag(:img, 'src' => logo_url) : nil
tag || content_tag(:svg, tag(:use, href: '#decodon-logo'), viewBox: '0 0 376 102', 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')
logo_url = InstancePresenter.new.logo&.file&.url
tag = logo_url.present? ? tag(:img, 'src' => logo_url) : nil
tag || content_tag(:svg, tag(:use, href: '#decodon-flower-logo'), viewBox: '0 0 150 150', class: 'logo logo--icon')
end

def render_logo
image_pack_tag('logo.svg', alt: 'Mastodon', class: 'logo logo--icon')
content_tag(:svg, tag(:use, href: '#decodon-flower-logo'), viewBox: '0 0 150 150', class: 'logo logo--icon')
end

def render_symbol(version = :icon)
path = begin
case version
when :icon
'logo-symbol-icon.svg'
'decodon_flower_logo.svg'
when :wordmark
'logo-symbol-wordmark.svg'
'decodon_logo_full.svg'
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/javascript/images/decodon_flower_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b2bac05

Please sign in to comment.