From 5bd8eaa50630664f8c55f4a45e1dd4d177b54ac8 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Tue, 18 Jul 2017 19:00:30 +0800 Subject: [PATCH] fix(forum): topic reply floor number --- modules/core/client/app/trans-string-en.js | 1 + modules/core/client/app/trans-string-zh.js | 1 + .../forums-topic.client.controller.js | 23 ++++--------------- .../client/views/topic.client.view.html | 4 ++-- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 269035ef..1f4ed89f 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -700,6 +700,7 @@ ATTACH_DOWN_COUNT: 'Downloaded:', ATTACHE_DOWNLOAD_SUCCESSFULLY: 'Attach file download successfully', ATTACHE_DOWNLOAD_FAILED: 'Attach file download failed', + FLOOR_POSTER: 'OWN', CATEGORY: { AFFAIRS: 'Affairs', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 57d630e7..58f109ee 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -700,6 +700,7 @@ ATTACH_DOWN_COUNT: '下载次数:', ATTACHE_DOWNLOAD_SUCCESSFULLY: '附件文件下载成功', ATTACHE_DOWNLOAD_FAILED: '附件文件下载失败', + FLOOR_POSTER: '楼主', CATEGORY: { AFFAIRS: '站务区', diff --git a/modules/forums/client/controllers/forums-topic.client.controller.js b/modules/forums/client/controllers/forums-topic.client.controller.js index 7215b6ec..d5f08983 100644 --- a/modules/forums/client/controllers/forums-topic.client.controller.js +++ b/modules/forums/client/controllers/forums-topic.client.controller.js @@ -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))); diff --git a/modules/forums/client/views/topic.client.view.html b/modules/forums/client/views/topic.client.view.html index c401dbb2..ef8cdb64 100644 --- a/modules/forums/client/views/topic.client.view.html +++ b/modules/forums/client/views/topic.client.view.html @@ -131,7 +131,7 @@ -
F1
+
{{'FORUMS.FLOOR_POSTER' | translate}}
@@ -202,7 +202,7 @@ title="{{'FORUMS.TITLES.TOPIC_THUMBS_UP' | translate}}">({{rep._scoreList.length}})
-
F{{$index+2}}
+
F{{ (vm.currentPage-1) * vm.itemsPerPage + $index + 1 }}