Changes for page Nice Display

Last modified by Benjamin Fischer on 2025/03/26 13:19

From version 28.5
edited by admin
on 2024/10/23 13:05
Change comment: There is no comment for this version
To version 28.12
edited by admin
on 2024/10/23 13:58
Change comment: There is no comment for this version

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -46,10 +46,18 @@
46 46  
47 47  document.observe(`xwiki:livetable:${tabName}:receivedEntries`, ({memo: {data}}) => {
48 48   for (const row of data.rows) {
49 - row.affiliation = `<a href="${row.URL}" class="wikiexternallink">`${
50 - row.affiliation_value.split("\n").map((a, i) => i ? a : `<b>${a}</b>`).join("<br/>")
51 - }`</a>`;
49 + const a = new Element("a", { href: row.URL });
50 + a.innerHTML = row.affiliation_value.split("\n").map((a, i) => i ? a : `<b class="wikiexternallink">${a}</b>`).join("<br/>");
51 + if (row.content) {
52 + a.title = row.content;
53 + a.dataset.toggle = "tooltip";
54 + //a.dataset.placement="left";
55 + //a.dataset.html="true";
56 + }
52 52  
58 + row.affiliation = a.outerHTML;
59 + delete a;
60 +
53 53   // tags
54 54   const tags = new Set(row.tags_value.slice(1, -1).split(", "));
55 55   tagCols.forEach(([name, ...want], i) =>
... ... @@ -62,5 +62,14 @@
62 62   }
63 63  });
64 64  
73 +require(['jquery', 'bootstrap'], function($) {
74 + const ttApply = () => {
75 + $(`[id='${tabName}'] [data-toggle="tooltip"]`).tooltip({ html: true, placement: "right" });
76 + };
65 65  
78 + document.observe(`xwiki:livetable:${tabName}:displayComplete`, ttApply);
79 + ttApply();
80 +});
66 66  
82 +
83 +