Upgrade to FontAwesome 5 (take two) (#6673)

* Add missing icons to set

* Revert FA5 revert

 This reverts commit 42572ff

* use new SVG syntax in locales

* Noscript page changes (remove login button, center "powered by" footer text)

* Cast wider net for SVG icons in settings

- include any _icon setting for SVG registry (offers better support for plugin settings)

- let themes store multiple pipe-delimited icons in a setting

- also replaces broken onebox image icon with SVG reference in cooked post processor

* interpolate icons in locales

* Fix composer whisper icon alignment

* Add support for stacked icons

* SECURITY: enforce hostname to match discourse hostname

This ensures that the hostname rails uses for various helpers always matches
the Discourse hostname

* load SVG sprite with pre-initializers

* FIX: enable caching on SVG sprites

* PERF: use JSONP for SVG sprites so they are served from CDN

This avoids needing to deal with CORS for loading of the SVG

Note, added the svg- prefix to the filename so we can quickly tell in
dev tools what the file is

* Add missing SVG sprite JSONP script to CSP

* Upgrade to FA 5.5.0

* Add support for all FA4.7 icons

- adds complete frontend and backend for renamed FA4.7 icons

- improves performance of SvgSprite.bundle and SvgSprite.all_icons

* Fix group avatar flair preview

- adds an endpoint at /svg-sprites/search/:keyword

- adds frontend ajax call that pulls icon in avatar flair preview even when it is not in subset

* Remove FA 4.7 font files
This commit is contained in:
Penar Musaraj
2018-11-26 16:49:57 -05:00
committed by GitHub
parent 818761c3a4
commit 03deda2147
163 changed files with 8226 additions and 5290 deletions

View File

@@ -246,6 +246,7 @@ module Discourse
end
require_dependency 'stylesheet/manager'
require_dependency 'svg_sprite/svg_sprite'
config.after_initialize do
# require common dependencies that are often required by plugins

View File

@@ -32,6 +32,7 @@ if defined?(Rack::MiniProfiler)
/\/letter_avatar\//,
/\/letter_avatar_proxy\//,
/\/highlight-js\//,
/\/svg-sprite\//,
/qunit/,
/srv\/status/,
/commits-widget/,

View File

@@ -538,6 +538,7 @@ en:
description: "You will never be notified of anything about new topics in this group."
flair_url: "Avatar Flair Image"
flair_url_placeholder: "(Optional) Image URL or Font Awesome class"
flair_url_description: "Use square images no smaller than 20px by 20px or FontAwesome icons (accepted formats: \"fa-icon\", \"far fa-icon\" or \"fab fa-icon\")."
flair_bg_color: "Avatar Flair Background Color"
flair_bg_color_placeholder: "(Optional) Hex color value"
flair_color: "Avatar Flair Color"
@@ -1373,7 +1374,7 @@ en:
title_too_long: "Title can't be more than {{max}} characters"
post_missing: "Post can't be empty"
post_length: "Post must be at least {{min}} characters"
try_like: 'Have you tried the <i class="fa fa-heart"></i> button?'
try_like: "Have you tried the {{heart}} button?"
category_missing: "You must choose a category"
tags_missing: "You must choose at least {{count}} tags"
@@ -2054,7 +2055,6 @@ en:
post:
quote_reply: "Quote"
edit: "<i class='fa fa-pencil'></i> {{link}} {{replyAvatar}} {{username}}"
edit_reason: "Reason: "
post_number: "post {{number}}"
wiki_last_edited_on: "wiki last edited on"
@@ -2255,7 +2255,7 @@ en:
revert: "Revert to this revision"
edit_wiki: "Edit Wiki"
edit_post: "Edit Post"
comparing_previous_to_current_out_of_total: "<strong>{{previous}}</strong> <i class='fa fa-arrows-h'></i> <strong>{{current}}</strong> / {{total}}"
comparing_previous_to_current_out_of_total: "<strong>{{previous}}</strong> {{icon}} <strong>{{current}}</strong> / {{total}}"
displays:
inline:
title: "Show the rendered output with additions and removals inline"

View File

@@ -1744,7 +1744,7 @@ en:
share_anonymized_statistics: "Share anonymized usage statistics."
auto_handle_queued_age: "Automatically handle records that are waiting to be reviewed after this many days. Flags will be ignored. Queued posts and users will be rejected. Set to 0 to disable this feature."
svg_icon_subset: "Add additional FontAwesome 5 icons that you would like to include in your assets. Use prefix 'far-' for regular icons and 'fab-' for brand icons. "
max_prints_per_hour_per_user: "Maximum number of /print page impressions (set to 0 to disable)"
full_name_required: "Full name is a required field of a user's profile."

View File

@@ -290,6 +290,7 @@ Discourse::Application.routes.draw do
post "preview" => "badges#preview"
end
end
end # admin namespace
get "email_preferences" => "email#preferences_redirect", :as => "email_preferences_redirect"
@@ -445,6 +446,9 @@ Discourse::Application.routes.draw do
# in most production settings this is bypassed
get "letter_avatar_proxy/:version/letter/:letter/:color/:size.png" => "user_avatars#show_proxy_letter"
get "svg-sprite/:hostname/svg-:version.js" => "svg_sprite#show", format: false, constraints: { hostname: /[\w\.-]+/, version: /\h{40}/ }
get "svg-sprite/search/:keyword" => "svg_sprite#search", format: false, constraints: { keyword: /[-a-z0-9\s\%]+/ }
get "highlight-js/:hostname/:version.js" => "highlight_js#show", format: false, constraints: { hostname: /[\w\.-]+/ }
get "stylesheets/:name.css.map" => "stylesheets#show_source_map", constraints: { name: /[-a-z0-9_]+/ }

View File

@@ -1732,6 +1732,12 @@ uncategorized:
default: 60
min: 0
svg_icon_subset:
default: ''
type: 'list'
list_type: 'compact'
client: true
user_preferences:
default_email_digest_frequency:
enum: 'DigestEmailSiteSetting'