From e87125b63c7e7b5d763317bfcdfdd214f74c7492 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 26 Jul 2017 12:13:49 -0400 Subject: [PATCH] FEATURE: Plugins can overwrite and add support for new icons --- .../components/admin-directory-toggle.js.es6 | 2 +- .../components/admin-web-hook-status.js.es6 | 2 +- .../discourse-common/helpers/fa-icon.js.es6 | 21 +----- .../discourse-common/lib/icon-library.js.es6 | 68 +++++++++++++++++++ .../categories-admin-dropdown.js.es6 | 2 +- .../components/directory-toggle.js.es6 | 2 +- .../discourse/components/global-notice.js.es6 | 2 +- .../components/group-index-toggle.js.es6 | 2 +- .../discourse/components/input-tip.js.es6 | 2 +- .../components/notifications-button.js.es6 | 2 +- .../components/popup-input-tip.js.es6 | 2 +- .../components/tags-admin-dropdown.js.es6 | 2 +- .../topic-footer-mobile-dropdown.js.es6 | 2 +- .../discourse/components/topic-status.js.es6 | 2 +- .../controllers/full-page-search.js.es6 | 2 +- .../discourse/helpers/category-link.js.es6 | 2 +- .../discourse/helpers/fa-icon-node.js.es6 | 21 +----- .../discourse/helpers/user-status.js.es6 | 2 +- .../discourse/lib/plugin-api.js.es6 | 29 +++++++- .../discourse/widgets/actions-summary.js.es6 | 2 +- .../discourse/widgets/button.js.es6 | 2 +- .../discourse/widgets/embedded-post.js.es6 | 2 +- .../widgets/header-topic-info.js.es6 | 2 +- .../discourse/widgets/header.js.es6 | 2 +- .../discourse/widgets/home-logo.js.es6 | 2 +- .../javascripts/discourse/widgets/link.js.es6 | 2 +- .../discourse/widgets/post-admin-menu.js.es6 | 2 +- .../widgets/post-edits-indicator.js.es6 | 2 +- .../discourse/widgets/post-links.js.es6 | 2 +- .../widgets/post-small-action.js.es6 | 2 +- .../javascripts/discourse/widgets/post.js.es6 | 2 +- .../discourse/widgets/poster-name.js.es6 | 2 +- .../widgets/private-message-map.js.es6 | 2 +- .../widgets/search-menu-results.js.es6 | 2 +- .../discourse/widgets/time-gap.js.es6 | 2 +- .../discourse/widgets/topic-status.js.es6 | 2 +- .../discourse/widgets/topic-timeline.js.es6 | 2 +- .../javascripts/widgets/discourse-poll.js.es6 | 2 +- 38 files changed, 136 insertions(+), 71 deletions(-) create mode 100644 app/assets/javascripts/discourse-common/lib/icon-library.js.es6 diff --git a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 index e4d19613b53..8d43474a9d5 100644 --- a/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 +++ b/app/assets/javascripts/admin/components/admin-directory-toggle.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; export default Ember.Component.extend(bufferedRender({ diff --git a/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 b/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 index d176b5a40ab..c5f1a4a2447 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 +++ b/app/assets/javascripts/admin/components/admin-web-hook-status.js.es6 @@ -1,5 +1,5 @@ import computed from 'ember-addons/ember-computed-decorators'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; export default Ember.Component.extend(bufferedRender({ diff --git a/app/assets/javascripts/discourse-common/helpers/fa-icon.js.es6 b/app/assets/javascripts/discourse-common/helpers/fa-icon.js.es6 index 3c1f8b9b5ab..b8dc58f23a3 100644 --- a/app/assets/javascripts/discourse-common/helpers/fa-icon.js.es6 +++ b/app/assets/javascripts/discourse-common/helpers/fa-icon.js.es6 @@ -1,23 +1,8 @@ import { registerUnbound } from 'discourse-common/lib/helpers'; +import { renderIcon } from 'discourse-common/lib/icon-library'; -export function iconClasses(icon, params) { - let classes = "fa fa-" + icon; - if (params.modifier) { classes += " fa-" + params.modifier; } - if (params['class']) { classes += ' ' + params['class']; } - return classes; -} - -export function iconHTML(icon, params) { - params = params || {}; - - var html = ""; - } - return html; +export function iconHTML(id, params) { + return renderIcon('string', id, params); } registerUnbound('fa-icon', function(icon, params) { diff --git a/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 new file mode 100644 index 00000000000..04d4629d16d --- /dev/null +++ b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 @@ -0,0 +1,68 @@ +import { h } from 'virtual-dom'; +let _renderers = []; + +export function renderIcon(renderType, id, params) { + for (let i=0; i<_renderers.length; i++) { + let renderer = _renderers[i]; + let rendererForType = renderer[renderType]; + + if (rendererForType) { + let result = rendererForType(id, params || {}); + if (result) { + return result; + } + } + } +} + +export function iconHTML(id, params) { + return renderIcon('string', id, params); +} + +export function iconNode(id, params) { + return renderIcon('node', id, params); +} + +export function registerIconRenderer(renderer) { + _renderers.unshift(renderer); +} + +// Support for font awesome icons +function faClasses(id, params) { + let classNames = `fa fa-${id}`; + if (params) { + if (params.modifier) { classNames += " fa-" + params.modifier; } + if (params['class']) { classNames += ' ' + params['class']; } + } + return classNames; +} + +// default resolver is font awesome +registerIconRenderer({ + name: 'font-awesome', + + string(id, params) { + let html = `"; + } + return html; + }, + + node(id, params) { + const properties = { + className: faClasses(id, params), + attributes: { "aria-hidden": true } + }; + + if (params.title) { properties.attributes.title = params.title; } + if (params.label) { + return h('i', properties, h('span.sr-only', I18n.t(params.label))); + } else { + return h('i', properties); + } + } +}); diff --git a/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 b/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 index 8dbb4d34231..52eca3fce33 100644 --- a/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 +++ b/app/assets/javascripts/discourse/components/categories-admin-dropdown.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import DropdownButton from 'discourse/components/dropdown-button'; import computed from "ember-addons/ember-computed-decorators"; diff --git a/app/assets/javascripts/discourse/components/directory-toggle.js.es6 b/app/assets/javascripts/discourse/components/directory-toggle.js.es6 index 3f55ec0543a..8da529957a4 100644 --- a/app/assets/javascripts/discourse/components/directory-toggle.js.es6 +++ b/app/assets/javascripts/discourse/components/directory-toggle.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; export default Ember.Component.extend(bufferedRender({ diff --git a/app/assets/javascripts/discourse/components/global-notice.js.es6 b/app/assets/javascripts/discourse/components/global-notice.js.es6 index d3ae4235484..06f7e68a166 100644 --- a/app/assets/javascripts/discourse/components/global-notice.js.es6 +++ b/app/assets/javascripts/discourse/components/global-notice.js.es6 @@ -1,5 +1,5 @@ import { on } from 'ember-addons/ember-computed-decorators'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import LogsNotice from 'discourse/services/logs-notice'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; diff --git a/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 b/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 index fb7c9d24c50..f5b24684087 100644 --- a/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 +++ b/app/assets/javascripts/discourse/components/group-index-toggle.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; export default Ember.Component.extend(bufferedRender({ diff --git a/app/assets/javascripts/discourse/components/input-tip.js.es6 b/app/assets/javascripts/discourse/components/input-tip.js.es6 index 0178ad7cac5..4120544afeb 100644 --- a/app/assets/javascripts/discourse/components/input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/input-tip.js.es6 @@ -1,5 +1,5 @@ import { bufferedRender } from 'discourse-common/lib/buffered-render'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; export default Ember.Component.extend(bufferedRender({ classNameBindings: [':tip', 'good', 'bad'], diff --git a/app/assets/javascripts/discourse/components/notifications-button.js.es6 b/app/assets/javascripts/discourse/components/notifications-button.js.es6 index d01f17e43d5..7983e535664 100644 --- a/app/assets/javascripts/discourse/components/notifications-button.js.es6 +++ b/app/assets/javascripts/discourse/components/notifications-button.js.es6 @@ -1,6 +1,6 @@ import DropdownButton from 'discourse/components/dropdown-button'; import { allLevels, buttonDetails } from 'discourse/lib/notification-levels'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import computed from 'ember-addons/ember-computed-decorators'; export default DropdownButton.extend({ diff --git a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 index 59e5856db09..e3e27621f93 100644 --- a/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 +++ b/app/assets/javascripts/discourse/components/popup-input-tip.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { default as computed, observes } from 'ember-addons/ember-computed-decorators'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; diff --git a/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 b/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 index 6d1c7ae7b31..f06174d0886 100644 --- a/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 +++ b/app/assets/javascripts/discourse/components/tags-admin-dropdown.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import DropdownButton from 'discourse/components/dropdown-button'; import computed from "ember-addons/ember-computed-decorators"; diff --git a/app/assets/javascripts/discourse/components/topic-footer-mobile-dropdown.js.es6 b/app/assets/javascripts/discourse/components/topic-footer-mobile-dropdown.js.es6 index d5370e416e8..0e2329fb4c4 100644 --- a/app/assets/javascripts/discourse/components/topic-footer-mobile-dropdown.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-footer-mobile-dropdown.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import Combobox from 'discourse-common/components/combo-box'; import { observes } from 'ember-addons/ember-computed-decorators'; diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6 index bede7d57a6a..6725b1d9d7b 100644 --- a/app/assets/javascripts/discourse/components/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-status.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { bufferedRender } from 'discourse-common/lib/buffered-render'; import { escapeExpression } from 'discourse/lib/utilities'; diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index d85760f6325..f508479b83d 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -4,7 +4,7 @@ import { default as computed, observes } from 'ember-addons/ember-computed-decor import Category from 'discourse/models/category'; import { escapeExpression } from 'discourse/lib/utilities'; import { setTransient } from 'discourse/lib/page-tracker'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; const SortOrders = [ {name: I18n.t('search.relevance'), id: 0}, diff --git a/app/assets/javascripts/discourse/helpers/category-link.js.es6 b/app/assets/javascripts/discourse/helpers/category-link.js.es6 index 618eca3211a..87aa1f7d77b 100644 --- a/app/assets/javascripts/discourse/helpers/category-link.js.es6 +++ b/app/assets/javascripts/discourse/helpers/category-link.js.es6 @@ -1,5 +1,5 @@ import { registerUnbound } from 'discourse-common/lib/helpers'; -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; var get = Em.get, escapeExpression = Handlebars.Utils.escapeExpression; diff --git a/app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6 b/app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6 index 84f15420258..9b5d989f5a0 100644 --- a/app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6 +++ b/app/assets/javascripts/discourse/helpers/fa-icon-node.js.es6 @@ -1,20 +1,5 @@ -import { h } from 'virtual-dom'; -import { iconClasses } from 'discourse-common/helpers/fa-icon'; +import { renderIcon } from 'discourse-common/lib/icon-library'; -export function iconNode(icon, params) { - params = params || {}; - - const properties = { - className: iconClasses(icon, params), - attributes: { "aria-hidden": true } - }; - - if (params.title) { properties.attributes.title = params.title; } - - if (params.label) { - return h('i', properties, h('span.sr-only', I18n.t(params.label))); - } else { - return h('i', properties); - } +export function iconNode(id, params) { + return renderIcon('node', id, params); } - diff --git a/app/assets/javascripts/discourse/helpers/user-status.js.es6 b/app/assets/javascripts/discourse/helpers/user-status.js.es6 index fb1a05efeed..c1b64fe8335 100644 --- a/app/assets/javascripts/discourse/helpers/user-status.js.es6 +++ b/app/assets/javascripts/discourse/helpers/user-status.js.es6 @@ -1,4 +1,4 @@ -import { iconHTML } from 'discourse-common/helpers/fa-icon'; +import { iconHTML } from 'discourse-common/lib/icon-library'; import { htmlHelper } from 'discourse-common/lib/helpers'; import { escapeExpression } from 'discourse/lib/utilities'; diff --git a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 index 5d382e4ac04..238e0275999 100644 --- a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 +++ b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 @@ -1,4 +1,4 @@ -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { addDecorator } from 'discourse/widgets/post-cooked'; import ComposerEditor from 'discourse/components/composer-editor'; import { addButton } from 'discourse/widgets/post-menu'; @@ -19,6 +19,7 @@ import { addUserMenuGlyph } from 'discourse/widgets/user-menu'; import { addPostClassesCallback } from 'discourse/widgets/post'; import { addPostTransformCallback } from 'discourse/widgets/post-stream'; import { attachAdditionalPanel } from 'discourse/widgets/header'; +import { registerIconRenderer } from 'discourse-common/lib/icon-library'; // If you add any methods to the API ensure you bump up this number @@ -58,6 +59,32 @@ class PluginApi { return klass; } + /** + * If you want to use custom icons in your discourse application, + * you can register a renderer that will return an icon in the + * format required. + * + * For example, the follwing resolver will render a smile in the place + * of every icon on Discourse. + * + * api.registerIconRenderer({ + * name: 'smile-icons', + * + * // for the place in code that render a string + * string() { + * return ""; + * }, + * + * // for the places in code that render virtual dom elements + * node() { + * return h('i', { className: 'fa fa-smile-o' }); + * } + * }); + **/ + registerIconRenderer(fn) { + registerIconRenderer(fn); + } + /** * Used for decorating the `cooked` content of a post after it is rendered using * jQuery. diff --git a/app/assets/javascripts/discourse/widgets/actions-summary.js.es6 b/app/assets/javascripts/discourse/widgets/actions-summary.js.es6 index df852621b99..0e8212f35ad 100644 --- a/app/assets/javascripts/discourse/widgets/actions-summary.js.es6 +++ b/app/assets/javascripts/discourse/widgets/actions-summary.js.es6 @@ -1,6 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import { avatarFor } from 'discourse/widgets/post'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { h } from 'virtual-dom'; import { dateNode } from 'discourse/helpers/node'; import { userPath } from 'discourse/lib/url'; diff --git a/app/assets/javascripts/discourse/widgets/button.js.es6 b/app/assets/javascripts/discourse/widgets/button.js.es6 index 0fd705e7974..ece396abaa3 100644 --- a/app/assets/javascripts/discourse/widgets/button.js.es6 +++ b/app/assets/javascripts/discourse/widgets/button.js.es6 @@ -1,5 +1,5 @@ import { createWidget } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; const ButtonClass = { diff --git a/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 b/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 index 6f572388ab1..11036d85413 100644 --- a/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 @@ -2,7 +2,7 @@ import PostCooked from 'discourse/widgets/post-cooked'; import DecoratorHelper from 'discourse/widgets/decorator-helper'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import DiscourseURL from 'discourse/lib/url'; createWidget('post-link-arrow', { diff --git a/app/assets/javascripts/discourse/widgets/header-topic-info.js.es6 b/app/assets/javascripts/discourse/widgets/header-topic-info.js.es6 index 8a083df6608..65ae654c5df 100644 --- a/app/assets/javascripts/discourse/widgets/header-topic-info.js.es6 +++ b/app/assets/javascripts/discourse/widgets/header-topic-info.js.es6 @@ -1,6 +1,6 @@ import { applyDecorators, createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import DiscourseURL from 'discourse/lib/url'; import RawHtml from 'discourse/widgets/raw-html'; import renderTags from 'discourse/lib/render-tags'; diff --git a/app/assets/javascripts/discourse/widgets/header.js.es6 b/app/assets/javascripts/discourse/widgets/header.js.es6 index 4c8df62ae5c..600bd753084 100644 --- a/app/assets/javascripts/discourse/widgets/header.js.es6 +++ b/app/assets/javascripts/discourse/widgets/header.js.es6 @@ -1,5 +1,5 @@ import { createWidget } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { avatarImg } from 'discourse/widgets/post'; import DiscourseURL from 'discourse/lib/url'; import { wantsNewWindow } from 'discourse/lib/intercept-click'; diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 index ad4c59b26a0..c226d944eb5 100644 --- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 +++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 @@ -1,6 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { wantsNewWindow } from 'discourse/lib/intercept-click'; import DiscourseURL from 'discourse/lib/url'; diff --git a/app/assets/javascripts/discourse/widgets/link.js.es6 b/app/assets/javascripts/discourse/widgets/link.js.es6 index 4f6beef6bf2..c6426a86238 100644 --- a/app/assets/javascripts/discourse/widgets/link.js.es6 +++ b/app/assets/javascripts/discourse/widgets/link.js.es6 @@ -1,6 +1,6 @@ import { wantsNewWindow } from 'discourse/lib/intercept-click'; import { createWidget } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { h } from 'virtual-dom'; import DiscourseURL from 'discourse/lib/url'; diff --git a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 index eb868b03439..4fb293745a0 100644 --- a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 @@ -1,4 +1,4 @@ -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; diff --git a/app/assets/javascripts/discourse/widgets/post-edits-indicator.js.es6 b/app/assets/javascripts/discourse/widgets/post-edits-indicator.js.es6 index 531e4396850..7d8f4928071 100644 --- a/app/assets/javascripts/discourse/widgets/post-edits-indicator.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-edits-indicator.js.es6 @@ -1,5 +1,5 @@ import { createWidget } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { longDate } from 'discourse/lib/formatter'; import { h } from 'virtual-dom'; diff --git a/app/assets/javascripts/discourse/widgets/post-links.js.es6 b/app/assets/javascripts/discourse/widgets/post-links.js.es6 index 91821914513..69340bc86b2 100644 --- a/app/assets/javascripts/discourse/widgets/post-links.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-links.js.es6 @@ -1,4 +1,4 @@ -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; import { replaceEmoji } from 'discourse/widgets/emoji'; diff --git a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 index b128b246ce6..680a6259116 100644 --- a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 @@ -1,6 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import RawHtml from 'discourse/widgets/raw-html'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { h } from 'virtual-dom'; import { actionDescriptionHtml } from 'discourse/components/small-action'; import { avatarFor } from 'discourse/widgets/post'; diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6 index c6c9f581f4d..2652b4954af 100644 --- a/app/assets/javascripts/discourse/widgets/post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post.js.es6 @@ -1,7 +1,7 @@ import PostCooked from 'discourse/widgets/post-cooked'; import DecoratorHelper from 'discourse/widgets/decorator-helper'; import { createWidget, applyDecorators } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { transformBasicPost } from 'discourse/lib/transform-post'; import { h } from 'virtual-dom'; import DiscourseURL from 'discourse/lib/url'; diff --git a/app/assets/javascripts/discourse/widgets/poster-name.js.es6 b/app/assets/javascripts/discourse/widgets/poster-name.js.es6 index f514b9ac8bf..2bf64d738db 100644 --- a/app/assets/javascripts/discourse/widgets/poster-name.js.es6 +++ b/app/assets/javascripts/discourse/widgets/poster-name.js.es6 @@ -1,4 +1,4 @@ -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; diff --git a/app/assets/javascripts/discourse/widgets/private-message-map.js.es6 b/app/assets/javascripts/discourse/widgets/private-message-map.js.es6 index 1c43153798a..60441867e17 100644 --- a/app/assets/javascripts/discourse/widgets/private-message-map.js.es6 +++ b/app/assets/javascripts/discourse/widgets/private-message-map.js.es6 @@ -1,4 +1,4 @@ -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; import { avatarFor } from 'discourse/widgets/post'; diff --git a/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6 b/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6 index d210b2e2d99..c195c962f6b 100644 --- a/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6 +++ b/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6 @@ -3,7 +3,7 @@ import { dateNode } from 'discourse/helpers/node'; import RawHtml from 'discourse/widgets/raw-html'; import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import highlightText from 'discourse/lib/highlight-text'; class Highlighted extends RawHtml { diff --git a/app/assets/javascripts/discourse/widgets/time-gap.js.es6 b/app/assets/javascripts/discourse/widgets/time-gap.js.es6 index f2ce1cfdb93..30cfd244830 100644 --- a/app/assets/javascripts/discourse/widgets/time-gap.js.es6 +++ b/app/assets/javascripts/discourse/widgets/time-gap.js.es6 @@ -1,6 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; function description(attrs) { const daysSince = attrs.daysSince; diff --git a/app/assets/javascripts/discourse/widgets/topic-status.js.es6 b/app/assets/javascripts/discourse/widgets/topic-status.js.es6 index d0b8ac5ef64..763ce7e2160 100644 --- a/app/assets/javascripts/discourse/widgets/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-status.js.es6 @@ -1,5 +1,5 @@ import { createWidget } from 'discourse/widgets/widget'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import { h } from 'virtual-dom'; import { escapeExpression } from 'discourse/lib/utilities'; diff --git a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 index f71e7b892d5..bccb90f80f4 100644 --- a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 @@ -1,7 +1,7 @@ import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; import { relativeAge } from 'discourse/lib/formatter'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import RawHtml from 'discourse/widgets/raw-html'; const SCROLLAREA_HEIGHT = 300; diff --git a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 index 5bac8d63b86..0f087d2570d 100644 --- a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 +++ b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 @@ -1,6 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import { h } from 'virtual-dom'; -import { iconNode } from 'discourse/helpers/fa-icon-node'; +import { iconNode } from 'discourse-common/lib/icon-library'; import RawHtml from 'discourse/widgets/raw-html'; import { ajax } from 'discourse/lib/ajax'; import evenRound from "discourse/plugins/poll/lib/even-round";