2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

Use more semantic names for various tracking icons

This way they can be replaced by plugins without conflicting with other
icons. For example `circle` is used in some places that doesn't
represent `tracking`.
This commit is contained in:
Robin Ward 2017-09-01 12:14:16 -04:00
parent 46ebd0ee40
commit c6ff387ce9
6 changed files with 27 additions and 15 deletions

View file

@ -1,6 +1,14 @@
import { h } from 'virtual-dom';
let _renderers = [];
const REPLACEMENTS = {
'd-tracking': 'circle',
'd-muted': 'times-circle',
'd-regular': 'circle-o',
'd-watching': 'exclamation-circle',
'd-watching-first': 'dot-circle-o'
};
export function renderIcon(renderType, id, params) {
for (let i=0; i<_renderers.length; i++) {
let renderer = _renderers[i];
@ -44,6 +52,8 @@ registerIconRenderer({
name: 'font-awesome',
string(id, params) {
id = REPLACEMENTS[id] || id;
let tagName = params.tagName || 'i';
let html = `<${tagName} class='${faClasses(id, params)}'`;
if (params.title) { html += ` title='${I18n.t(params.title)}'`; }
@ -56,6 +66,8 @@ registerIconRenderer({
},
node(id, params) {
id = REPLACEMENTS[id] || id;
let tagName = params.tagName || 'i';
const properties = {