various small usability improvements

This commit is contained in:
azivner 2017-08-13 21:42:10 -04:00
parent 191f70477c
commit 6fe81cd93a
7 changed files with 29 additions and 4 deletions

View File

@ -8,24 +8,25 @@
<div id="top" style="text-align: center;"> <div id="top" style="text-align: center;">
&nbsp; &nbsp;
<span id="top-message"></span> <span id="top-message"></span>
<span id="error-message"></span>
</div> </div>
<div style="margin-left: auto; margin-right: auto; width: 1000px"> <div style="margin-left: auto; margin-right: auto; width: 1100px">
<div style="width: 200px; float: left;"> <div style="width: 300px; height: 800px; float: left; overflow: scroll;">
<button type="button" class="btn" onclick="createNewTopLevelNote()">Create new note</button> <button type="button" class="btn" onclick="createNewTopLevelNote()">Create new note</button>
<div id="tree"> <div id="tree">
</div> </div>
</div> </div>
<div style="width: 750px; float: left; margin-left: 20px;"> <div style="width: 750px; float: left; margin-left: 30px;">
<div style="float: right;"> <div style="float: right;">
<form action="logout" method="POST"> <form action="logout" method="POST">
<input type="submit" class="btn btn-sm" value="Logout"> <input type="submit" class="btn btn-sm" value="Logout">
</form> </form>
</div> </div>
<div style="float: left;"> <div style="float: left; margin: 5px;">
<input type="text" autocomplete="off" value="Welcome to Notecase web app!" id="noteTitle" style="font-size: x-large; border: 0; width: 100%;"> <input type="text" autocomplete="off" value="Welcome to Notecase web app!" id="noteTitle" style="font-size: x-large; border: 0; width: 100%;">
</div> </div>

View File

@ -3,6 +3,7 @@ function html2notecase(contents, note) {
contents = contents.replace(/<br>/g, '\n'); contents = contents.replace(/<br>/g, '\n');
contents = contents.replace(/<\/p>/g, '\n'); contents = contents.replace(/<\/p>/g, '\n');
contents = contents.replace(/<p>/g, ''); contents = contents.replace(/<p>/g, '');
contents = contents.replace(/&nbsp;/g, ' ');
let index = 0; let index = 0;

View File

@ -35,6 +35,9 @@ function noteChanged() {
contentType: "application/json", contentType: "application/json",
success: function(result) { success: function(result) {
message("Saved!"); message("Saved!");
},
error: function(result) {
error("Error saving the note!");
} }
}); });
} }

View File

@ -44,5 +44,7 @@ function notecase2html(note) {
noteText = noteText.replace(/(?:\r\n|\r|\n)/g, '<br />'); noteText = noteText.replace(/(?:\r\n|\r|\n)/g, '<br />');
noteText = noteText.replace(/ /g, '&nbsp;&nbsp;');
return noteText; return noteText;
} }

View File

@ -127,6 +127,10 @@ $(function(){
} }
}); });
} }
},
"return": function(node) {
// doesn't work :-/
$('#noteDetail').summernote('focus');
} }
} }
} }

View File

@ -2,4 +2,10 @@ function message(str) {
$("#top-message").show(); $("#top-message").show();
$("#top-message").html(str); $("#top-message").html(str);
$("#top-message").fadeOut(3000); $("#top-message").fadeOut(3000);
}
function error(str) {
$("#error-message").show();
$("#error-message").html(str);
$("#error-message").fadeOut(10000);
} }

View File

@ -9,4 +9,12 @@
color: green; color: green;
padding: 5px; padding: 5px;
border-radius: 10px; border-radius: 10px;
}
#error-message {
display: none; /* initial state is hidden */
background-color: red;
color: white;
padding: 5px;
border-radius: 10px;
} }