Skip to content

Commit dcc184d

Browse files
committed
maxChars prop
1 parent d8c5146 commit dcc184d

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

services/static-webserver/client/source/class/osparc/data/model/Conversation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ qx.Class.define("osparc.data.model.Conversation", {
5858
CONVERSATION_MESSAGE_UPDATED: "conversation:message:updated",
5959
CONVERSATION_MESSAGE_DELETED: "conversation:message:deleted",
6060
},
61+
62+
MAX_TITLE_LENGTH: 50,
6163
},
6264

6365
properties: {

services/static-webserver/client/source/class/osparc/study/ConversationPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ qx.Class.define("osparc.study.ConversationPage", {
111111
visibility: osparc.data.model.Study.canIWrite(this.__studyData["accessRights"]) ? "visible" : "excluded",
112112
});
113113
renameButton.addListener("execute", () => {
114-
const titleEditor = new osparc.widget.Renamer(tabButton.getLabel());
114+
const titleEditor = new osparc.widget.Renamer(tabButton.getLabel()).set({
115+
maxChars: osparc.data.model.Conversation.MAX_TITLE_LENGTH,
116+
});
115117
titleEditor.addListener("labelChanged", e => {
116118
titleEditor.close();
117119
const newLabel = e.getData()["newLabel"];

services/static-webserver/client/source/class/osparc/support/ConversationPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ qx.Class.define("osparc.support.ConversationPage", {
301301
if (oldName === "null") {
302302
oldName = "";
303303
}
304-
const renamer = new osparc.widget.Renamer(oldName);
304+
const renamer = new osparc.widget.Renamer(oldName).set({
305+
maxChars: osparc.data.model.Conversation.MAX_TITLE_LENGTH,
306+
});
305307
renamer.addListener("labelChanged", e => {
306308
renamer.close();
307309
const newLabel = e.getData()["newLabel"];

services/static-webserver/client/source/class/osparc/widget/Renamer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ qx.Class.define("osparc.widget.Renamer", {
6363
"labelChanged": "qx.event.type.Data"
6464
},
6565

66+
properties: {
67+
maxChars: {
68+
check: "Number",
69+
init: 50,
70+
apply: "__applyMaxChars",
71+
}
72+
},
73+
6674
members: {
6775
__save: null,
6876

@@ -104,6 +112,10 @@ qx.Class.define("osparc.widget.Renamer", {
104112
this.add(nodeLabelEditor);
105113
},
106114

115+
__applyMaxChars: function(value) {
116+
this.__addSubtitle(this.tr("%1 characters max", value));
117+
},
118+
107119
__addSubtitle: function(subtitleLabel) {
108120
if (subtitleLabel) {
109121
const subtitle = new qx.ui.basic.Label(subtitleLabel).set({

0 commit comments

Comments
 (0)