FEATURE: Calculate sprite-sheet based on currently active themes (#6973)

Previously there was only one sprite sheet, which always included icons from all themes even if they were disabled
This commit is contained in:
David Taylor
2019-02-06 15:51:23 +00:00
committed by GitHub
parent ba9cc83d4c
commit f3cfce4a93
8 changed files with 92 additions and 51 deletions

View File

@ -10,12 +10,13 @@ class SvgSpriteController < ApplicationController
no_cookies
RailsMultisite::ConnectionManagement.with_hostname(params[:hostname]) do
theme_ids = params[:theme_ids].split(",").map(&:to_i)
if SvgSprite.version != params[:version]
return redirect_to path(SvgSprite.path)
if SvgSprite.version(theme_ids) != params[:version]
return redirect_to path(SvgSprite.path(theme_ids))
end
svg_sprite = "window.__svg_sprite = #{SvgSprite.bundle.inspect};"
svg_sprite = "window.__svg_sprite = #{SvgSprite.bundle(theme_ids).inspect};"
response.headers["Last-Modified"] = 10.years.ago.httpdate
response.headers["Content-Length"] = svg_sprite.bytesize.to_s