Browse Source

Merge pull request #10557 from Chocobo1/rootfolder

Fix "Create subfolder" option is not working in WebUI
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
d001927d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/webui/www/private/download.html
  2. 25
      src/webui/www/private/scripts/download.js
  3. 18
      src/webui/www/private/upload.html

18
src/webui/www/private/download.html

@ -72,11 +72,11 @@ @@ -72,11 +72,11 @@
</tr>
<tr>
<td>
<label for="start_torrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="startTorrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="false" readonly />
<input type="hidden" id="startTorrentHidden" name="paused" />
<input type="checkbox" id="startTorrent" />
</td>
</tr>
<tr>
@ -89,10 +89,11 @@ @@ -89,10 +89,11 @@
</tr>
<tr>
<td>
<label for="root_folder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="rootFolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
<input type="hidden" id="rootFolderHidden" name="root_folder" />
<input type="checkbox" id="rootFolder" />
</td>
</tr>
<tr>
@ -151,6 +152,9 @@ @@ -151,6 +152,9 @@
var submitted = false;
$('downloadForm').addEventListener("submit", function() {
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
$('rootFolderHidden').value = $('rootFolder').checked ? 'true' : 'false';
$('download_spinner').style.display = "block";
submitted = true;
});
@ -159,10 +163,6 @@ @@ -159,10 +163,6 @@
if (submitted)
window.parent.closeWindows();
});
$('start_torrent').addEventListener('change', function() {
$('add_paused').value = !$('start_torrent').checked;
});
</script>
<div id="download_spinner" class="mochaSpinner"></div>
</body>

25
src/webui/www/private/scripts/download.js

@ -55,19 +55,20 @@ var getPreferences = function() { @@ -55,19 +55,20 @@ var getPreferences = function() {
alert("Could not contact qBittorrent");
},
onSuccess: function(pref) {
if (pref) {
defaultSavePath = pref.save_path;
$('savepath').setProperty('value', defaultSavePath);
$('root_folder').checked = pref.create_subfolder_enabled;
$('start_torrent').checked = !pref.start_paused_enabled;
if (!pref)
return;
if (pref.auto_tmm_enabled == 1) {
$('autoTMM').selectedIndex = 1;
$('savepath').disabled = true;
}
else {
$('autoTMM').selectedIndex = 0;
}
defaultSavePath = pref.save_path;
$('savepath').setProperty('value', defaultSavePath);
$('rootFolder').checked = pref.create_subfolder_enabled;
$('startTorrent').checked = !pref.start_paused_enabled;
if (pref.auto_tmm_enabled == 1) {
$('autoTMM').selectedIndex = 1;
$('savepath').disabled = true;
}
else {
$('autoTMM').selectedIndex = 0;
}
}
}).send();

18
src/webui/www/private/upload.html

@ -60,11 +60,11 @@ @@ -60,11 +60,11 @@
</tr>
<tr>
<td>
<label for="start_torrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="startTorrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="start_torrent" checked="checked" />
<input type="hidden" id="add_paused" name="paused" value="false" readonly />
<input type="hidden" id="startTorrentHidden" name="paused" />
<input type="checkbox" id="startTorrent" />
</td>
</tr>
<tr>
@ -77,10 +77,11 @@ @@ -77,10 +77,11 @@
</tr>
<tr>
<td>
<label for="root_folder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
<label for="rootFolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
</td>
<td>
<input type="checkbox" id="root_folder" name="root_folder" value="true" checked="checked" />
<input type="hidden" id="rootFolderHidden" name="root_folder" />
<input type="checkbox" id="rootFolder" />
</td>
</tr>
<tr>
@ -127,6 +128,9 @@ @@ -127,6 +128,9 @@
var submitted = false;
$('uploadForm').addEventListener("submit", function() {
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
$('rootFolderHidden').value = $('rootFolder').checked ? 'true' : 'false';
$('upload_spinner').style.display = "block";
submitted = true;
});
@ -135,10 +139,6 @@ @@ -135,10 +139,6 @@
if (submitted)
window.parent.closeWindows();
});
$('start_torrent').addEventListener('change', function() {
$('add_paused').value = !$('start_torrent').checked;
});
</script>
<div id="upload_spinner" class="mochaSpinner"></div>
</body>

Loading…
Cancel
Save