fix(forum): topic reply floor number

This commit is contained in:
OldHawk
2017-07-18 19:00:30 +08:00
parent 8e13219603
commit 5bd8eaa506
4 changed files with 8 additions and 21 deletions

View File

@@ -41,15 +41,11 @@
* @param callback
*/
vm.figureOutItemsToDisplay = function (callback) {
console.log(vm.currentPage);
vm.filterLength = vm.topic._replies.length;
var begin = ((vm.currentPage - 1) * vm.itemsPerPage);
var end = begin + vm.itemsPerPage;
vm.pagedItems = vm.topic._replies.slice(begin, end);
console.log(vm.filterLength + '-' + begin + '-' + end);
console.log(vm.pagedItems);
if (callback) callback();
};
@@ -66,21 +62,6 @@
});
};
/**
* $watch 'vm.torrentLocalInfo'
*/
$scope.$watch('vm.topic', function (newValue, oldValue) {
if (newValue) {
console.log(newValue);
if (oldValue) {
vm.pageChanged();
} else {
vm.buildPager();
}
}
});
/**
* init
*/
@@ -100,6 +81,7 @@
topicId: $stateParams.topicId
}, function (topic) {
vm.topic = topic;
vm.buildPager();
vm.forumPath.push({name: topic.title, state: undefined});
});
@@ -371,6 +353,7 @@
replyId: reply._id
}, function (res) {
vm.topic = res;
vm.figureOutItemsToDisplay();
NotifycationService.showSuccessNotify('FORUMS.DELETE_REPLY_SUCCESSFULLY');
}, function (res) {
NotifycationService.showErrorNotify(res.data.message, 'FORUMS.DELETE_REPLY_FAILED');
@@ -454,6 +437,7 @@
$scope.uImages = [];
vm.currentPage = Math.ceil(res._replies.length / vm.itemsPerPage);
vm.topic = res;
vm.pageChanged();
$scope.$broadcast('show-errors-reset', 'vm.replyForm');
NotifycationService.showSuccessNotify('FORUMS.POST_REPLY_SUCCESSFULLY');
@@ -499,6 +483,7 @@
topic.$thumbsUp(function (res) {
vm.topic = res;
vm.figureOutItemsToDisplay();
$timeout(function () {
var ele = angular.element($('#thumbs_' + (r ? r._id : t._id)));