This commit is contained in:
Julius Haertl
2016-06-15 14:05:19 +02:00
parent ae9d5da329
commit cf3bbcb888
35 changed files with 686 additions and 465 deletions

View File

@@ -0,0 +1,8 @@
app.factory('BoardService', function(ApiService, $http, $q){
var BoardService = function($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
};
BoardService.prototype = angular.copy(ApiService.prototype);
service = new BoardService($http, 'boards', $q)
return service;
});

20
js/service/CardService.js Normal file
View File

@@ -0,0 +1,20 @@
app.factory('CardService', function(ApiService, $http, $q){
var CardService = function($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
};
CardService.prototype = angular.copy(ApiService.prototype);
CardService.prototype.reorder = function(card, order) {
var deferred = $q.defer();
var self = this;
$http.put(this.baseUrl + '/reorder', {cardId: card.id, order: order, stackId: card.stackId}).then(function (response) {
card.order = order;
deferred.resolve(response.data);
}, function (error) {
deferred.reject('Error while update ' + self.endpoint);
});
return deferred.promise;
}
service = new CardService($http, 'cards', $q)
return service;
});

View File

@@ -15,6 +15,11 @@ app.factory('StackService', function(ApiService, $http, $q){
return deferred.promise;
}
StackService.prototype.addCard = function(entity) {
console.log(this.data[entity.stackId]);
this.data[entity.stackId].cards.push(entity);
}
service = new StackService($http, 'stacks', $q)
return service;
});

View File

@@ -0,0 +1,38 @@
app.service('StatusService', function(){
// Status Helper
this.active = true;
this.icon = 'loading';
this.title = 'Please wait';
this.text = 'Es dauert noch einen kleinen Moment';
this.counter = 2;
this.setStatus = function($icon, $title, $text) {
this.active = true;
this.icon = $icon;
this.title = $title;
this.text = $text;
}
this.setError = function($title, $text) {
this.active = true;
this.icon = 'error';
this.title = $title;
this.text = $text;
this.counter = 0;
}
this.releaseWaiting = function() {
if(this.counter>0)
this.counter--;
if(this.counter<=0) {
this.active = false;
this.counter = 0;
}
}
this.unsetStatus = function() {
this.active = false;
}
});

View File

@@ -1,37 +0,0 @@
app.factory('boardFactory', function($http){
var service = {};
var baseUrl = OC.generateUrl('/apps/deck/boards');
service.getBoards = function(){
return $http.get(baseUrl);
}
service.getBoard = function (id) {
board = $http.get(baseUrl + '/' + id);
return board;
};
service.createBoard = function (board) {
return $http.post(baseUrl, board);
};
service.updateBoard = function (board) {
return $http.put(baseUrl, board)
};
service.deleteBoard = function (id) {
return $http.delete(baseUrl + '/' + id);
};
return service;
});
app.factory('BoardService', function(ApiService, $http, $q){
var BoardService = function($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
};
BoardService.prototype = angular.copy(ApiService.prototype);
service = new BoardService($http, 'boards', $q)
return service;
});