feat(torrents): optimization the popup seed tooltip dialog

This commit is contained in:
OldHawk
2018-04-20 14:05:44 +08:00
parent 0b246e3788
commit 06ed33657c
5 changed files with 40 additions and 18 deletions

View File

@@ -477,8 +477,9 @@
TORRENTS_UPLOAD_FAILED: 'Failed to upload file',
TORRENTS_NO_FILE_SELECTED: 'No file selected',
BUTTON_UPLOADED_POPUP_CLOSE: 'OK',
BUTTON_UNSHOW_NEXT_TIME: 'I know, don`t show this next time',
POPUP_UPLOADED_TOOLTIP: 'The torrent is uploaded <strong style="color:#f00">successfully</strong> and is waiting for the administrator to review. The new torrent file with your Passkey will be <strong style="color:#f00">automatically downloaded</strong> after you click the "OK" button, and you can use this new torrent file to start seeding.',
TORRENT_DOWNLOADING_FILENAME: 'Downloading file name:',
TORRENT_DOWNLOADING_FILENAME: 'Downloading file name: ',
SELECT_RESOURCE_TYPE: '2. Please select the resource type',
SELECT_TORRENT_FILE: '1. Please select the torrent file',

View File

@@ -477,8 +477,9 @@
TORRENTS_UPLOAD_FAILED: '文件上传失败',
TORRENTS_NO_FILE_SELECTED: '请选择种子文件后再做尝试',
BUTTON_UPLOADED_POPUP_CLOSE: '确定',
POPUP_UPLOADED_TOOLTIP: '种子<strong style="color:#f00">上传成功</strong>并等待管理员的审核,带有您 Passkey 的种子文件会在您点击 "确定" 按钮后被<strong style="color:#f00">自动下载</strong>,然后您就可以使用这个新的种子文件开始做种了。',
TORRENT_DOWNLOADING_FILENAME: '种子文件名:',
BUTTON_UNSHOW_NEXT_TIME: '我知道了,下次不用再提示了!',
POPUP_UPLOADED_TOOLTIP: '种子<strong style="color:#f00">上传成功</strong>并等待管理员的审核,带有您 Passkey 的种子文件会在您点击 "确定" 按钮后被<strong style="color:#f00">自动下载</strong>,然后您就可以使用这个自动下载的种子文件开始做种了。',
TORRENT_DOWNLOADING_FILENAME: '种子文件名: ',
SELECT_RESOURCE_TYPE: '2. 请选择上传资源类型',
SELECT_TORRENT_FILE: '1. 请选择种子文件',

View File

@@ -7,11 +7,11 @@
TorrentsUploadController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'MeanTorrentConfig', 'Upload', 'Notification',
'TorrentsService', 'getStorageLangService', '$filter', 'DownloadService', 'DebugConsoleService', 'NotifycationService', 'SideOverlay',
'$templateRequest', 'marked', '$rootScope'];
'$templateRequest', 'marked', '$rootScope', 'localStorageService'];
function TorrentsUploadController($scope, $state, $translate, $timeout, Authentication, MeanTorrentConfig, Upload, Notification,
TorrentsService, getStorageLangService, $filter, DownloadService, mtDebug, NotifycationService, SideOverlay,
$templateRequest, marked, $rootScope) {
$templateRequest, marked, $rootScope, localStorageService) {
var vm = this;
vm.announceConfig = MeanTorrentConfig.meanTorrentConfig.announce;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
@@ -47,6 +47,7 @@
vm.videoNfo = '';
vm.customTorrent = {};
$rootScope.uploadPopupNotShowNextTime = localStorageService.get('upload_popup_not_show_next_time');
$rootScope.announceConfig = vm.announceConfig;
/**
* document.ready
@@ -62,7 +63,11 @@
blur: false,
escape: false,
closetransitionend: function () {
// Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Torrent created successfully!'});
console.log($scope.uploadPopupNotShowNextTime);
if ($scope.uploadPopupNotShowNextTime) {
localStorageService.set('upload_popup_not_show_next_time', true);
}
if (vm.downloadingTorrent) {
vm.downloadTorrent(vm.downloadingTorrent._id);
}
@@ -70,6 +75,11 @@
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
if ($scope.uploadPopupNotShowNextTime) {
$('#uploaded_popup_wrapper').remove();
$('#uploaded_popup_background').remove();
}
});
/**
@@ -671,9 +681,13 @@
vm.showUploadedPopup = function (t) {
vm.downloadingTorrent = t;
$rootScope.downloadingTorrent = t;
$timeout(function () {
$('#uploaded_popup').popup('show');
}, 10);
$rootScope.uploadPopupNotShowNextTime = localStorageService.get('upload_popup_not_show_next_time');
if (!$rootScope.uploadPopupNotShowNextTime) {
$timeout(function () {
$('#uploaded_popup').popup('show');
}, 10);
}
};
/**

View File

@@ -208,8 +208,8 @@ pre.prettyprint {
width: 80%;
top: 20%;
border-radius: 4px;
h3,
.h3 {
h4,
.h4 {
line-height: 1.6 !important;
}
}

View File

@@ -1,8 +1,8 @@
<section class="container" ng-controller="TorrentsUploadController as vm">
<section class="container" ng-controller="TorrentsUploadController as vm" xmlns="http://www.w3.org/1999/html">
<div class="jumbotron margin-top-10" ng-init="vm.getTemplateFileContent('/modules/torrents/client/templates/upload-rules-'+vm.lang+'.md')">
<div class="row">
<div class="col-xs-12">
<h4 translate="UPLOAD_RULES"></h4>
<h4 translate="UPLOAD_RULES" ng-click="vm.showUploadedPopup(null)"></h4>
<span ng-bind-html="vm.getTemplateMarkedContent()" style="line-height: 1.6;"></span>
</div>
</div>
@@ -775,14 +775,20 @@
<div id="uploaded_popup" style="display: none;">
<div class="row padding-top-30 padding-bottom-30">
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2">
<h3 translate="POPUP_UPLOADED_TOOLTIP"></h3>
<h4 translate="POPUP_UPLOADED_TOOLTIP"></h4>
</div>
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2">
<h6 class="text-muted">{{'TORRENT_DOWNLOADING_FILENAME' | translate}}</h6>
<h6 class="text-muted downloading-filename margin-left-30">{{announceConfig.announcePrefix}}{{downloadingTorrent.torrent_filename}}</h6>
<!--<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2">-->
<!--<h6 class="text-muted downloading-filename margin-left-30">{{'TORRENT_DOWNLOADING_FILENAME' | translate}} {{announceConfig.announcePrefix}}{{downloadingTorrent.torrent_filename}}</h6>-->
<!--</div>-->
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 text-center">
<div class="checkbox text-muted">
<label>
<input type="checkbox" ng-model="uploadPopupNotShowNextTime">{{'BUTTON_UNSHOW_NEXT_TIME' | translate}}
</label>
</div>
</div>
<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 text-center">
<button class="uploaded_popup_close btn btn-lg btn-success btn-width-100 margin-top-20">{{'BUTTON_UPLOADED_POPUP_CLOSE' | translate}}</button>
<button class="uploaded_popup_close btn btn-success btn-width-100">{{'BUTTON_UPLOADED_POPUP_CLOSE' | translate}}</button>
</div>
</div>
</div>