From b90ea97fcb1b0666b71fab52a9254ca44a0766da Mon Sep 17 00:00:00 2001 From: Mo Bitar Date: Thu, 31 May 2018 10:36:33 -0500 Subject: [PATCH] Update error text and style --- app/assets/javascripts/app/controllers/editor.js | 11 ++++++----- app/assets/stylesheets/app/_editor.scss | 4 ++++ .../templates/directives/account-menu.html.haml | 7 +++++-- app/assets/templates/editor.html.haml | 6 +++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/editor.js b/app/assets/javascripts/app/controllers/editor.js index 5fcb72b79..3b8d2cd63 100644 --- a/app/assets/javascripts/app/controllers/editor.js +++ b/app/assets/javascripts/app/controllers/editor.js @@ -229,15 +229,11 @@ angular.module('app') if(success) { if(statusTimeout) $timeout.cancel(statusTimeout); statusTimeout = $timeout(function(){ - this.saveError = false; - this.syncTakingTooLong = false; this.showAllChangesSavedStatus(); }.bind(this), 200) } else { if(statusTimeout) $timeout.cancel(statusTimeout); statusTimeout = $timeout(function(){ - this.saveError = true; - this.syncTakingTooLong = false; this.showErrorStatus(); }.bind(this), 200) } @@ -277,6 +273,9 @@ angular.module('app') } this.showAllChangesSavedStatus = function() { + this.saveError = false; + this.syncTakingTooLong = false; + var status = "All changes saved"; if(authManager.offline()) { status += " (offline)"; @@ -285,7 +284,9 @@ angular.module('app') } this.showErrorStatus = function() { - this.noteStatus = $sce.trustAsHtml("Error syncing
(changes saved offline)") + this.saveError = true; + this.syncTakingTooLong = false; + this.noteStatus = $sce.trustAsHtml("Sync Unreachable
All changes saved offline") } this.contentChanged = function() { diff --git a/app/assets/stylesheets/app/_editor.scss b/app/assets/stylesheets/app/_editor.scss index f704b3fdc..533372a11 100644 --- a/app/assets/stylesheets/app/_editor.scss +++ b/app/assets/stylesheets/app/_editor.scss @@ -61,6 +61,10 @@ $heading-height: 75px; margin-top: 4px; text-align: right; color: rgba(black, 0.23); + + .error { + color: #f6a200; + } } .editor-tags { diff --git a/app/assets/templates/directives/account-menu.html.haml b/app/assets/templates/directives/account-menu.html.haml index f84b94c18..b48d68db5 100644 --- a/app/assets/templates/directives/account-menu.html.haml +++ b/app/assets/templates/directives/account-menu.html.haml @@ -68,6 +68,11 @@ %div{"ng-if" => "!formData.showLogin && !formData.showRegister && !formData.mfa"} .panel-section{"ng-if" => "user"} + .notification.danger{"ng-if" => "syncStatus.error"} + %h2.title Sync Unreachable + .text Hmm...we can't seem to sync your account. The reason: {{syncStatus.error.message}} + %p + %a{"href" => "https://standardnotes.org/help", "target" => "_blank"} Need help? .panel-row %h2.title.wrap {{user.email}} .horizontal-group{"delay-hide" => "true", "show" => "syncStatus.syncOpInProgress || syncStatus.needsMoreSync", "delay" => "1000"} @@ -76,8 +81,6 @@ {{"Syncing" + (syncStatus.total > 0 ? ":" : "")}} %span{"ng-if" => "syncStatus.total > 0"} {{syncStatus.current}}/{{syncStatus.total}} - .subtitle.danger.panel-row{"ng-if" => "syncStatus.error"} Error syncing: {{syncStatus.error.message}} - .subtitle.subtle.normal {{server}} .panel-row diff --git a/app/assets/templates/editor.html.haml b/app/assets/templates/editor.html.haml index f18138a2d..ee46ab7e0 100644 --- a/app/assets/templates/editor.html.haml +++ b/app/assets/templates/editor.html.haml @@ -13,7 +13,7 @@ "ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()", "ng-blur" => "ctrl.onNameBlur()", "select-on-click" => "true", "ng-disabled" => "ctrl.note.locked"} - #save-status{"ng-class" => "{'red bold': ctrl.saveError, 'warning bold': ctrl.syncTakingTooLong}", "ng-bind-html" => "ctrl.noteStatus"} + #save-status{"ng-class" => "{'error bold': ctrl.syncTakingTooLong}", "ng-bind-html" => "ctrl.noteStatus"} .editor-tags #note-tags-component-container{"ng-if" => "ctrl.tagsComponent"} @@ -26,7 +26,7 @@ .app-bar.no-edges .left .item{"ng-click" => "ctrl.showMenu = !ctrl.showMenu; ctrl.showExtensions = false; ctrl.showEditorMenu = false;", "ng-class" => "{'selected' : ctrl.showMenu}", "click-outside" => "ctrl.showMenu = false;", "is-open" => "ctrl.showMenu"} - .label Menu + .label Options .menu-panel.dropdown-menu{"ng-if" => "ctrl.showMenu"} .section .header @@ -63,7 +63,7 @@ %panel-resizer{"panel-id" => "'editor-content'", "on-resize-finish" => "ctrl.onPanelResizeFinish","control" => "ctrl.resizeControl", "min-width" => 300, "hoverable" => "true", "property" => "'right'"} - %section.section{"ng-if" => "ctrl.note.errorDecrypting"} + .section{"ng-if" => "ctrl.note.errorDecrypting"} %p.medium-padding{"style" => "padding-top: 0 !important;"} There was an error decrypting this item. Ensure you are running the latest version of this app, then sign out and sign back in to try again. #editor-pane-component-stack