Skip to content

Commit 9086b3b

Browse files
committed
shared-icon
1 parent b8e5989 commit 9086b3b

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
228228
this.addHintFromGids(shareIcon, gids);
229229
},
230230

231+
populateMyAccessRightsIcon: function(shareIcon, myAccessRights) {
232+
const canIWrite = Boolean(myAccessRights["write"]);
233+
shareIcon.set({
234+
source: canIWrite ? osparc.dashboard.CardBase.SHARE_ICON : osparc.dashboard.CardBase.SHARED_USER,
235+
toolTipText: canIWrite ? "" : qx.locale.Manager.tr("Shared"),
236+
});
237+
},
238+
231239
addHintFromGids: function(icon, gids) {
232240
const groupsStore = osparc.store.Groups.getInstance();
233241
const groupEveryone = groupsStore.getEveryoneGroup();

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,20 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
262262
_applyAccessRights: function(value) {
263263
if (value && Object.keys(value).length) {
264264
const shareIcon = this.getChildControl("subtitle-icon");
265-
shareIcon.addListener("tap", e => {
266-
e.stopPropagation();
267-
this.openAccessRights();
268-
}, this);
269-
shareIcon.addListener("pointerdown", e => e.stopPropagation());
270-
osparc.dashboard.CardBase.populateShareIcon(shareIcon, value);
265+
if (this.isResourceType("function")) {
266+
// in case of functions, the access rights are actually myAccessRights
267+
osparc.dashboard.CardBase.populateMyAccessRightsIcon(shareIcon, value);
268+
} else {
269+
shareIcon.addListener("tap", e => {
270+
e.stopPropagation();
271+
this.openAccessRights();
272+
}, this);
273+
shareIcon.addListener("pointerdown", e => e.stopPropagation());
274+
osparc.dashboard.CardBase.populateShareIcon(shareIcon, value);
271275

272-
if (this.isResourceType("study")) {
273-
this._setStudyPermissions(value);
276+
if (this.isResourceType("study")) {
277+
this._setStudyPermissions(value);
278+
}
274279
}
275280
}
276281
},

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,20 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
257257
_applyAccessRights: function(value) {
258258
if (value && Object.keys(value).length) {
259259
const shareIcon = this.getChildControl("shared-icon");
260-
shareIcon.addListener("tap", e => {
261-
e.stopPropagation();
262-
this.openAccessRights();
263-
}, this);
264-
shareIcon.addListener("pointerdown", e => e.stopPropagation());
265-
osparc.dashboard.CardBase.populateShareIcon(shareIcon, value);
260+
if (this.isResourceType("function")) {
261+
// in case of functions, the access rights are actually myAccessRights
262+
osparc.dashboard.CardBase.populateMyAccessRightsIcon(shareIcon, value);
263+
} else {
264+
shareIcon.addListener("tap", e => {
265+
e.stopPropagation();
266+
this.openAccessRights();
267+
}, this);
268+
shareIcon.addListener("pointerdown", e => e.stopPropagation());
269+
osparc.dashboard.CardBase.populateShareIcon(shareIcon, value);
266270

267-
if (this.isResourceType("study")) {
268-
this._setStudyPermissions(value);
271+
if (this.isResourceType("study")) {
272+
this._setStudyPermissions(value);
273+
}
269274
}
270275
}
271276
},

0 commit comments

Comments
 (0)