mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-03 04:59:25 +01:00
feat(invitations): list all used invitations on detail view
This commit is contained in:
2
config/env/torrents.js
vendored
2
config/env/torrents.js
vendored
@@ -19,7 +19,7 @@ module.exports = {
|
||||
allow_social_sign: true
|
||||
},
|
||||
invite: {
|
||||
open_invite: true,
|
||||
open_invite: false,
|
||||
score_exchange: 10000,
|
||||
expires: 60 * 60 * 1000 * 24
|
||||
},
|
||||
|
||||
@@ -441,12 +441,19 @@
|
||||
//invitation
|
||||
INVITATION: {
|
||||
MY_INVITATION: 'My invitations',
|
||||
INVITE_NOTE: 'Please attention to the expiration time of the time limit invitation.',
|
||||
USED_INVITATION: 'Used invitations',
|
||||
INVITE_NOTE: 'Please attention to the expiration time of the time limit invitation is {{hours}} hours.',
|
||||
SIGN_NOTE: 'Please attention to the expiration time of sign in with the invitation is {{hours}} hours.',
|
||||
TITLE_CREATEDAT: 'CreatedAt',
|
||||
TITLE_EXPIRESAT: 'ExpiresAt',
|
||||
TITLE_INVITEDAT: 'InvitedAt',
|
||||
TITLE_SIGNINAT: 'SigninAt',
|
||||
TITLE_OPERATION: 'Operation',
|
||||
TITLE_TOKEN: 'Token',
|
||||
TITLE_SEND: 'Send an invitation'
|
||||
TITLE_SEND: 'Send an invitation',
|
||||
TITLE_STATUS: 'Status',
|
||||
TITLE_STATUS_REGED: 'Signed',
|
||||
TITLE_STATUS_UNREGED: 'Unsigned'
|
||||
},
|
||||
GET_INVITATIONS_ERROR: 'Get invitations failed',
|
||||
|
||||
|
||||
@@ -441,12 +441,19 @@
|
||||
//invitation
|
||||
INVITATION: {
|
||||
MY_INVITATION: '我的邀请',
|
||||
INVITE_NOTE: '请注意限时邀请的过期时间.',
|
||||
USED_INVITATION: '已发送的邀请',
|
||||
INVITE_NOTE: '请注意限时邀请的过期时间为 {{hours}} 小时.',
|
||||
SIGN_NOTE: '请注意邀请注册的有效期为 {{hours}} 小时.',
|
||||
TITLE_CREATEDAT: '创建时间',
|
||||
TITLE_EXPIRESAT: '过期时间',
|
||||
TITLE_INVITEDAT: '发邀时间',
|
||||
TITLE_SIGNINAT: '注册时间',
|
||||
TITLE_OPERATION: '操作',
|
||||
TITLE_TOKEN: '哈希码',
|
||||
TITLE_SEND: '发送邀请'
|
||||
TITLE_SEND: '发送邀请',
|
||||
TITLE_STATUS: '状态',
|
||||
TITLE_STATUS_REGED: '已注册',
|
||||
TITLE_STATUS_UNREGED: '未注册'
|
||||
},
|
||||
GET_INVITATIONS_ERROR: '获取邀请列表失败',
|
||||
|
||||
|
||||
@@ -948,6 +948,10 @@ body {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.mt-title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.left-icon {
|
||||
color: lighten(@mt-base-color, 40%);
|
||||
line-height: 1.4;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
vm.getMyInvitations = function () {
|
||||
InvitationsService.get({}, function (items) {
|
||||
console.log(items);
|
||||
vm.my_invitations = items.my_invitations;
|
||||
vm.used_invitations = items.used_invitations;
|
||||
}, function (res) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="row" ng-hide="vm.inviteConfig.open_invite">
|
||||
<div class="col-sm-8 col-sm-offset-2 text-center">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<strong>{{ 'NOTE_CAPTION' | translate }}</strong> {{ 'INVITE_INFO' | translate }}
|
||||
<strong>{{ 'NOTE_CAPTION' | translate }}</strong> <span translate="INVITE_INFO"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -11,12 +11,14 @@
|
||||
<div class="row" ng-hide="vm.my_invitations.length<=0">
|
||||
<div class="col-sm-10 col-sm-offset-1">
|
||||
<div class="panel panel-default">
|
||||
<!-- Default panel contents -->
|
||||
<div class="panel-heading">{{ 'INVITATION.MY_INVITATION' | translate }} (<strong
|
||||
class="color-mt-base">{{vm.my_invitations.length}}</strong>)
|
||||
<div class="panel-heading text-center mt-title">
|
||||
{{ 'INVITATION.MY_INVITATION' | translate }} <span
|
||||
class="color-mt-base">({{vm.my_invitations.length}})</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p class="text-danger"><strong>{{ 'NOTE_TIP' | translate }}</strong> {{ 'INVITATION.INVITE_NOTE' | translate }}</p>
|
||||
<p class="text-danger"><strong>{{ 'NOTE_TIP' | translate }}</strong>
|
||||
<span translate="INVITATION.INVITE_NOTE" translate-values="{hours: vm.inviteConfig.expires/(60*60*1000)}"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
@@ -46,5 +48,46 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row margin-top-10" ng-hide="vm.used_invitations.length<=0">
|
||||
<div class="col-sm-10 col-sm-offset-1">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading text-center mt-title">
|
||||
{{ 'INVITATION.USED_INVITATION' | translate }} <span
|
||||
class="color-mt-base">({{vm.used_invitations.length}})</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p class="text-danger"><strong>{{ 'NOTE_TIP' | translate }}</strong>
|
||||
<span translate="INVITATION.SIGN_NOTE" translate-values="{hours: vm.inviteConfig.expires/(60*60*1000)}"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-valign-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="text-center">{{'INVITATION.TITLE_TOKEN' | translate}}</th>
|
||||
<th class="text-center">{{'INVITATION.TITLE_INVITEDAT' | translate}}</th>
|
||||
<th class="text-center">{{'INVITATION.TITLE_SIGNINAT' | translate}}</th>
|
||||
<th class="text-center">{{'INVITATION.TITLE_STATUS' | translate}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="r in vm.used_invitations">
|
||||
<th scope="row">{{$index+1}}</th>
|
||||
<td class="text-center">{{r.token}}</td>
|
||||
<td class="text-center">{{r.invitedat | date:'yyyy-MM-dd HH:mm:ss'}}</td>
|
||||
<td class="text-center">{{r.registeredat | date:'yyyy-MM-dd HH:mm:ss'}}</td>
|
||||
<td class="text-center" ng-class="r.status == 2 ? 'text-success' : 'text-danger'">
|
||||
{{ r.status == 2 ? ('INVITATION.TITLE_STATUS_REGED' | translate) : ('INVITATION.TITLE_STATUS_UNREGED' | translate) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -71,12 +71,10 @@ exports.list = function (req, res) {
|
||||
|
||||
var findUsedInvitations = function (callback) {
|
||||
Invitation.find({
|
||||
where: {
|
||||
user: req.user._id,
|
||||
status: 2
|
||||
}
|
||||
status: {$gt: 0}
|
||||
})
|
||||
.sort('registeredat')
|
||||
.sort('invitedat')
|
||||
.populate('user')
|
||||
.exec(function (err, invitations) {
|
||||
if (err) {
|
||||
|
||||
@@ -38,6 +38,9 @@ var InvitationSchema = new Schema({
|
||||
expiresat: {
|
||||
type: Date
|
||||
},
|
||||
invitedat: {
|
||||
type: Date
|
||||
},
|
||||
registeredat: {
|
||||
type: Date
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user