Allow admins to configure instance favicon and logo (#30040)
This commit is contained in:
parent
b152f936c1
commit
bc24c4792d
9 changed files with 87 additions and 19 deletions
|
@ -1,21 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ManifestSerializer < ActiveModel::Serializer
|
||||
include ApplicationHelper
|
||||
include RoutingHelper
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
ICON_SIZES = %w(
|
||||
36
|
||||
48
|
||||
72
|
||||
96
|
||||
144
|
||||
192
|
||||
256
|
||||
384
|
||||
512
|
||||
).freeze
|
||||
|
||||
attributes :id, :name, :short_name,
|
||||
:icons, :theme_color, :background_color,
|
||||
:display, :start_url, :scope,
|
||||
|
@ -37,9 +26,12 @@ class ManifestSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def icons
|
||||
ICON_SIZES.map do |size|
|
||||
SiteUpload::ANDROID_ICON_SIZES.map do |size|
|
||||
src = site_icon_path('app_icon', size.to_i)
|
||||
src = URI.join(root_url, src).to_s if src.present?
|
||||
|
||||
{
|
||||
src: frontend_asset_url("icons/android-chrome-#{size}x#{size}.png"),
|
||||
src: src || frontend_asset_url("icons/android-chrome-#{size}x#{size}.png"),
|
||||
sizes: "#{size}x#{size}",
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue