This commit is contained in:
Mo Bitar
2017-01-31 00:54:22 -06:00
parent c93eba279d
commit fd44b694b0
4 changed files with 11 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
angular.module('app.frontend') angular.module('app.frontend')
.directive("editorSection", function($timeout){ .directive("editorSection", function($timeout, $sce){
return { return {
restrict: 'E', restrict: 'E',
scope: { scope: {
@@ -153,13 +153,13 @@ angular.module('app.frontend')
status += " (offline)"; status += " (offline)";
} }
this.saveError = false; this.saveError = false;
this.noteStatus = status; this.noteStatus = $sce.trustAsHtml(status);
}.bind(this), 200) }.bind(this), 200)
} else { } else {
if(statusTimeout) $timeout.cancel(statusTimeout); if(statusTimeout) $timeout.cancel(statusTimeout);
statusTimeout = $timeout(function(){ statusTimeout = $timeout(function(){
this.saveError = true; this.saveError = true;
this.noteStatus = "Error saving" this.noteStatus = $sce.trustAsHtml("Error syncing<br>(changed saved offline)")
}.bind(this), 200) }.bind(this), 200)
} }
}.bind(this)); }.bind(this));
@@ -179,7 +179,7 @@ angular.module('app.frontend')
if(saveTimeout) $timeout.cancel(saveTimeout); if(saveTimeout) $timeout.cancel(saveTimeout);
if(statusTimeout) $timeout.cancel(statusTimeout); if(statusTimeout) $timeout.cancel(statusTimeout);
saveTimeout = $timeout(function(){ saveTimeout = $timeout(function(){
this.noteStatus = "Saving..."; this.noteStatus = $sce.trustAsHtml("Saving...");
this.saveNote(); this.saveNote();
}.bind(this), 275) }.bind(this), 275)
} }

View File

@@ -107,7 +107,9 @@ angular.module('app.frontend')
$scope.didShowErrorAlert = true; $scope.didShowErrorAlert = true;
alert("There was an error saving your note. Please try again."); alert("There was an error saving your note. Please try again.");
} }
callback(false); if(callback) {
callback(false);
}
} else { } else {
note.hasChanges = false; note.hasChanges = false;
if(callback) { if(callback) {

View File

@@ -68,6 +68,9 @@
.save-status { .save-status {
width: 20% !important; width: 20% !important;
float: right; float: right;
position: absolute;
right: 20px;
font-size: 12px; font-size: 12px;
text-transform: none; text-transform: none;
font-weight: normal; font-weight: normal;

View File

@@ -5,7 +5,7 @@
%input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)", %input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)",
"ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()", "ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()",
"select-on-click" => "true"} "select-on-click" => "true"}
.save-status{"ng-class" => "{'red bold': ctrl.saveError}"} {{ctrl.noteStatus}} .save-status{"ng-class" => "{'red bold': ctrl.saveError}", "ng-bind-html" => "ctrl.noteStatus"}
.tags .tags
%input.tags-input{"type" => "text", "ng-keyup" => "$event.keyCode == 13 && ctrl.updateTagsFromTagsString($event, ctrl.tagsString)", %input.tags-input{"type" => "text", "ng-keyup" => "$event.keyCode == 13 && ctrl.updateTagsFromTagsString($event, ctrl.tagsString)",
"ng-model" => "ctrl.tagsString", "placeholder" => "#tags", "ng-blur" => "ctrl.updateTagsFromTagsString($event, ctrl.tagsString)"} "ng-model" => "ctrl.tagsString", "placeholder" => "#tags", "ng-blur" => "ctrl.updateTagsFromTagsString($event, ctrl.tagsString)"}