mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 06:21:23 +00:00
feat: move account logo determination in dedicated method (#1190)
This commit is contained in:
@@ -244,7 +244,15 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def logo_url
|
||||
provider&.logo_url
|
||||
if institution_domain.present? && Setting.brand_fetch_client_id.present?
|
||||
logo_size = Setting.brand_fetch_logo_size
|
||||
|
||||
"https://cdn.brandfetch.io/#{institution_domain}/icon/fallback/lettermark/w/#{logo_size}/h/#{logo_size}?c=#{Setting.brand_fetch_client_id}"
|
||||
elsif provider&.logo_url.present?
|
||||
provider.logo_url
|
||||
elsif logo.attached?
|
||||
Rails.application.routes.url_helpers.rails_blob_path(logo, only_path: true)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_later
|
||||
|
||||
@@ -7,13 +7,16 @@
|
||||
"full" => "w-full h-full"
|
||||
} %>
|
||||
|
||||
<% if account.institution_domain.present? && Setting.brand_fetch_client_id.present? %>
|
||||
<% logo_size = Setting.brand_fetch_logo_size %>
|
||||
<%= image_tag "https://cdn.brandfetch.io/#{account.institution_domain}/icon/fallback/lettermark/w/#{logo_size}/h/#{logo_size}?c=#{Setting.brand_fetch_client_id}", class: "shrink-0 rounded-full #{size_classes[size]}" %>
|
||||
<% elsif account.logo_url.present? %>
|
||||
<%= image_tag account.logo_url, class: "shrink-0 rounded-full #{size_classes[size]}", loading: "lazy" %>
|
||||
<% elsif account.logo.attached? %>
|
||||
<%= image_tag account.logo, class: "shrink-0 rounded-full #{size_classes[size]}" %>
|
||||
<% if account.logo_url.present? %>
|
||||
<%= image_tag account.logo_url,
|
||||
class: "shrink-0 rounded-full #{size_classes[size]}",
|
||||
loading: "lazy" %>
|
||||
<% else %>
|
||||
<%= render DS::FilledIcon.new(variant: :text, hex_color: color || account.accountable.color, text: account.name, size: size, rounded: true) %>
|
||||
<%= render DS::FilledIcon.new(
|
||||
variant: :text,
|
||||
hex_color: color || account.accountable.color,
|
||||
text: account.name,
|
||||
size: size,
|
||||
rounded: true
|
||||
) %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user