mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-09-08 03:25:13 +08:00
WIP populate forms
This commit is contained in:
parent
7eef7f5dec
commit
668ac6c1f9
1 changed files with 44 additions and 0 deletions
|
@ -132,6 +132,9 @@ jQuery(document).ready(function($){
|
||||||
|
|
||||||
// iterate each saved settings chunk and create forms for them
|
// iterate each saved settings chunk and create forms for them
|
||||||
$.each(archives, function(index, value) {
|
$.each(archives, function(index, value) {
|
||||||
|
|
||||||
|
renderedExportSettingsBlocks = $('.options-form').length;
|
||||||
|
|
||||||
// add back in the 'baseUrl='
|
// add back in the 'baseUrl='
|
||||||
archive = 'baseUrl=' + value;
|
archive = 'baseUrl=' + value;
|
||||||
// trim trailing field
|
// trim trailing field
|
||||||
|
@ -144,7 +147,48 @@ jQuery(document).ready(function($){
|
||||||
|
|
||||||
console.log(settingsBlock);
|
console.log(settingsBlock);
|
||||||
|
|
||||||
|
var targetExportSettingsBlock;
|
||||||
|
|
||||||
//TODO: if there is only one form, populate it, else, clone last form, wipe values and populate with this block
|
//TODO: if there is only one form, populate it, else, clone last form, wipe values and populate with this block
|
||||||
|
if (renderedExportSettingsBlocks == 1) {
|
||||||
|
targetExportSettingsBlock = $('.options-form')[0];
|
||||||
|
} else {
|
||||||
|
// clone last form
|
||||||
|
$('.options-form:last').clone().insertAfter('.options-form:last');
|
||||||
|
|
||||||
|
// clear values
|
||||||
|
|
||||||
|
// set as target
|
||||||
|
targetExportSettingsBlock = $('.options-form:last');
|
||||||
|
}
|
||||||
|
|
||||||
|
// populate fields in target form with this archive's values
|
||||||
|
// baseUrl
|
||||||
|
$(targetExportSettingsBlock).find('#baseUrl').val(decodeURIComponent(settingsBlock.baseUrl));
|
||||||
|
|
||||||
|
// convert additionalurls back into line-separated decoded uri's
|
||||||
|
|
||||||
|
|
||||||
|
// cleanMeta
|
||||||
|
$(targetExportSettingsBlock).find('#cleanMeta')[0].checked = settingsBlock.cleanMeta;
|
||||||
|
|
||||||
|
// retainStaticFiles
|
||||||
|
$(targetExportSettingsBlock).find('retainStaticFiles')[0].checked = settingsBlock.retainStaticFiles;
|
||||||
|
|
||||||
|
// sendViaFTP
|
||||||
|
$(targetExportSettingsBlock).find('sendViaFTP')[0].checked = settingsBlock.sendViaFTP;
|
||||||
|
|
||||||
|
// ftpServer
|
||||||
|
$(targetExportSettingsBlock).find('ftpServer').val(settingsBlock.ftpServer);
|
||||||
|
|
||||||
|
// ftpUsername
|
||||||
|
$(targetExportSettingsBlock).find('ftpUsername').val(settingsBlock.ftpUsername);
|
||||||
|
|
||||||
|
// ftpPassword
|
||||||
|
$(targetExportSettingsBlock).find('ftpPassword').val(settingsBlock.ftpPassword);
|
||||||
|
|
||||||
|
// ftpRemotePath
|
||||||
|
$(targetExportSettingsBlock).find('ftpRemotePath').val(settingsBlock.ftpRemotePath);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue