Changes for page Nice Display

Last modified by Benjamin Fischer on 2025/06/04 11:55

From version 45.24
edited by Benjamin Fischer
on 2025/03/26 12:32
Change comment: There is no comment for this version
To version 47.1
edited by Benjamin Fischer
on 2025/06/04 11:55
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,8 +4,6 @@
4 4  #if ( $ntrg_tagCols == $null )
5 5  #set( $ntrg_tagCols = [["Tags", true]] )
6 6  #end
7 -#set ($shouldMinify = !$hasProgramming )
8 -#set ($discard = $xwiki.jsx.use('Research Groups.Nice Display.WebHome', {"minify": $shouldMinify}))
9 9  
10 10  #set ($columnsProperties = {
11 11   'affiliation': {"filterable":true, "sortable":true, "html":true},
... ... @@ -13,6 +13,7 @@
13 13   "content": {"type": "hidden"},
14 14   "coopDetails": {"type": "hidden"},
15 15   "coop": {"html": true},
14 + "Community": {"tooltip": "KAT - Astroparticle Physics<br/>KET - Elementary Particles Physics<br/>KfB - Accelerator Physics<br/>KFN - Research with neutrons<br/>KFS - Research with synchrotron radiation<br/>KFSI - Research with nuclear probes and ion beams<br/>KHuK - Hadron and nuclear physics<br/>RDS - German Observatory Council"},
16 16   "tags": {"sortable": false, "filterable": false, "html": true, "headerClass": "tagsCol", "aux": $ntrg_tagCols},
17 17   "doc.date": {"filterable": false, "displayName": "Last Updated"},
18 18   '_actions': {"actions":["view","edit"]}
... ... @@ -34,24 +34,5 @@
34 34  #livetable("research_groups" $columns $columnsProperties $options)
35 35  {{/velocity}}
36 36  
37 -(% id="howto" %)
38 -== How-To Add/Update Entries ==
36 +{{include reference="Applications.Helpers.Howto Modify Footer.WebHome"}}
39 39  
40 -You need to be logged in to perform any modifications.
41 -
42 -=== Add entry ===
43 -
44 -1. click {{html}}<button class="btn"><i class="fa fa-plus"/>Create</button>{{/html}} (top right)
45 -1. fill in the Title in the top left (must be unique)
46 -1. click {{html}}<button class="btn btn-primary">Create</button>{{/html}} (bottom left)
47 -1. fill out the form
48 -1. click {{html}}<button class="btn btn-primary">Save & View</button>{{/html}} (bottom left)
49 -1. add tags (bottom left): click on the [+] behind: "Tags:"
50 -
51 -=== Modfiy entry ===
52 -
53 -1. click on {{icon name="pencil"/}} Edit
54 -1. update the form
55 -1. click {{html}}<button class="btn btn-primary">Save & View</button>{{/html}} (bottom left)
56 -1. update the Tags (bottom left)
57 -
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,1 +1,0 @@
1 -default
Code
... ... @@ -1,86 +1,0 @@
1 -(()=>{
2 - const tabName = "research_groups";
3 - let tagCols;
4 -
5 - document.observe('xwiki:livetable:loading', () => {
6 - const mats = document.getElementById(tabName);
7 - if (!mats) return;
8 -
9 - // coulmn data sources
10 - const conf = JSON.parse(mats.dataset.settings);
11 - tagCols = (conf.columnDescriptors.tags ?? {aux: []}).aux ?? [["Tags", true]];
12 - tagCols.forEach(([name], i) => {
13 - const cn = `tags-${i}`;
14 - conf.columns.splice(conf.columns.indexOf("tags"), 1, cn);
15 - conf.columnDescriptors[cn] = {
16 - displayName: name,
17 - headerClass: "tagsCol",
18 - html: true,
19 - sortable: false,
20 - };
21 - });
22 - mats.dataset.settings = JSON.stringify(conf);
23 -
24 - // column headers
25 - mats.querySelectorAll(".xwiki-livetable-display-header .tagsCol").forEach(
26 - (v, i) => v.textContent = tagCols[i][0]
27 - );
28 -
29 - // handle clicks for tags
30 - document.getElementById(`${tabName}-display`).addEventListener("click", ev => {
31 - if (ev.button) return; // only left click
32 - if (ev.target.nodeName !== "SPAN") return;
33 - if (!ev.target.classList.contains("ltTag")) return;
34 - const tag = ev.target.textContent;
35 - ev.preventDefault();
36 - const lt = mats.__liveTable;
37 - const st = lt.tagCloud.selectedTags;
38 - if (tag in st) delete st[tag];
39 - else st[tag] = {};
40 - lt.tags = Object.keys(st);
41 - lt.clearCache();
42 - lt.showRows(1, lt.limit);
43 - })
44 - });
45 -
46 - document.observe(`xwiki:livetable:${tabName}:receivedEntries`, ({memo: {data}}) => {
47 - for (const row of data.rows) {
48 - const a = new Element("a", { href: row.URL });
49 - a.innerHTML = row.affiliation_value.split("\n").map((a, i) => i ? a : `<b class="wikiexternallink">${a}</b>`).join("<br/>");
50 - a.title = row.doc_title;
51 - if (row.content !== "-") {
52 - a.dataset.content = row.content;
53 - a.dataset.toggle = "popover";
54 - }
55 -
56 - row.affiliation = a.outerHTML;
57 -
58 - row.doc_date = row.doc_date.split(" ")[0].split("/").slice(0, 2).join("/");
59 -
60 - // tags
61 - const tags = new Set(row.tags_value.slice(1, -1).split(", "));
62 - tagCols.forEach(([name, ...want], i) =>
63 - row[`tags-${i}`] = (
64 - want[0] === true
65 - ? Array.from(tags)
66 - : want.filter(tag => tags.delete(tag))
67 - ).sort().map(tag => `<span class="ltTag" style="cursor:pointer;">${tag}</span>`).join(", ")
68 - );
69 - }
70 - });
71 -
72 - require(['jquery', 'bootstrap'], function($) {
73 - document.styleSheets[0].insertRule(`#mainContentArea .popover {max-width: 50%;}`);
74 -
75 - const ttApply = () => {
76 - $(`#${tabName} [data-toggle="popover"]`).popover({
77 - html: true,
78 - container: `#mainContentArea`,
79 - trigger: "hover",
80 - });
81 - };
82 -
83 - document.observe(`xwiki:livetable:${tabName}:displayComplete`, ttApply);
84 - ttApply();
85 - });
86 -})();
Name
... ... @@ -1,1 +1,0 @@
1 -Nice Table - Research Groups
Parse content
... ... @@ -1,1 +1,0 @@
1 -No
Use this extension
... ... @@ -1,1 +1,0 @@
1 -onDemand