add download specific default properties

This commit is contained in:
hamza zia 2014-06-07 21:34:32 +08:00
parent 202c7b7783
commit 3e5e353ce1
3 changed files with 19 additions and 8 deletions

View File

@ -32,6 +32,10 @@ angular
// go to Global Settings dialog to see their description
'dir', 'conf-path', 'auto-file-renaming', 'max-connection-per-server',
])
.constant('$downloadProps', [ // Similar to starred Quick Access properties but for adding new downloads.
// go to Advance Download Options when adding a new download to view the list of possible options
'pause', 'dir', 'max-connection-per-server'
])
.constant('$globalTimeout', 1000) // interval to update the individual downloads
;

View File

@ -651,6 +651,7 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
</p>
<textarea rows="6" style="width: 100%" ng-model="getUris.uris"></textarea>
<legend>Download Settings</legend>
<div class="control-group">
<div ng-repeat="(name, set) in getUris.settings">
<label class="control-label">{{name}}</label>
@ -660,13 +661,11 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
</select>
<input ng-show="!set.options.length" typ="text" class="input-xlarge" ng-model="set.val"/>
</div>
<br><br>
<br>
</div>
<button class="btn" ng-click="getUris.advance_opts()">Add More Download Specific Options</button>
</div>
</fieldset>
<button class="btn" ng-click="getUris.advance_opts()">Add Download Specific Options</button>
</form>
<div class="modal-footer">
<button class="btn" ng-click="$dismiss()">Cancel</button>

View File

@ -26,18 +26,26 @@ var parseFiles = function(files, cb) {
angular
.module('webui.ctrls.modal', [
"ui.bootstrap", 'webui.services.deps', 'webui.services.modals', 'webui.services.rpc'
"ui.bootstrap", 'webui.services.deps', 'webui.services.modals', 'webui.services.rpc',
'webui.services.configuration'
])
.controller('ModalCtrl', [
'$_', '$scope', '$modal', "$modals", '$rpc','$fileSettings',
function(_, scope, $modal, modals, rpc, fsettings) {
'$_', '$scope', '$modal', "$modals", '$rpc','$fileSettings', '$downloadProps',
function(_, scope, $modal, modals, rpc, fsettings, dprops) {
scope.getUris = {
open: function(cb) {
var self = this;
this.uris = "";
this.settings = {};
this.fsettings = _.cloneDeep(fsettings);
this.cb = cb;
// fill in default download properties
_.forEach(dprops, function(p) {
self.settings[p] = self.fsettings[p];
});
this.inst = $modal.open({
templateUrl: "getUris.html",
scope: scope
@ -61,7 +69,7 @@ angular
advance_opts: function() {
var self = this;
modals.invoke(
'settings', _.cloneDeep(fsettings),
'settings', self.fsettings,
'Advance Download Options', 'Add', function(settings) {
for (var i in settings) {