feat(forums): add forum view state and html view

This commit is contained in:
OldHawk
2017-07-06 15:39:51 +08:00
parent 068f50535e
commit be90e55863
6 changed files with 71 additions and 4 deletions

View File

@@ -11,7 +11,7 @@
// Set top bar menu items
menuService.addMenuItem('topbar', {
title: 'MENU_FORUMS',
state: 'forums',
state: 'forums.list',
roles: ['*'],
position: 1
});

View File

@@ -10,12 +10,25 @@
function routeConfig($stateProvider) {
$stateProvider
.state('forums', {
abstract: true,
url: '/forums',
template: '<ui-view/>'
})
.state('forums.list', {
url: '',
templateUrl: '/modules/forums/client/views/index.client.view.html',
data: {
roles: ['user', 'oper', 'admin'],
pageTitle: 'PAGETITLE.FORUM'
}
})
.state('forums.view', {
url: '/:forumId',
templateUrl: '/modules/forums/client/views/view.client.view.html',
data: {
roles: ['user', 'oper', 'admin'],
pageTitle: 'PAGETITLE.FORUM'
}
});
}
}());

View File

@@ -0,0 +1,27 @@
(function () {
'use strict';
angular
.module('forums')
.controller('ForumsViewController', ForumsViewController);
ForumsViewController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'MeanTorrentConfig', 'ForumsService', 'SideOverlay', '$filter', 'NotifycationService',
'marked', 'ModalConfirmService'];
function ForumsViewController($scope, $state, $translate, Authentication, MeanTorrentConfig, ForumsService, SideOverlay, $filter, NotifycationService,
marked, ModalConfirmService) {
var vm = this;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.user = Authentication.user;
/**
* init
*/
vm.init = function () {
ForumsService.query({}, function (items) {
vm.forums = items;
});
};
}
}());

View File

@@ -75,7 +75,7 @@
margin-left: 60px;
}
.moderators-title {
color: @brand-primary;
color: #666;
}
.moderators-list {
.moderators-item {

View File

@@ -46,10 +46,10 @@
<tbody>
<tr ng-repeat="f in vm.forums | filter: { category: cat.value }">
<td>
<span class="forum-icon glyphicon glyphicon-folder-open" ng-class="{'has-new-post': $index/2==0}"></span>
<span class="forum-icon glyphicon glyphicon-folder-open" ng-class="{'has-new-post': $index%2==0}"></span>
<div class="forum-info">
<h4><a href="#">{{f.name}}</a>
<h4><a ui-sref="forums.view({ forumId: f._id })">{{f.name}}</a>
<small class="badge badge_mt" ng-show="f.readOnly">R</small>
</h4>

View File

@@ -0,0 +1,27 @@
<section ng-controller="ForumsViewController as vm" ng-init="vm.init();">
<div class="pagetop">
<div class="container">
<div class="col-sm-8">
<div class="page-header">
<h1>meanTorrent Forums</h1>
<p class="text-muted">Welcome to meanTorrent forums!</p>
</div>
</div>
<div class="col-sm-4">
<div class="page-header padding-top-10">
<div class="input-group">
<input type="text" class="form-control" aria-label="search" placeholder="Search">
<div class="input-group-btn">
<button type="button" class="btn btn-default" aria-label="Search"><span class="glyphicon glyphicon-search"></span>
</button>
</div>
</div>
<!--<p class="text-muted margin-top-10">Welcome to meanTorrent forums!</p>-->
</div>
</div>
</div>
</div>
</section>