1 define(["require", "exports", "tslib", "WoltLabSuite/Core/Ui/Dialog", "WoltLabSuite/Core/Dom/Util", "WoltLabSuite/Core/Ajax", "WoltLabSuite/Core/Language", "WoltLabSuite/Core/Ui/Notification"], function (require
, exports
, tslib_1
, Dialog_1
, Util_1
, Ajax
, Language
, UiNotification
) {
3 Object
.defineProperty(exports
, "__esModule", { value
: true });
4 exports
.beginEdit
= void 0;
5 Dialog_1
= tslib_1
.__importDefault(Dialog_1
);
6 Util_1
= tslib_1
.__importDefault(Util_1
);
7 Ajax
= tslib_1
.__importStar(Ajax
);
8 Language
= tslib_1
.__importStar(Language
);
9 UiNotification
= tslib_1
.__importStar(UiNotification
);
10 class UiSubjectEditor
{
11 constructor(objectId
) {
12 this.objectId
= objectId
;
15 * Shows the subject editor dialog.
18 Dialog_1
.default.open(this);
21 * Validates and saves the new subject.
24 event
.preventDefault();
25 const value
= this.subject
.value
.trim();
27 Util_1
.default.innerError(this.subject
, Language
.get("wcf.global.form.error.empty"));
30 Util_1
.default.innerError(this.subject
, "");
35 objectIDs
: [this.objectId
],
40 * Returns the current conversation subject.
43 return Array
.from(document
.querySelectorAll(`.jsConversationSubject[data-conversation-id="${this.objectId}"], .conversationLink[data-object-id="${this.objectId}"]`))
44 .map((subject
) => subject
.textContent
)
48 Dialog_1
.default.close(this);
50 .querySelectorAll(`.jsConversationSubject[data-conversation-id="${this.objectId}"], .conversationLink[data-object-id="${this.objectId}"]`)
51 .forEach((subject
) => {
52 subject
.textContent
= data
.returnValues
.subject
;
54 UiNotification
.show();
58 id
: "dialogConversationSubjectEditor",
60 onSetup
: (content
) => {
61 this.subject
= document
.getElementById("jsConversationSubject");
62 this.subject
.addEventListener("keyup", (ev
) => {
63 if (ev
.key
=== "Enter") {
67 content
.querySelector(".jsButtonSave").addEventListener("click", (ev
) => this.saveEdit(ev
));
70 this.subject
.value
= this.getCurrentValue();
72 title
: Language
.get("wcf.conversation.edit.subject"),
77 <label for="jsConversationSubject">${Language.get("wcf.global.subject")}</label>
80 <input type="text" id="jsConversationSubject" class="long" maxlength="255">
83 <div class="formSubmit">
84 <button class="buttonPrimary jsButtonSave">${Language.get("wcf.global.button.save")}</button>
92 actionName
: "editSubject",
93 className
: "wcf\\data\\conversation\\ConversationAction",
99 function beginEdit(objectId
) {
100 editor
= new UiSubjectEditor(objectId
);
103 exports
.beginEdit
= beginEdit
;