Skip to content

Commit 5dc8be4

Browse files
committed
More tags
1 parent 55856a9 commit 5dc8be4

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

services/static-webserver/client/source/class/osparc/dashboard/GridButtonItem.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,18 +245,28 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
245245

246246
_applyTags: function(tags) {
247247
if (osparc.data.Permissions.getInstance().canDo("study.tag")) {
248+
const maxTags = 2;
248249
const tagsContainer = this.getChildControl("tags");
249250
tagsContainer.setVisibility(tags.length ? "visible" : "excluded");
250251
tagsContainer.removeAll();
251-
tags.forEach(tag => {
252+
for (let i=0; i<=tags.length && i<maxTags; i++) {
253+
const tag = tags[i];
252254
const tagUI = new osparc.ui.basic.Tag(tag, "searchBarFilter");
253255
tagUI.set({
254256
font: "text-12",
255257
toolTipText: this.tr("Click to filter by this Tag")
256258
});
257259
tagUI.addListener("tap", () => this.fireDataEvent("tagClicked", tag));
258260
tagsContainer.add(tagUI);
259-
});
261+
}
262+
if (tags.length > maxTags) {
263+
const moreButton = new qx.ui.basic.Label(this.tr("More...")).set({
264+
font: "text-12",
265+
backgroundColor: "strong-main",
266+
appearance: "tag",
267+
});
268+
tagsContainer.add(moreButton);
269+
}
260270
}
261271
},
262272

services/static-webserver/client/source/class/osparc/dashboard/ListButtonItem.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,11 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
253253

254254
_applyTags: function(tags) {
255255
if (osparc.data.Permissions.getInstance().canDo("study.tag")) {
256+
const maxTags = 2;
256257
const tagsContainer = this.getChildControl("tags");
257258
tagsContainer.removeAll();
258-
tags.forEach(tag => {
259+
for (let i=0; i<=tags.length && i<maxTags; i++) {
260+
const tag = tags[i];
259261
const tagUI = new osparc.ui.basic.Tag(tag, "searchBarFilter");
260262
tagUI.set({
261263
alignY: "middle",
@@ -264,7 +266,15 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
264266
});
265267
tagUI.addListener("tap", () => this.fireDataEvent("tagClicked", tag));
266268
tagsContainer.add(tagUI);
267-
});
269+
}
270+
if (tags.length > maxTags) {
271+
const moreButton = new qx.ui.basic.Label(this.tr("More...")).set({
272+
font: "text-12",
273+
backgroundColor: "strong-main",
274+
appearance: "tag",
275+
});
276+
tagsContainer.add(moreButton);
277+
}
268278
this.__makeItemResponsive(tagsContainer);
269279
}
270280
},

0 commit comments

Comments
 (0)