mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-07 12:52:10 +02:00
feat(messages): delete selected message
This commit is contained in:
@@ -286,5 +286,36 @@
|
||||
function toIsMe(m) {
|
||||
return (m.to_user._id === vm.user._id) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param m
|
||||
*/
|
||||
vm.delete = function (m) {
|
||||
vm.deleteList = [];
|
||||
var modalOptions = {
|
||||
closeButtonText: $translate.instant('MESSAGE_DELETE_CONFIRM_CANCEL'),
|
||||
actionButtonText: $translate.instant('MESSAGE_DELETE_CONFIRM_OK'),
|
||||
headerText: $translate.instant('MESSAGE_DELETE_CONFIRM_HEADER_TEXT'),
|
||||
bodyText: $translate.instant('MESSAGE_DELETE_CONFIRM_BODY_TEXT')
|
||||
};
|
||||
ModalConfirmService.showModal({}, modalOptions)
|
||||
.then(function (result) {
|
||||
var rmsg = new MessagesService({
|
||||
_messageId: m._id
|
||||
});
|
||||
|
||||
rmsg.$remove(function (res) {
|
||||
vm.messages.splice(vm.messages.indexOf(m), 1);
|
||||
vm.figureOutItemsToDisplay();
|
||||
vm.hideMessage();
|
||||
|
||||
NotifycationService.showSuccessNotify('MESSAGE_DELETED_SUCCESSFULLY');
|
||||
}, function (res) {
|
||||
NotifycationService.showErrorNotify(res.data.message, 'MESSAGE_DELETED_ERROR');
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<textarea class="form-control reply-textarea" id="reply-content" name="reply-content"
|
||||
ng-model="vm.replyContent" autofocus></textarea>
|
||||
<button class="btn btn-default" ng-click="vm.hideMessage();">{{ 'BUTTON_CLOSE' | translate }}</button>
|
||||
<button class="btn btn-default">{{ 'BUTTON_DELETE' | translate }}</button>
|
||||
<button class="btn btn-default" ng-click="vm.delete(vm.selectedMessage);">{{ 'BUTTON_DELETE' | translate }}</button>
|
||||
<button class="btn btn-success pull-right" ng-disabled="!vm.replyContent" ng-click="vm.replyMessage(vm.selectedMessage);">{{ 'BUTTON_REPLY' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user