changes
This commit is contained in:
8
js/service/BoardService.js
Normal file
8
js/service/BoardService.js
Normal 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
20
js/service/CardService.js
Normal 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;
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
38
js/service/StatusService.js
Normal file
38
js/service/StatusService.js
Normal 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;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
Reference in New Issue
Block a user