diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 83345ffa..e4465761 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -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', diff --git a/modules/core/client/app/trans-string-zh-tw.js b/modules/core/client/app/trans-string-zh-tw.js index f420c7ea..0d62bde7 100644 --- a/modules/core/client/app/trans-string-zh-tw.js +++ b/modules/core/client/app/trans-string-zh-tw.js @@ -371,6 +371,7 @@ COPY_LINK_TEXT: '複製種子檔案地址', COPY_TO_CLIPBOARD_SUCCESSFULLY: '內容已複製到剪下板!', TORRENT_LABEL_LINK: '種子地址', + TORRENT_DOWNLOAD_LINK: '下載種子', PH_KEYWORD: '搜尋關鍵字', FILTER_KEYWORD: '過濾關鍵字', CLEAR_ALL_CONDITION: '清空所有條件', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index a2e9742d..27644522 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -371,6 +371,7 @@ COPY_LINK_TEXT: '复制种子文件地址', COPY_TO_CLIPBOARD_SUCCESSFULLY: '内容已复制到剪切板!', TORRENT_LABEL_LINK: '种子连接', + TORRENT_DOWNLOAD_LINK: '下载种子', PH_KEYWORD: '搜索关键字', FILTER_KEYWORD: '过滤关键字', CLEAR_ALL_CONDITION: '清空所有条件', diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index 8736ff2e..7a1e3759 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -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; diff --git a/modules/torrents/client/directives/torrent-file-download.client.directive.js b/modules/torrents/client/directives/torrent-file-download.client.directive.js new file mode 100644 index 00000000..e8a41e76 --- /dev/null +++ b/modules/torrents/client/directives/torrent-file-download.client.directive.js @@ -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('' + txt + ''); + + if (e) { + e.addClass(cls ? cls : ''); + + element.html(e); + $compile(element.contents())(scope); + } + } + } + }); + } + } +}()); diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index e31bf33f..c7f40d9e 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -1206,7 +1206,7 @@
{{item.torrent_filename}}
+ ui-sref="torrents.view({torrentId: item._id})">{{vm.TGI.getTorrentCustomTitle(item)}}
@@ -1237,11 +1237,10 @@ {{ 'RESOURCESTAGS.' + vm.RTS.getTagTitle(t) + '.' + t.toUpperCase() | translate}} - - - + + + +
@@ -1264,8 +1263,8 @@

- - {{ 'ANONYMOUS' | translate }} + + {{ 'ANONYMOUS' | translate }}
diff --git a/modules/torrents/server/controllers/torrents.server.controller.js b/modules/torrents/server/controllers/torrents.server.controller.js index 512d4e5f..6393fbe3 100644 --- a/modules/torrents/server/controllers/torrents.server.controller.js +++ b/modules/torrents/server/controllers/torrents.server.controller.js @@ -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')