diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 64038052..867beb73 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -189,14 +189,24 @@ tippy(".client_app", { } }); -function addNote(textareaId, id, name) +function addNote(textareaId, nid) { - note.value = id + if(nid > 0) { + note.value = nid + let noteObj = document.querySelector("#nd"+nid) + + let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note"); + nortd.style.display = "block" + + nortd.innerHTML = `${tr("note")} ${escapeHtml(noteObj.dataset.name)}` + } else { + note.value = "none" - let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note"); - nortd.style.display = "block" + let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note"); + nortd.style.display = "none" - nortd.innerHTML = `${tr("note")} ${escapeHtml(name)}` + nortd.innerHTML = "" + } u("body").removeClass("dimmed"); u(".ovk-diag-cont").remove(); @@ -215,12 +225,18 @@ async function attachNote(id) } else { body = ` ${tr("select_or_create_new")} -
- ` - +
` + + if(note.value != "none") { + body += ` +
+ ${tr("do_not_attach_note")} +
` + } + for(const note of notes.items) { body += ` -
+
${escapeHtml(note.name)}
` diff --git a/locales/en.strings b/locales/en.strings index 90542d92..0a5c02c6 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -412,6 +412,7 @@ "select_or_create_new" = "Select existing note or create new one"; "notes_closed" = "You can't attach note to post, because only you can see them.
You can change it in settings."; +"do_not_attach_note" = "Do not attach note"; /* Menus */ diff --git a/locales/ru.strings b/locales/ru.strings index 51716742..060819db 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -397,6 +397,7 @@ "select_or_create_new" = "Выберите существующую заметку или создайте новую"; "notes_closed" = "Вы не можете прикрепить заметку к записи, так как ваши заметки видны только вам.

Вы можете поменять это в настройках."; +"do_not_attach_note" = "Не прикреплять заметку"; /* Menus */