fix(torrents): show torrent custom title in torrent detail page of other torrent version

This commit is contained in:
OldHawk
2018-06-27 19:14:19 +08:00
parent 55cb451687
commit 9b5ec0bb20
7 changed files with 59 additions and 19 deletions

View File

@@ -371,6 +371,7 @@
COPY_LINK_TEXT: 'Copy torrent file link',
COPY_TO_CLIPBOARD_SUCCESSFULLY: 'Copy data to clipboard successfully!',
TORRENT_LABEL_LINK: 'Torrent Link',
TORRENT_DOWNLOAD_LINK: 'Download torrent',
PH_KEYWORD: 'Search keyword',
FILTER_KEYWORD: 'filter keyword',
CLEAR_ALL_CONDITION: 'Clear All Condition',

View File

@@ -371,6 +371,7 @@
COPY_LINK_TEXT: '複製種子檔案地址',
COPY_TO_CLIPBOARD_SUCCESSFULLY: '內容已複製到剪下板!',
TORRENT_LABEL_LINK: '種子地址',
TORRENT_DOWNLOAD_LINK: '下載種子',
PH_KEYWORD: '搜尋關鍵字',
FILTER_KEYWORD: '過濾關鍵字',
CLEAR_ALL_CONDITION: '清空所有條件',

View File

@@ -371,6 +371,7 @@
COPY_LINK_TEXT: '复制种子文件地址',
COPY_TO_CLIPBOARD_SUCCESSFULLY: '内容已复制到剪切板!',
TORRENT_LABEL_LINK: '种子连接',
TORRENT_DOWNLOAD_LINK: '下载种子',
PH_KEYWORD: '搜索关键字',
FILTER_KEYWORD: '过滤关键字',
CLEAR_ALL_CONDITION: '清空所有条件',

View File

@@ -1091,14 +1091,6 @@ body {
border: solid 1px #fff;
}
}
.label-torrent-link {
color: #8a8a8a;
border: solid 1px #dedede;
background-color: #fafafa;
&:hover {
color: #f00;
}
}
}
.media-heading {
line-height: 1.2;
@@ -1164,6 +1156,14 @@ body {
}
.list-all-tags {
.label-torrent-link {
color: #8a8a8a;
border: solid 1px #dedede;
background-color: #fafafa;
&:hover {
color: #f00;
}
}
.btn-owner-edit-tags {
line-height: 1;
padding: 3px 5px;

View File

@@ -0,0 +1,40 @@
(function () {
'use strict';
angular.module('users')
.directive('torrentFileDownloadLink', torrentFileDownloadLink);
torrentFileDownloadLink.$inject = ['$compile', '$translate', 'MeanTorrentConfig'];
function torrentFileDownloadLink($compile, $translate, MeanTorrentConfig) {
var appConfig = MeanTorrentConfig.meanTorrentConfig.app;
var directive = {
restrict: 'A',
link: link
};
return directive;
function link(scope, element, attrs) {
scope.$watch(attrs.torrentFileDownloadLink, function (s) {
if (s) {
var torrent = s;
if (torrent) {
var txt = $translate.instant('TORRENT_DOWNLOAD_LINK');
var cls = attrs.infoClass;
var e = angular.element('<span class="label" ng-click="vm.DLS.downloadTorrent(item._id); $event.stopPropagation();"><i class="fa fa-arrow-circle-down margin-right-3"></i>' + txt + '</span>');
if (e) {
e.addClass(cls ? cls : '');
element.html(e);
$compile(element.contents())(scope);
}
}
}
});
}
}
}());

View File

@@ -1206,7 +1206,7 @@
<td class="col-md-8 td-v-middle td-text-overflow">
<div class="other-torrent-info">
<div class="torrent-filename text-long"><a
ui-sref="torrents.view({torrentId: item._id})">{{item.torrent_filename}}</a></div>
ui-sref="torrents.view({torrentId: item._id})">{{vm.TGI.getTorrentCustomTitle(item)}}</a></div>
<div class="list-all-tags margin-top-10">
<span ng-if="vm.torrentLocalInfo.resource_detail_info.release_date">
@@ -1237,11 +1237,10 @@
{{ 'RESOURCESTAGS.' + vm.RTS.getTagTitle(t) + '.' + t.toUpperCase() | translate}}
</span>
</span>
<span class="label label-download text-uppercase"
title="{{ 'TITLE_ALT.DOWNLOAD_TORRENT' | translate}}"
ng-click="vm.DLS.downloadTorrent(item._id); $event.stopPropagation();">
<i class="glyphicon glyphicon-arrow-down"></i>
</span>
<span torrent-file-download-link="item" info-class="label label-torrent-link"></span>
<span torrent-file-link-label="item" torrent-user="vm.user" info-class="label label-torrent-link"></span>
</div>
</div>
</td>
@@ -1264,8 +1263,8 @@
</p>
</td>
<td class="col-md-1 td-v-middle text-center td-uploader">
<span ng-if="!item.isAnonymous" user-info="item.user" info-name></span>
<span ng-if="item.isAnonymous">{{ 'ANONYMOUS' | translate }}</span>
<span ng-if="!item.isAnonymous || vm.user.isOper" user-info="item.user" info-name></span>
<span ng-if="item.isAnonymous && !vm.user.isOper">{{ 'ANONYMOUS' | translate }}</span>
<div maker-info="item.maker"></div>
</td>

View File

@@ -2522,9 +2522,7 @@ exports.torrentByID = function (req, res, next, id) {
mtDebug.debugGreen(condition);
var fields = 'user maker torrent_filename torrent_tags torrent_seeds torrent_leechers torrent_finished torrent_seasons torrent_episodes torrent_size torrent_sale_status torrent_type torrent_hnr isSaling torrent_vip torrent_sale_expires createdat';
Torrent.find(condition, fields)
Torrent.find(condition, populateStrings.populate_torrent_string)
.sort('-createdat')
.populate('user', 'username displayName profileImageURL isVip score uploaded downloaded')
.populate('maker', 'name')