1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 03:15:56 +00:00

render headline labels on the client

This commit is contained in:
Andrew Dolgov
2021-02-19 15:03:48 +03:00
parent 660a1bbe01
commit 131f34648d
4 changed files with 20 additions and 18 deletions

View File

@@ -462,7 +462,7 @@ const Headlines = {
<a class="title" title="${App.escapeHtml(hl.title)}" target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.link)}">
${hl.title}</a>
<span class="author">${hl.author}</span>
${hl.labels}
${Article.renderLabels(hl.id, hl.labels)}
${hl.cdm_excerpt ? hl.cdm_excerpt : ""}
</span>
@@ -527,7 +527,7 @@ const Headlines = {
<span data-article-id="${hl.id}" class="hl-content hlMenuAttach">
<a class="title" href="${App.escapeHtml(hl.link)}">${hl.title} <span class="preview">${hl.content_preview}</span></a>
<span class="author">${hl.author}</span>
${hl.labels}
${Article.renderLabels(hl.id, hl.labels)}
</span>
</div>
<span class="feed">
@@ -1240,11 +1240,16 @@ const Headlines = {
}
}
},
// TODO: maybe this should cause article to be rendered again, although it might cause flicker etc
onLabelsUpdated: function (data) {
if (data) {
data['info-for-headlines'].forEach(function (elem) {
App.findAll(".HLLCTR-" + elem.id).forEach(function (ctr) {
ctr.innerHTML = elem.labels;
data["labels-for"].forEach((row) => {
if (this.headlines[row.id]) {
this.headlines[row.id].labels = row.labels;
}
App.findAll(`span[data-labels-for="${row.id}"]`).forEach((ctr) => {
ctr.innerHTML = Article.renderLabels(row.id, row.labels);
});
});
}