mini refactoring

This commit is contained in:
azivner 2018-08-28 14:26:11 +02:00
parent 21a96d2776
commit d31a136442
2 changed files with 6 additions and 8 deletions

View File

@ -16,7 +16,7 @@ async function showDialog() {
const result = await server.get('event-log'); const result = await server.get('event-log');
$list.html(''); $list.empty();
for (const event of result) { for (const event of result) {
const dateTime = utils.formatDateTime(utils.parseDate(event.dateCreated)); const dateTime = utils.formatDateTime(utils.parseDate(event.dateCreated));

View File

@ -119,11 +119,9 @@ async function saveNoteIfChanged() {
} }
function setNoteBackgroundIfProtected(note) { function setNoteBackgroundIfProtected(note) {
const isProtected = note.isProtected; $noteDetailWrapper.toggleClass("protected", note.isProtected);
$protectButton.toggleClass("active", note.isProtected);
$noteDetailWrapper.toggleClass("protected", isProtected); $unprotectButton.toggleClass("active", !note.isProtected);
$protectButton.toggleClass("active", isProtected);
$unprotectButton.toggleClass("active", !isProtected);
$unprotectButton.prop("disabled", !protectedSessionHolder.isProtectedSessionAvailable()); $unprotectButton.prop("disabled", !protectedSessionHolder.isProtectedSessionAvailable());
} }
@ -183,7 +181,7 @@ async function loadNoteDetail(noteId) {
// after loading new note make sure editor is scrolled to the top // after loading new note make sure editor is scrolled to the top
$noteDetailWrapper.scrollTop(0); $noteDetailWrapper.scrollTop(0);
$scriptArea.html(''); $scriptArea.empty();
await bundleService.executeRelationBundles(getCurrentNote(), 'runOnNoteView'); await bundleService.executeRelationBundles(getCurrentNote(), 'runOnNoteView');
@ -417,7 +415,7 @@ async function loadAttributes() {
$promotedAttributesContainer.empty().append($tbody); $promotedAttributesContainer.empty().append($tbody);
} }
else { else {
$attributeListInner.html(''); $attributeListInner.empty();
if (attributes.length > 0) { if (attributes.length > 0) {
for (const attribute of attributes) { for (const attribute of attributes) {