This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/app/helpers/directory-table-header-title.js
2021-06-07 12:34:01 -05:00

20 lines
629 B
JavaScript

import { registerUnbound } from "discourse-common/lib/helpers";
import I18n from "I18n";
import { iconHTML } from "discourse-common/lib/icon-library";
import { htmlSafe } from "@ember/template";
export default registerUnbound("directory-table-header-title", function (args) {
// Args should include key/values { field, labelKey, icon, translated }
let html = "";
if (args.icon) {
html += iconHTML(args.icon);
}
let labelKey = args.labelKey || `directory.${args.field}`;
html += args.translated
? args.field
: I18n.t(labelKey + "_long", { defaultValue: I18n.t(labelKey) });
return htmlSafe(html);
});