From b2338c31d7b4f73df2e645b43a95801778477e86 Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 4 Sep 2017 21:37:55 -0400 Subject: [PATCH] encrypted notes have grey background to see immediatelly their status --- static/js/note.js | 15 ++++++++++++++- static/style.css | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/static/js/note.js b/static/js/note.js index d4f37bf1b..5953c93b3 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -139,6 +139,15 @@ function createNote(node, parentKey, target) { recentNotes = []; +function setNoteBackgroundIfEncrypted(note) { + if (note.detail.encryption > 0) { + $(".note-editable").addClass("encrypted"); + } + else { + $(".note-editable").removeClass("encrypted"); + } +} + function loadNote(noteId) { $.get(baseUrl + 'notes/' + noteId).then(function(note) { globalNote = note; @@ -179,6 +188,8 @@ function loadNote(noteId) { addRecentNote(noteId, note.detail.note_id); noteChangeDisabled = false; + + setNoteBackgroundIfEncrypted(note); }); }); } @@ -253,7 +264,7 @@ function getAes() { function encryptNote() { getAes().then(aes => { - const note = globalNote; + const note = globalNote; updateNoteFromInputs(note); @@ -270,6 +281,8 @@ function encryptNote() { note.detail.encryption = 1; saveNoteToServer(note); + + setNoteBackgroundIfEncrypted(note); }); } diff --git a/static/style.css b/static/style.css index c652d192e..f429cf10f 100644 --- a/static/style.css +++ b/static/style.css @@ -4,6 +4,10 @@ overflow: scroll; } +.note-editable.encrypted { + background-color: #eee; +} + #top-message { display: none; /* initial state is hidden */ background-color: #e0e0e0;