update startup wizard

This commit is contained in:
Luke Pulverenti 2015-08-22 12:55:23 -04:00
parent 12ba3ef851
commit 16a7316a65
3 changed files with 43 additions and 14 deletions

View File

@ -2,23 +2,42 @@
var guideController; var guideController;
function init(page, type, providerId) { function init(page, type) {
var url = 'tvproviders/' + type + '.js'; Dashboard.showLoadingMsg();
require([url], function (factory) { var apiClient = ApiClient;
var instance = new factory(page, providerId, { apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) {
showCancelButton: false,
showSubmitButton: false var providerId = null;
if (config.LiveTvGuideProviderType.toLowerCase() == type.toLowerCase()) {
if (config.LiveTvGuideProviderId) {
providerId = config.LiveTvGuideProviderId;
}
}
var url = 'tvproviders/' + type.toLowerCase() + '.js';
require([url], function (factory) {
var instance = new factory(page, providerId, {
showCancelButton: false,
showSubmitButton: false,
showConfirmation: false
});
Dashboard.hideLoadingMsg();
instance.init();
guideController = instance;
$(guideController).on('submitted', skip);
}); });
instance.init();
guideController = instance;
}); });
} }
function loadTemplate(page, type, providerId) { function loadTemplate(page, type) {
guideController = null; guideController = null;
@ -33,7 +52,7 @@
elem.innerHTML = Globalize.translateDocument(html); elem.innerHTML = Globalize.translateDocument(html);
$(elem).trigger('create'); $(elem).trigger('create');
init(page, type, providerId); init(page, type);
}); });
} }
@ -55,6 +74,11 @@
guideController.submit(); guideController.submit();
} }
function reload(page) {
$('#selectType', page).trigger('change');
}
$(document).on('pageinitdepends', "#wizardGuidePage", function () { $(document).on('pageinitdepends', "#wizardGuidePage", function () {
var page = this; var page = this;
@ -71,7 +95,7 @@
var page = this; var page = this;
$('#selectType', page).trigger('change'); reload(page);
}); });
})(jQuery, document, window); })(jQuery, document, window);

View File

@ -149,9 +149,14 @@
}).done(function (result) { }).done(function (result) {
Dashboard.processServerConfigurationUpdateResult(); Dashboard.hideLoadingMsg();
if (options.showConfirmation !== false) {
Dashboard.processServerConfigurationUpdateResult();
}
$(self).trigger('submitted');
}).fail(function () { }).fail(function () {
Dashboard.hideLoadingMsg();
Dashboard.alert({ Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider') message: Globalize.translate('ErrorSavingTvProvider')
}); });

View File

@ -21,7 +21,7 @@
<div> <div>
<label for="selectType">${LabelDataProvider}</label> <label for="selectType">${LabelDataProvider}</label>
<select id="selectType" data-mini="true" required="required"> <select id="selectType" data-mini="true" required="required">
<option value="schedulesdirect">Schedules Direct</option> <option value="SchedulesDirect">Schedules Direct</option>
</select> </select>
</div> </div>
<br /> <br />