client/pools: inherit option to show underscores as spaces

This commit is contained in:
Shyam Sunder
2020-06-23 12:36:26 -04:00
parent 029c112011
commit d420609f97
10 changed files with 14 additions and 15 deletions

View File

@ -30,7 +30,7 @@ class PostReadonlySidebarControl extends events.EventTarget {
canViewTags: api.hasPrivilege("tags:view"),
escapeColons: uri.escapeColons,
extractRootDomain: uri.extractRootDomain,
getPrettyTagName: misc.getPrettyTagName,
getPrettyName: misc.getPrettyName,
})
);

View File

@ -204,7 +204,7 @@ function dataURItoBlob(dataURI) {
return new Blob([data], { type: mimeString });
}
function getPrettyTagName(tag) {
function getPrettyName(tag) {
if (settings.get().tagUnderscoresAsSpaces) {
return tag.replace(/_/g, " ");
}
@ -228,5 +228,5 @@ module.exports = {
decamelize: decamelize,
escapeSearchTerm: escapeSearchTerm,
dataURItoBlob: dataURItoBlob,
getPrettyTagName: getPrettyTagName,
getPrettyName: getPrettyName,
};

View File

@ -210,7 +210,7 @@ function makePostLink(id, includeHash) {
function makeTagLink(name, includeHash, includeCount, tag) {
const category = tag ? tag.category : "unknown";
let text = misc.getPrettyTagName(name);
let text = misc.getPrettyName(name);
if (includeHash === true) {
text = "#" + text;
}
@ -235,7 +235,7 @@ function makeTagLink(name, includeHash, includeCount, tag) {
function makePoolLink(id, includeHash, includeCount, pool, name) {
const category = pool ? pool.category : "unknown";
let text = name ? name : pool.names[0];
let text = misc.getPrettyName(name ? name : pool.names[0]);
if (includeHash === true) {
text = "#" + text;
}

View File

@ -18,7 +18,7 @@ class PoolView extends events.EventTarget {
this._ctx = ctx;
ctx.pool.addEventListener("change", (e) => this._evtChange(e));
ctx.section = ctx.section || "summary";
ctx.getPrettyPoolName = misc.getPrettyPoolName;
ctx.getPrettyName = misc.getPrettyName;
this._hostNode = document.getElementById("content-holder");
this._install();

View File

@ -42,9 +42,8 @@ class SettingsView extends events.EventTarget {
tagSuggestions: this._find("tag-suggestions").checked,
autoplayVideos: this._find("autoplay-videos").checked,
postsPerPage: this._find("posts-per-page").value,
tagUnderscoresAsSpaces: this._find(
"tag-underscores-as-spaces"
).checked,
tagUnderscoresAsSpaces: this._find("underscores-as-spaces")
.checked,
},
})
);

View File

@ -18,7 +18,7 @@ class TagView extends events.EventTarget {
this._ctx = ctx;
ctx.tag.addEventListener("change", (e) => this._evtChange(e));
ctx.section = ctx.section || "summary";
ctx.getPrettyTagName = misc.getPrettyTagName;
ctx.getPrettyName = misc.getPrettyName;
this._hostNode = document.getElementById("content-holder");
this._install();