Add sorting by object
This commit is contained in:
@@ -158,6 +158,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||||||
$scope.labelUpdate = function(label) {
|
$scope.labelUpdate = function(label) {
|
||||||
label.edit = false;
|
label.edit = false;
|
||||||
LabelService.update(label);
|
LabelService.update(label);
|
||||||
|
console.log(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.aclAdd = function(sharee) {
|
$scope.aclAdd = function(sharee) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ app.filter('orderObjectBy', function(){
|
|||||||
array.sort(function(a, b){
|
array.sort(function(a, b){
|
||||||
a = parseInt(a[attribute]);
|
a = parseInt(a[attribute]);
|
||||||
b = parseInt(b[attribute]);
|
b = parseInt(b[attribute]);
|
||||||
return a - b;
|
return a < b;
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ app.filter('orderObjectBy', function(){
|
|||||||
array.sort(function(a, b){
|
array.sort(function(a, b){
|
||||||
a = parseInt(a[attribute]);
|
a = parseInt(a[attribute]);
|
||||||
b = parseInt(b[attribute]);
|
b = parseInt(b[attribute]);
|
||||||
return a - b;
|
return a < b;
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@@ -733,7 +733,12 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||||||
var self = this;
|
var self = this;
|
||||||
$http.get(this.baseUrl + '/' + id).then(function (response) {
|
$http.get(this.baseUrl + '/' + id).then(function (response) {
|
||||||
data = response.data;
|
data = response.data;
|
||||||
|
if(self.data[data.id]===undefined) {
|
||||||
self.data[data.id] = response.data;
|
self.data[data.id] = response.data;
|
||||||
|
}
|
||||||
|
$.each(response.data, function(key, value) {
|
||||||
|
self.data[data.id][key] = value;
|
||||||
|
});
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
|
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
@@ -815,6 +820,12 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||||||
return this.data[this.id];
|
return this.data[this.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApiService.prototype.getData = function() {
|
||||||
|
return $.map(this.data, function(value, index) {
|
||||||
|
return [value];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
ApiService.prototype.getAll = function () {
|
ApiService.prototype.getAll = function () {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ app.factory('ApiService', function($http, $q){
|
|||||||
var self = this;
|
var self = this;
|
||||||
$http.get(this.baseUrl + '/' + id).then(function (response) {
|
$http.get(this.baseUrl + '/' + id).then(function (response) {
|
||||||
data = response.data;
|
data = response.data;
|
||||||
|
if(self.data[data.id]===undefined) {
|
||||||
self.data[data.id] = response.data;
|
self.data[data.id] = response.data;
|
||||||
|
}
|
||||||
|
$.each(response.data, function(key, value) {
|
||||||
|
self.data[data.id][key] = value;
|
||||||
|
});
|
||||||
deferred.resolve(response.data);
|
deferred.resolve(response.data);
|
||||||
|
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
@@ -119,6 +124,12 @@ app.factory('ApiService', function($http, $q){
|
|||||||
return this.data[this.id];
|
return this.data[this.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApiService.prototype.getData = function() {
|
||||||
|
return $.map(this.data, function(value, index) {
|
||||||
|
return [value];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
ApiService.prototype.getAll = function () {
|
ApiService.prototype.getAll = function () {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
<li><a href="#" class="icon-public">Public Boards</a></li>
|
<li><a href="#" class="icon-public">Public Boards</a></li>
|
||||||
//-->
|
//-->
|
||||||
|
|
||||||
<li class="with-icon with-menu" data-ng-repeat="b in boardservice.data">
|
<li class="with-icon with-menu" data-ng-repeat="b in boardservice.getData() | orderBy: ['shared', 'title']">
|
||||||
<span class="board-bullet" style="background-color:#{{b.color}};" ng-if="!b.status.edit"> </span>
|
<span class="board-bullet" style="background-color:#{{b.color}};" ng-if="!b.status.edit"> </span>
|
||||||
<a href="#/board/{{b.id}}/" ng-if="!b.status.edit">{{ b.title }}</a>
|
<a href="#/board/{{b.id}}/" ng-if="!b.status.edit">{{ b.title }}</a>
|
||||||
<div class="app-navigation-entry-utils" ng-show="!b.status.edit" style="position:absolute;">
|
<div class="app-navigation-entry-utils" ng-show="!b.status.edit" style="position:absolute;">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li class="app-navigation-entry-utils-menu-share svg" ng-show="b.shared>0"><i class="icon icon-share"> </i></li>
|
||||||
<li class="app-navigation-entry-utils-menu-button svg"><button class="icon-more"></button></li>
|
<li class="app-navigation-entry-utils-menu-button svg"><button class="icon-more"></button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +27,6 @@
|
|||||||
<div class="app-navigation-entry-deleted-description">Deleted X</div>
|
<div class="app-navigation-entry-deleted-description">Deleted X</div>
|
||||||
<button class="app-navigation-entry-deleted-button icon-history svg" title="Undo"></button>
|
<button class="app-navigation-entry-deleted-button icon-history svg" title="Undo"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="app-navigation-entry-edit" ng-show="b.status.edit">
|
<div class="app-navigation-entry-edit" ng-show="b.status.edit">
|
||||||
<form ng-disabled="isAddingList" class="ng-pristine ng-valid" ng-submit="boardUpdate(b)">
|
<form ng-disabled="isAddingList" class="ng-pristine ng-valid" ng-submit="boardUpdate(b)">
|
||||||
<input id="newTitle" class="edit ng-valid ng-empty" type="text" autofocus-on-insert ng-model="b.title">
|
<input id="newTitle" class="edit ng-valid ng-empty" type="text" autofocus-on-insert ng-model="b.title">
|
||||||
|
|||||||
Reference in New Issue
Block a user