mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
Confirmation on tag deletion
This commit is contained in:
parent
b8b0891083
commit
fc5a1f2e71
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Tag controller.
|
* Tag controller.
|
||||||
*/
|
*/
|
||||||
App.controller('Tag', function($scope, $state, Tag, Restangular) {
|
App.controller('Tag', function($scope, $dialog, $state, Tag, Restangular) {
|
||||||
// Retrieve tags
|
// Retrieve tags
|
||||||
Tag.tags().then(function(data) {
|
Tag.tags().then(function(data) {
|
||||||
$scope.tags = data.tags;
|
$scope.tags = data.tags;
|
||||||
@ -24,11 +24,21 @@ App.controller('Tag', function($scope, $state, Tag, Restangular) {
|
|||||||
* Delete a tag.
|
* Delete a tag.
|
||||||
*/
|
*/
|
||||||
$scope.deleteTag = function(tag) {
|
$scope.deleteTag = function(tag) {
|
||||||
|
var title = 'Delete tag';
|
||||||
|
var msg = 'Do you really want to delete this tag?';
|
||||||
|
var btns = [{result:'cancel', label: 'Cancel'}, {result:'ok', label: 'OK', cssClass: 'btn-primary'}];
|
||||||
|
|
||||||
|
$dialog.messageBox(title, msg, btns)
|
||||||
|
.open()
|
||||||
|
.then(function(result) {
|
||||||
|
if (result == 'ok') {
|
||||||
Restangular.one('tag', tag.id).remove().then(function() {
|
Restangular.one('tag', tag.id).remove().then(function() {
|
||||||
$scope.tags = _.reject($scope.tags, function(t) {
|
$scope.tags = _.reject($scope.tags, function(t) {
|
||||||
return tag.id == t.id;
|
return tag.id == t.id;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user