Changes for page Nice Display

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

From version 28.7
edited by admin
on 2024/10/23 13:06
Change comment: There is no comment for this version
To version 29.2
edited by admin
on 2024/10/23 14:19
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -23,5 +23,5 @@
23 23   'defaultOrder': 'asc'
24 24  })
25 25  #set ($columns = ['affiliation', 'URL', "content", "tags", "tags", "tags", '_actions'])
26 -#livetable('research groups' $columns $columnsProperties $options)
26 +#livetable('research_groups' $columns $columnsProperties $options)
27 27  {{/velocity}}
XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,4 +1,4 @@
1 -const tabName = "research groups";
1 +const tabName = "research_groups";
2 2  const tagCols = [
3 3   ["Community", "KAT", "KET", "KfB", "KFN", "KFS", "KFSI", "KHuK", "RDS", "beyond ErUM"],
4 4   ["Experiment", "CMS", "ATLAS", "Belle2", "CTA", "Auger"],
... ... @@ -46,10 +46,17 @@
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 + a.title = row.doc_title;
52 + if (row.content !== "-") {
53 + a.dataset.content = row.content;
54 + a.dataset.toggle = "popover";
55 + }
52 52  
57 + row.affiliation = a.outerHTML;
58 + delete a;
59 +
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,18 @@
62 62   }
63 63  });
64 64  
72 +require(['jquery', 'bootstrap'], function($) {
73 + const ttApply = () => {
74 + $(`#${tabName} [data-toggle="popover"]`).popover({
75 + html: true,
76 + container: `#${tabName}`,
77 + trigger: "hover",
78 + });
79 + };
65 65  
81 + document.observe(`xwiki:livetable:${tabName}:displayComplete`, ttApply);
82 + ttApply();
83 +});
66 66  
85 +
86 +