file settings landed in angular implementation
This commit is contained in:
parent
6c93dba6ff
commit
708d627ff3
77
angular.html
77
angular.html
|
@ -177,35 +177,78 @@
|
|||
</div>
|
||||
|
||||
<!-- {{{ download template -->
|
||||
<table ng-repeat="download in getDownloads()" class="download" data-gid="{{download.gid}}">
|
||||
<table
|
||||
ng-repeat="download in getDownloads()"
|
||||
class="download" data-gid="{{download.gid}}">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td ng-click="download.collapsed = !download.collapsed" class="download-overview">
|
||||
<td
|
||||
ng-click="download.collapsed = !download.collapsed"
|
||||
class="download-overview">
|
||||
<b class="download-name">{{getName(download)}}</b>
|
||||
</td>
|
||||
<td class="download-controls" rowspan="2">
|
||||
<div class="btn-group">
|
||||
|
||||
<button ng-show="hasStatus(download, 'active')" class="btn download_pause" ng-click="pause(download)"><i class="icon-pause"></i></button>
|
||||
<button ng-show="hasStatus(download, 'paused')" class="btn download_play" ng-click="resume(download)"><i class="icon-play"></i></button>
|
||||
<button ng-show="canRestart(download)" class="btn download_restart" ng-click="restart(download)"><i class="icon-repeat"></i></button>
|
||||
<button
|
||||
ng-show="hasStatus(download, 'active')"
|
||||
class="btn"
|
||||
ng-click="pause(download)">
|
||||
<i class="icon-pause"></i>
|
||||
</button>
|
||||
|
||||
<button class="btn download_remove hidden-phone" ng-click="remove(download)"><i class="icon-stop"></i></button>
|
||||
<button
|
||||
ng-show="hasStatus(download, 'paused')"
|
||||
class="btn"
|
||||
ng-click="resume(download)">
|
||||
<i class="icon-play"></i>
|
||||
</button>
|
||||
|
||||
<button class="btn download_settings hidden-phone"><i class="icon-cog"></i></button>
|
||||
<button
|
||||
ng-show="canRestart(download)"
|
||||
class="btn"
|
||||
ng-click="restart(download)">
|
||||
<i class="icon-repeat"></i>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="btn hidden-phone"
|
||||
ng-click="remove(download)">
|
||||
<i class="icon-stop"></i>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="btn hidden-phone"
|
||||
ng-show="['waiting', 'active'].indexOf( getType(download) )!= -1"
|
||||
ng-click="showSettings(download)">
|
||||
<i class="icon-cog"></i>
|
||||
</button>
|
||||
|
||||
<button class="btn dropdown-toggle">
|
||||
<i class="caret"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
<li class="visible-phone"><a href="#"><i class="icon-cog"></i> Settings</a></li>
|
||||
<li class="visible-phone">
|
||||
<a
|
||||
ng-click="showSettings(download)"
|
||||
ng-show="['waiting', 'active'].indexOf( getType(download) )!= -1"
|
||||
href="#"><i class="icon-cog"></i> Settings</a>
|
||||
</li>
|
||||
|
||||
<li ng-show="download.bittorrent"><a href="#" class="torrent_info"><i class="icon-list-alt"></i> Peers</a></li>
|
||||
<li ng-show="download.bittorrent">
|
||||
<a href="#"><i class="icon-list-alt"></i> Peers</a>
|
||||
</li>
|
||||
|
||||
<li><a href="#" ng-click="download.collapsed = !download.collapsed"><i class="icon-info-sign"></i> More Info</a></li>
|
||||
<li>
|
||||
<a ng-click="download.collapsed = !download.collapsed"
|
||||
href="#"><i class="icon-info-sign"></i> More Info</a>
|
||||
</li>
|
||||
|
||||
<li class="visible-phone"><a href="#" ng-click="remove(download)"><i class="icon-remove"></i> Remove</a></li>
|
||||
<li class="visible-phone">
|
||||
<a ng-click="remove(download)"
|
||||
href="#"><i class="icon-remove"></i> Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -406,16 +449,16 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
|
|||
<!-- }}} -->
|
||||
|
||||
<!-- {{{ global settings -->
|
||||
<div class="modal hide" modal="globalSettings.shown">
|
||||
<div class="modal hide" modal="settings.shown">
|
||||
<div class="modal-header">
|
||||
<button class="close" ng-click="globalSettings.close()">x</button>
|
||||
<h3>{{globalSettings.title}}</h3>
|
||||
<button class="close" ng-click="settings.close()">x</button>
|
||||
<h3>{{settings.title}}</h3>
|
||||
</div>
|
||||
|
||||
<form class="form-horizontal modal-body">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<div ng-repeat="(name, set) in globalSettings.settings">
|
||||
<div ng-repeat="(name, set) in settings.settings">
|
||||
<label class="control-label">{{name}}</label>
|
||||
|
||||
<div class="controls">
|
||||
|
@ -431,8 +474,8 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
|
|||
</form>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn" ng-click="globalSettings.close()">Cancel</button>
|
||||
<button class="btn btn-success" ng-click="globalSettings.success()">Save</button>
|
||||
<button class="btn" ng-click="settings.close()">Cancel</button>
|
||||
<button class="btn btn-success" ng-click="settings.success()">Save</button>
|
||||
</div>
|
||||
</div
|
||||
<!-- }}} -->
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
angular
|
||||
.module('webui.ctrls.download', [
|
||||
'webui.services.utils', 'webui.services.rpc', 'webui.services.alerts'
|
||||
'webui.services.utils', 'webui.services.rpc', 'webui.services.alerts',
|
||||
'webui.services.settings', 'webui.services.modals'
|
||||
])
|
||||
.controller('DownloadCtrl', [ '$scope', '$rpc', '$utils', '$alerts',
|
||||
function(scope, rpc, utils, sett, alerts) {
|
||||
.controller('DownloadCtrl', [
|
||||
'$scope', '$rpc', '$utils', '$alerts', '$modals',
|
||||
'$fileSettings', '$activeInclude', '$waitingExclude',
|
||||
function(
|
||||
scope, rpc, utils, alerts, modals,
|
||||
fsettings, activeInclude, waitingExclude
|
||||
) {
|
||||
scope.active = [], scope.waiting = [], scope.stopped = [];
|
||||
|
||||
// pause the download
|
||||
|
@ -144,4 +150,34 @@ function(scope, rpc, utils, sett, alerts) {
|
|||
return type;
|
||||
};
|
||||
|
||||
scope.showSettings = function(d) {
|
||||
var type = this.getType(d)
|
||||
, settings = {};
|
||||
|
||||
rpc.once('getOption', [d.gid], function(data) {
|
||||
var vals = data[0];
|
||||
|
||||
window.fs = fsettings;
|
||||
window.ai = activeInclude;
|
||||
for (var i in fsettings) {
|
||||
if (type == 'active' && activeInclude.indexOf(i) == -1) continue;
|
||||
|
||||
if (type == 'waiting' && waitingExclude.indexOf(i) != -1) continue;
|
||||
|
||||
settings[i] = fsettings[i];
|
||||
settings[i].val = vals[i] || settings[i].val;
|
||||
}
|
||||
console.log(type);
|
||||
|
||||
modals.invoke('settings', settings, scope.getName(d) + ' settings', function(settings) {
|
||||
var sets = {};
|
||||
for (var i in settings) { sets[i] = settings[i].val };
|
||||
|
||||
rpc.once('changeOption', [d.gid, sets]);
|
||||
});
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}]);
|
||||
|
|
|
@ -82,7 +82,7 @@ angular
|
|||
};
|
||||
});
|
||||
|
||||
scope.globalSettings = {
|
||||
scope.settings = {
|
||||
shown: false,
|
||||
settings: [],
|
||||
title: 'Settings',
|
||||
|
@ -104,7 +104,7 @@ angular
|
|||
|
||||
_.each([
|
||||
'getUris', 'getTorrents', 'getMetalinks',
|
||||
'globalSettings'
|
||||
'settings'
|
||||
], function(name) {
|
||||
modals.register(name, function(cb) {
|
||||
if (scope[name].open && scope[name].cb) {
|
||||
|
|
|
@ -54,7 +54,7 @@ angular
|
|||
|
||||
_.forEach([fsettings, gsettings], function(sets) {
|
||||
for (var i in sets) {
|
||||
if (i in gexclude) continue;
|
||||
if (gexclude.indexOf(i) != -1) continue;
|
||||
|
||||
settings[i] = sets[i];
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ angular
|
|||
}
|
||||
}
|
||||
|
||||
modals.invoke('globalSettings', settings, 'Global Settings', function(settings) {
|
||||
modals.invoke('settings', settings, 'Global Settings', function(settings) {
|
||||
var sets = {};
|
||||
for (var i in settings) { sets[i] = settings[i].val };
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ angular.module('webui.services.settings', [])
|
|||
},
|
||||
|
||||
"index-out": {
|
||||
val: '',
|
||||
val: undefined,
|
||||
desc: "Set file path for file with index=INDEX. You can find the file index using the --show-files option. PATH is a relative path to the path specified in --dir option. You can use this option multiple times. Using this option, you can specify the output filenames of BitTorrent downloads."
|
||||
},
|
||||
|
||||
|
@ -463,7 +463,7 @@ angular.module('webui.services.settings', [])
|
|||
},
|
||||
|
||||
"checksum": {
|
||||
val: '',
|
||||
val: undefined,
|
||||
desc: "Set checksum. TYPE is hash type. The supported hash type is listed in Hash Algorithms in aria2c -v. DIGEST is hex digest. For example, setting sha-1 digest looks like this: sha-1=0192ba11326fe2298c8cb4de616f4d4140213838 This option applies only to HTTP(S)/FTP downloads."
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user