Reselect first item on sort change
This commit is contained in:
@@ -254,8 +254,11 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedMenuItem = function($event) {
|
this.selectedMenuItem = function($event, hide) {
|
||||||
this.showMenu = false;
|
if(hide) {
|
||||||
|
this.showMenu = false;
|
||||||
|
}
|
||||||
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.deleteNote = function() {
|
this.deleteNote = function() {
|
||||||
|
|||||||
@@ -40,7 +40,13 @@ angular.module('app')
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.loadPreferences = function() {
|
this.loadPreferences = function() {
|
||||||
|
let prevSortValue = this.sortBy;
|
||||||
this.sortBy = authManager.getUserPrefValue("sortBy", "created_at");
|
this.sortBy = authManager.getUserPrefValue("sortBy", "created_at");
|
||||||
|
if(prevSortValue && prevSortValue != this.sortBy) {
|
||||||
|
$timeout(() => {
|
||||||
|
this.selectFirstNote();
|
||||||
|
})
|
||||||
|
}
|
||||||
this.sortDescending = this.sortBy != "title";
|
this.sortDescending = this.sortBy != "title";
|
||||||
|
|
||||||
this.showArchived = authManager.getUserPrefValue("showArchived", false);
|
this.showArchived = authManager.getUserPrefValue("showArchived", false);
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class MenuRow {
|
|||||||
buttonClass: "=",
|
buttonClass: "=",
|
||||||
buttonAction: "&",
|
buttonAction: "&",
|
||||||
spinnerClass: "=",
|
spinnerClass: "=",
|
||||||
subRows: "="
|
subRows: "=",
|
||||||
|
faded: "="
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.getUserPrefValue = function(key, defaultValue) {
|
this.getUserPrefValue = function(key, defaultValue) {
|
||||||
if(!this.userPreferences) { return; }
|
if(!this.userPreferences) { return defaultValue; }
|
||||||
var value = this.userPreferences.getAppDataItem(key);
|
var value = this.userPreferences.getAppDataItem(key);
|
||||||
return (value !== undefined && value != null) ? value : defaultValue;
|
return (value !== undefined && value != null) ? value : defaultValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,6 @@ class SingletonManager {
|
|||||||
this.modelManager.setItemToBeDeleted(d);
|
this.modelManager.setItemToBeDeleted(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Syncing from SM");
|
|
||||||
|
|
||||||
this.$rootScope.sync();
|
this.$rootScope.sync();
|
||||||
|
|
||||||
// Send remaining item to callback
|
// Send remaining item to callback
|
||||||
|
|||||||
@@ -191,8 +191,6 @@ class SyncManager {
|
|||||||
|
|
||||||
sync(callback, options = {}) {
|
sync(callback, options = {}) {
|
||||||
|
|
||||||
console.log("Sync");
|
|
||||||
|
|
||||||
var allDirtyItems = this.modelManager.getDirtyItems();
|
var allDirtyItems = this.modelManager.getDirtyItems();
|
||||||
|
|
||||||
if(this.syncStatus.syncOpInProgress) {
|
if(this.syncStatus.syncOpInProgress) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
.left
|
.left
|
||||||
.column{"ng-if" => "circle"}
|
.column{"ng-if" => "circle"}
|
||||||
.circle.small{"ng-class" => "circle"}
|
.circle.small{"ng-class" => "circle"}
|
||||||
.column
|
.column{"ng-class" => "{'faded' : faded}"}
|
||||||
.label
|
.label
|
||||||
{{title}}
|
{{title}}
|
||||||
.sublabel{"ng-if" => "subtitle"}
|
.sublabel{"ng-if" => "subtitle"}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
.section{"ng-if" => "!ctrl.selectedEditor"}
|
.section{"ng-if" => "!ctrl.selectedEditor"}
|
||||||
.header
|
.header
|
||||||
%h4.title Display
|
%h4.title Display
|
||||||
%menu-row{"title" => "'Monospace Font'", "circle" => "ctrl.monospaceFont ? 'success' : 'default'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('monospaceFont')"}
|
%menu-row{"title" => "'Monospace Font'", "circle" => "ctrl.monospaceFont ? 'success' : 'default'", "ng-click" => "ctrl.selectedMenuItem($event, true); ctrl.toggleKey('monospaceFont')"}
|
||||||
|
|
||||||
.item{"ng-click" => "ctrl.onEditorMenuClick()", "ng-class" => "{'selected' : ctrl.showEditorMenu}", "click-outside" => "ctrl.showEditorMenu = false;", "is-open" => "ctrl.showEditorMenu"}
|
.item{"ng-click" => "ctrl.onEditorMenuClick()", "ng-class" => "{'selected' : ctrl.showEditorMenu}", "click-outside" => "ctrl.showEditorMenu = false;", "is-open" => "ctrl.showEditorMenu"}
|
||||||
.label Editor
|
.label Editor
|
||||||
|
|||||||
@@ -32,17 +32,16 @@
|
|||||||
.header
|
.header
|
||||||
%h4.title Display
|
%h4.title Display
|
||||||
|
|
||||||
%menu-row{"title" => "'Archived Notes'", "circle" => "ctrl.showArchived ? 'success' : 'danger'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('showArchived')"}
|
%menu-row{"title" => "'Archived Notes'", "circle" => "ctrl.showArchived ? 'success' : 'danger'", "faded" => "!ctrl.showArchived", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('showArchived')"}
|
||||||
%menu-row{"title" => "'Pinned Notes'", "circle" => "ctrl.hidePinned ? 'danger' : 'success'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hidePinned')"}
|
%menu-row{"title" => "'Pinned Notes'", "circle" => "ctrl.hidePinned ? 'danger' : 'success'", "faded" => "ctrl.hidePinned", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hidePinned')"}
|
||||||
|
%menu-row{"title" => "'Note Preview'", "circle" => "ctrl.hideNotePreview ? 'danger' : 'success'", "faded" => "ctrl.hideNotePreview", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideNotePreview')"}
|
||||||
%menu-row{"title" => "'Note Preview'", "circle" => "ctrl.hideNotePreview ? 'danger' : 'success'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideNotePreview')"}
|
%menu-row{"title" => "'Date'", "circle" => "ctrl.hideDate ? 'danger' : 'success'","faded" => "ctrl.hideDate", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideDate')"}
|
||||||
%menu-row{"title" => "'Date'", "circle" => "ctrl.hideDate ? 'danger' : 'success'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideDate')"}
|
%menu-row{"title" => "'Tags'", "circle" => "ctrl.hideTags ? 'danger' : 'success'","faded" => "ctrl.hideTags", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideTags')"}
|
||||||
%menu-row{"title" => "'Tags'", "circle" => "ctrl.hideTags ? 'danger' : 'success'", "ng-click" => "ctrl.selectedMenuItem($event); ctrl.toggleKey('hideTags')"}
|
|
||||||
|
|
||||||
|
|
||||||
.scrollable
|
.scrollable
|
||||||
.infinite-scroll#notes-scrollable{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
|
.infinite-scroll#notes-scrollable{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
|
||||||
.note{"ng-repeat" => "note in (ctrl.sortedNotes = (ctrl.tag.notes | filter: ctrl.filterNotes | sortBy: ctrl.sortBy| limitTo:ctrl.notesToDisplay)) track by note.uuid",
|
.note{"ng-repeat" => "note in (ctrl.sortedNotes = (ctrl.tag.notes | filter: ctrl.filterNotes | sortBy: ctrl.sortBy | limitTo:ctrl.notesToDisplay)) track by note.uuid",
|
||||||
"ng-click" => "ctrl.selectNote(note)", "ng-class" => "{'selected' : ctrl.selectedNote == note}"}
|
"ng-click" => "ctrl.selectNote(note)", "ng-class" => "{'selected' : ctrl.selectedNote == note}"}
|
||||||
%strong.red.medium{"ng-if" => "note.conflict_of"} Conflicted copy
|
%strong.red.medium{"ng-if" => "note.conflict_of"} Conflicted copy
|
||||||
%strong.red.medium{"ng-if" => "note.errorDecrypting"} Error decrypting
|
%strong.red.medium{"ng-if" => "note.errorDecrypting"} Error decrypting
|
||||||
|
|||||||
Reference in New Issue
Block a user