Merge branch 'master' of github.com:standardnotes/web into privs

This commit is contained in:
Mo Bitar
2018-11-25 19:59:06 -06:00
9 changed files with 51 additions and 8 deletions

View File

@@ -11,7 +11,9 @@ class ActionsMenu {
controller($scope, modelManager, actionsManager) {
'ngInject';
$scope.extensions = actionsManager.extensions.sort((a, b) => {return a.name.toLowerCase() > b.name.toLowerCase()});
$scope.extensions = actionsManager.extensions.sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
});
for(let ext of $scope.extensions) {
ext.loading = true;

View File

@@ -15,8 +15,13 @@ class EditorMenu {
$scope.formData = {};
$scope.editors = componentManager.componentsForArea("editor-editor").sort((a, b) => {return a.name.toLowerCase() > b.name.toLowerCase()});
$scope.stack = componentManager.componentsForArea("editor-stack").sort((a, b) => {return a.name.toLowerCase() > b.name.toLowerCase()});
$scope.editors = componentManager.componentsForArea("editor-editor").sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
});
$scope.stack = componentManager.componentsForArea("editor-stack").sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
});
$scope.isDesktop = isDesktopApplication();

View File

@@ -15,8 +15,14 @@ class SessionHistoryMenu {
$scope.autoOptimize = sessionHistory.autoOptimize;
$scope.reloadHistory = function() {
$scope.history = sessionHistory.historyForItem($scope.item);
let history = sessionHistory.historyForItem($scope.item);
// make copy as not to sort inline
$scope.entries = history.entries.slice(0).sort((a, b) => {
return a.item.updated_at < b.item.updated_at ? 1 : -1;
})
$scope.history = history;
}
$scope.reloadHistory();
$scope.openRevision = function(revision) {

View File

@@ -78,7 +78,11 @@ class SingletonManager {
*/
if(allExtantItemsMatchingPredicate.length >= 2) {
let sorted = allExtantItemsMatchingPredicate.sort((a, b) => {
return a.created_at > b.created_at;
/*
If compareFunction(a, b) is less than 0, sort a to an index lower than b, i.e. a comes first.
If compareFunction(a, b) is greater than 0, sort b to an index lower than a, i.e. b comes first.
*/
return a.created_at < b.created_at ? -1 : 1;
});
// The item that will be chosen to be kept