mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-26 09:09:25 +01:00
feat(forums): init forum topic list page view
This commit is contained in:
@@ -619,6 +619,7 @@
|
||||
|
||||
//forum
|
||||
FORUMS: {
|
||||
HOME_INDEX: 'Forums Home',
|
||||
BTN_ADD_FORUM: 'Add New Forum',
|
||||
BTN_EDIT_FORUM: 'Edit Forum',
|
||||
BTN_ADD: ' Add ',
|
||||
@@ -656,6 +657,7 @@
|
||||
READONLY: 'Only oper/admin can post new topic',
|
||||
TOPICS: 'Topics',
|
||||
REPLIES: 'Replies',
|
||||
VIEWS: 'Views',
|
||||
LAST_REPLY: 'Last Reply'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -619,6 +619,7 @@
|
||||
|
||||
//forum
|
||||
FORUMS: {
|
||||
HOME_INDEX: '论坛首页',
|
||||
BTN_ADD_FORUM: '添加版块',
|
||||
BTN_EDIT_FORUM: '编辑版块',
|
||||
BTN_ADD: ' 添加 ',
|
||||
@@ -656,6 +657,7 @@
|
||||
READONLY: '只有管理员可以发起新话题',
|
||||
TOPICS: '主题数',
|
||||
REPLIES: '回贴数',
|
||||
VIEWS: '查看数',
|
||||
LAST_REPLY: '最近回复'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
.controller('ForumsViewController', ForumsViewController);
|
||||
|
||||
ForumsViewController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'MeanTorrentConfig', 'ForumsService', 'SideOverlay', '$filter', 'NotifycationService',
|
||||
'marked', 'ModalConfirmService'];
|
||||
'marked', 'ModalConfirmService', '$stateParams', 'TopicsService'];
|
||||
|
||||
function ForumsViewController($scope, $state, $translate, Authentication, MeanTorrentConfig, ForumsService, SideOverlay, $filter, NotifycationService,
|
||||
marked, ModalConfirmService) {
|
||||
marked, ModalConfirmService, $stateParams, TopicsService) {
|
||||
var vm = this;
|
||||
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
|
||||
vm.user = Authentication.user;
|
||||
@@ -18,10 +18,26 @@
|
||||
* init
|
||||
*/
|
||||
vm.init = function () {
|
||||
ForumsService.query({}, function (items) {
|
||||
vm.forums = items;
|
||||
});
|
||||
};
|
||||
// get forum info by state params
|
||||
ForumsService.get({
|
||||
forumId: $stateParams.forumId
|
||||
}, function (item) {
|
||||
console.log(item);
|
||||
vm.forum = item;
|
||||
|
||||
vm.forumPath = [
|
||||
{name: vm.forum.name, state: undefined}
|
||||
];
|
||||
});
|
||||
|
||||
// get topics list
|
||||
TopicsService.query({
|
||||
forumId: $stateParams.forumId
|
||||
}, function (topics) {
|
||||
console.log(topics);
|
||||
vm.topics = topics;
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
}
|
||||
|
||||
.forum-list {
|
||||
.pagination {
|
||||
margin-bottom: 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.table-category {
|
||||
border-radius: 6px;
|
||||
}
|
||||
@@ -76,8 +80,10 @@
|
||||
}
|
||||
.moderators-title {
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
.moderators-list {
|
||||
font-size: 12px;
|
||||
.moderators-item {
|
||||
&:not(:first-child) {
|
||||
&::before {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<section class="container padding-top-10" ng-controller="ForumsAdminController as vm" ng-init="vm.init();">
|
||||
<div class="row margin-top-20 forum-list">
|
||||
<div class="col-md-10 col-md-offset-1">
|
||||
<button class="btn btn-primary" ng-click="vm.popupCreateForum($event)"> {{ 'FORUMS.BTN_ADD_FORUM' | translate }} </button>
|
||||
<button class="btn btn-success" ng-click="vm.popupCreateForum($event)"> {{ 'FORUMS.BTN_ADD_FORUM' | translate }} </button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-10 col-sm-offset-1 margin-top-30">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="container forum-list">
|
||||
<div class="path margin-top-20">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="#"><span class="small glyphicon glyphicon-home"></span> Forums</a></li>
|
||||
<li><a href="/forums"><span class="small glyphicon glyphicon-home"></span> {{'FORUMS.HOME_INDEX' | translate}}</a></li>
|
||||
<!--<li><a href="#">Library</a></li>-->
|
||||
<!--<li class="active">Data</li>-->
|
||||
</ol>
|
||||
|
||||
@@ -24,4 +24,48 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container forum-list">
|
||||
<div class="path margin-top-20">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="/forums"><span class="small glyphicon glyphicon-home"></span> {{'FORUMS.HOME_INDEX' | translate}}</a></li>
|
||||
<li ng-repeat="p in vm.forumPath" ng-class="{'active': !g.state}"><a href="{{p.state}}" ng-if="p.state!=undefined">{{p.name}}</a><span ng-if="p.state==undefined">{{p.name}}</span></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.itemsPerPage" total-items="vm.filterLength"
|
||||
ng-model="vm.currentPage"
|
||||
ng-change="vm.pageChanged()"
|
||||
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
|
||||
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-3">
|
||||
<button class="btn btn-success margin-top-10 margin-bottom-10 pull-right">Post New Topic</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive table-category">
|
||||
<table class="table table-hover table-valign-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{'FORUMS.FIELDS.TOPICS' | translate}}</th>
|
||||
<th class="text-center xs-hide">{{'FORUMS.FIELDS.REPLIES' | translate}}</th>
|
||||
<th class="text-center xs-hide">{{'FORUMS.FIELDS.VIEWS' | translate}}</th>
|
||||
<th class="text-center xs-hide sm-hide">{{'FORUMS.FIELDS.LAST_REPLY' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<td></td>
|
||||
<td class="text-center xs-hide"></td>
|
||||
<td class="text-center xs-hide"></td>
|
||||
<td class="text-center xs-hide sm-hide"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -48,6 +48,10 @@ var ScoreSchema = new Schema({
|
||||
* Topic Schema
|
||||
*/
|
||||
var TopicSchema = new Schema({
|
||||
forum: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Forum'
|
||||
},
|
||||
user: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
@@ -83,6 +87,10 @@ var TopicSchema = new Schema({
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
},
|
||||
isTop: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
lastReplyAt: {
|
||||
type: Date
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user