feat(torrents): show a seeding guide after torrent upload successfully.

This commit is contained in:
OldHawk
2018-04-19 15:07:32 +08:00
parent 94eee67ad1
commit 0fd53d8f56
8 changed files with 111 additions and 23 deletions

View File

@@ -476,6 +476,9 @@
TORRENTS_UPLOAD_SUCCESSFULLY: 'Successfully upload file',
TORRENTS_UPLOAD_FAILED: 'Failed to upload file',
TORRENTS_NO_FILE_SELECTED: 'No file selected',
BUTTON_UPLOADED_POPUP_CLOSE: 'OK',
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:',
SELECT_RESOURCE_TYPE: '2. Please select the resource type',
SELECT_TORRENT_FILE: '1. Please select the torrent file',

View File

@@ -476,6 +476,9 @@
TORRENTS_UPLOAD_SUCCESSFULLY: '文件上传成功',
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: '种子文件名:',
SELECT_RESOURCE_TYPE: '2. 请选择上传资源类型',
SELECT_TORRENT_FILE: '1. 请选择种子文件',

View File

@@ -14,6 +14,7 @@
function stateChangeStart(event, toState, toParams, fromState, fromParams) {
$('.side-background').remove();
$('.textcomplete-dropdown').remove();
$('.popup_wrapper').remove();
// Check authentication before changing state
if (toState.data && toState.data.roles && toState.data.roles.length > 0) {
var allowed = false;

View File

@@ -119,9 +119,7 @@
if (vm.appConfig.showDemoWarningPopup && !sw) {
$timeout(function () {
$('#warning_popup').popup('show');
//$('.warning_popup_open').trigger('click');
//angular.element('#myselector').triggerHandler('click');
}, 300);
}, 10);
localStorageService.set('showed_warning', true);
}

View File

@@ -1865,7 +1865,7 @@ body {
}
#warning_popup_background {
transition: all 0.3s 0.3s;
transition: all 0.3s 0.05s;
}
#warning_popup,
@@ -1887,7 +1887,7 @@ body {
background-color: #fff;
opacity: 0.8 !important;
width: 80%;
margin-top: 100px;
top: 20%;
border-radius: 4px;
h3,
.h3 {

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'];
'$templateRequest', 'marked', '$rootScope'];
function TorrentsUploadController($scope, $state, $translate, $timeout, Authentication, MeanTorrentConfig, Upload, Notification,
TorrentsService, getStorageLangService, $filter, DownloadService, mtDebug, NotifycationService, SideOverlay,
$templateRequest, marked) {
$templateRequest, marked, $rootScope) {
var vm = this;
vm.announceConfig = MeanTorrentConfig.meanTorrentConfig.announce;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
@@ -47,6 +47,31 @@
vm.videoNfo = '';
vm.customTorrent = {};
$rootScope.announceConfig = vm.announceConfig;
/**
* document.ready
* #uploaded_popup.popup
*/
$(document).ready(function () {
$('#uploaded_popup').popup({
outline: false,
focusdelay: 400,
vertical: 'top',
autoopen: false,
opacity: 0.6,
blur: false,
escape: false,
closetransitionend: function () {
// Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Torrent created successfully!'});
if (vm.downloadingTorrent) {
vm.downloadTorrent(vm.downloadingTorrent._id);
}
$state.reload('torrents.uploads');
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
});
/**
* getTemplateFileContent
* @param file
@@ -469,11 +494,7 @@
});
function successCallback(res) {
vm.downloadTorrent(res._id);
Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Torrent created successfully!'});
$state.reload('torrents.uploads');
document.body.scrollTop = document.documentElement.scrollTop = 0;
vm.showUploadedPopup(res);
}
function errorCallback(res) {
@@ -514,11 +535,7 @@
});
function successCallback(res) {
vm.downloadTorrent(res._id);
Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Torrent created successfully!'});
$state.reload('torrents.uploads');
document.body.scrollTop = document.documentElement.scrollTop = 0;
vm.showUploadedPopup(res);
}
function errorCallback(res) {
@@ -580,11 +597,7 @@
});
function successCallback(res) {
vm.downloadTorrent(res._id);
Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Torrent created successfully!'});
$state.reload('torrents.uploads');
document.body.scrollTop = document.documentElement.scrollTop = 0;
vm.showUploadedPopup(res);
}
function errorCallback(res) {
@@ -651,6 +664,18 @@
vm.tags = [];
};
/**
* showUploadedPopup
* @param t
*/
vm.showUploadedPopup = function (t) {
vm.downloadingTorrent = t;
$rootScope.downloadingTorrent = t;
$timeout(function () {
$('#uploaded_popup').popup('show');
}, 10);
};
/**
* downloadTorrent
* @param id

View File

@@ -175,3 +175,47 @@ pre.prettyprint {
}
}
/* csslint ignore:end */
//popup overlay----------------------------------------------
/* csslint ignore:start */
.uploaded_popup {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
display: none;
}
#uploaded_popup_background {
transition: all 0.3s 0.05s;
}
#uploaded_popup,
#uploaded_popup_wrapper {
transition: all 0.3s ease-out;
}
#uploaded_popup {
transform: translateX(0) translateY(-40%);
}
.popup_visible #uploaded_popup {
transform: translateX(0) translateY(0);
}
#uploaded_popup,
#uploaded_popup_wrapper {
.popup_content {
background-color: #fff;
opacity: 0.8 !important;
width: 80%;
top: 20%;
border-radius: 4px;
h3,
.h3 {
line-height: 1.6 !important;
}
}
.downloading-filename {
word-break: break-all;
}
}
/* csslint ignore:end */
//popup overlay end -------------------------------------------

View File

@@ -770,5 +770,19 @@
</div>
</div>
</script>
</section>
</section>
<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>
</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>
<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>
</div>
</div>
</div>