1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

made saving consistent

This commit is contained in:
Luke Pulverenti 2013-04-17 00:58:32 -04:00
parent dcea852799
commit a6767f5cbc
10 changed files with 121 additions and 118 deletions

View file

@ -21,10 +21,13 @@
<label>Disable internet providers for:</label>
<div id="divItemTypes"></div>
</li>
<li style="display: none;">
<button class="btnSubmit" type="submit" data-theme="b">
<li>
<button type="submit" data-theme="b" data-icon="ok">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
Cancel
</button>
</li>
</ul>
</form>

View file

@ -1,55 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<title>Display Settings</title>
<title>Client Settings</title>
</head>
<body>
<div id="displaySettingsPage" data-role="page" class="page type-interior">
<div id="clientSettingsPage" data-role="page" class="page type-interior">
<div data-role="content">
<div class="content-primary">
<form id="displaySettingsForm">
<form id="clientSettingsForm">
<ul data-role="listview" class="ulForm">
<li>
<label for="txtWeatherLocation">Weather location: </label>
<input id="txtWeatherLocation" name="txtWeatherLocation" type="text" onchange="DisplaySettingsPage.submit();" />
<input id="txtWeatherLocation" name="txtWeatherLocation" type="text" />
<div class="fieldDescription">
US zip code / City, State, Country / City, Country
</div>
</li>
<li>
<label for="selectWeatherUnit">Weather display unit: </label>
<select id="selectWeatherUnit" name="selectWeatherUnit" onchange="DisplaySettingsPage.submit();">
<select id="selectWeatherUnit" name="selectWeatherUnit">
<option value="Celsius">Celsius</option>
<option value="Fahrenheit">Fahrenheit</option>
</select>
</li>
<li>
<label for="txtMinResumePct">Min resume percentage: </label>
<input type="number" id="txtMinResumePct" name="txtMinResumePct" pattern="[0-9]*" required="required" min="0" max="100" onchange="DisplaySettingsPage.submit();" />
<input type="number" id="txtMinResumePct" name="txtMinResumePct" pattern="[0-9]*" required="required" min="0" max="100" />
<div class="fieldDescription">
Titles are assumed unplayed before this time
</div>
</li>
<li>
<label for="txtMaxResumePct">Max resume percentage: </label>
<input type="number" id="txtMaxResumePct" name="txtMaxResumePct" pattern="[0-9]*" required="required" min="1" max="100" onchange="DisplaySettingsPage.submit();" />
<input type="number" id="txtMaxResumePct" name="txtMaxResumePct" pattern="[0-9]*" required="required" min="1" max="100" />
<div class="fieldDescription">
Titles are assumed fully played after this time
</div>
</li>
<li>
<label for="txtMinResumeDuration">Min resume duration (seconds): </label>
<input type="number" id="txtMinResumeDuration" name="txtMinResumeDuration" pattern="[0-9]*" required="required" min="0" onchange="DisplaySettingsPage.submit();" />
<input type="number" id="txtMinResumeDuration" name="txtMinResumeDuration" pattern="[0-9]*" required="required" min="0" />
<div class="fieldDescription">
Titles shorter than this will not be resumable
</div>
</li>
<li style="display: none;">
<button type="submit" data-theme="b" data-icon="ok" class="btnSubmit">
<li>
<button type="submit" data-theme="b" data-icon="ok">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
Cancel
</button>
</li>
</ul>
@ -58,9 +61,8 @@
</div>
<script type="text/javascript">
$(function() {
$('#displaySettingsForm input:first').focus();
$('#displaySettingsForm').on('submit', DisplaySettingsPage.onSubmit);
$(function () {
$('#clientSettingsForm').on('submit', ClientSettingsPage.onSubmit);
});
</script>
</div>

View file

@ -18,29 +18,32 @@
<form id="metadataConfigurationForm">
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkEnableInternetProviders" name="chkEnableInternetProviders" onchange="MetadataConfigurationPage.submit();" />
<input type="checkbox" id="chkEnableInternetProviders" name="chkEnableInternetProviders" />
<label for="chkEnableInternetProviders">Download metadata from the internet </label>
</li>
<li>
<input type="checkbox" id="chkSaveLocal" name="chkSaveLocal" onchange="MetadataConfigurationPage.submit();" />
<input type="checkbox" id="chkSaveLocal" name="chkSaveLocal" />
<label for="chkSaveLocal">Save metadata within media folders </label>
</li>
<li>
<label for="txtRefreshDays">Metadata refresh period (days): </label>
<input type="number" id="txtRefreshDays" name="txtRefreshDays" pattern="[0-9]*" required="required" min="1" onchange="MetadataConfigurationPage.submit();" />
<input type="number" id="txtRefreshDays" name="txtRefreshDays" pattern="[0-9]*" required="required" min="1" />
</li>
<li>
<label for="selectLanguage">Preferred language: </label>
<select name="selectLanguage" id="selectLanguage" onchange="MetadataConfigurationPage.submit();"></select>
<select name="selectLanguage" id="selectLanguage"></select>
</li>
<li>
<label for="selectCountry">Country: </label>
<select name="selectCountry" id="selectCountry" onchange="MetadataConfigurationPage.submit();"></select>
<select name="selectCountry" id="selectCountry"></select>
</li>
<li style="display: none;">
<button class="btnSubmit" type="submit" data-theme="b">
<li>
<button type="submit" data-theme="b" data-icon="ok">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
Cancel
</button>
</li>
</ul>
</form>

View file

@ -18,7 +18,7 @@
<form id="metadataImagesConfigurationForm">
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkRefreshItemImages" name="chkRefreshItemImages" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" id="chkRefreshItemImages" name="chkRefreshItemImages" />
<label for="chkRefreshItemImages">Refresh existing images </label>
<div class="fieldDescription">
When enabled, images will be refreshed periodically
@ -26,26 +26,26 @@
</li>
<li>
<label for="txtNumbackdrops">Max number of backdrops per item: </label>
<input type="number" id="txtNumbackdrops" name="txtNumbackdrops" pattern="[0-9]*" required="required" min="1" onchange="MetadataImagesPage.submit();" />
<input type="number" id="txtNumbackdrops" name="txtNumbackdrops" pattern="[0-9]*" required="required" min="1" />
</li>
</ul>
<p>Enable additional image downloading:</p>
<div data-role="collapsible">
<h3>Movies</h3>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkDownloadMovieArt" name="chkDownloadMovieArt" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadMovieArt" name="chkDownloadMovieArt" />
<label for="chkDownloadMovieArt">Movie Art</label>
<input type="checkbox" data-mini="true" id="chkDownloadMovieBanner" name="chkDownloadMovieBanner" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadMovieBanner" name="chkDownloadMovieBanner" />
<label for="chkDownloadMovieBanner">Movie Banner</label>
<input type="checkbox" data-mini="true" id="chkDownloadMovieDisc" name="chkDownloadMovieDisc" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadMovieDisc" name="chkDownloadMovieDisc" />
<label for="chkDownloadMovieDisc">Movie Disc</label>
<input type="checkbox" data-mini="true" id="chkDownloadMovieLogo" name="chkDownloadMovieLogo" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadMovieLogo" name="chkDownloadMovieLogo" />
<label for="chkDownloadMovieLogo">Movie Logo</label>
<input type="checkbox" data-mini="true" id="chkDownloadMovieThumb" name="chkDownloadMovieThumb" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadMovieThumb" name="chkDownloadMovieThumb" />
<label for="chkDownloadMovieThumb">Movie Thumb</label>
@ -55,16 +55,16 @@
<div data-role="collapsible">
<h3>TV Series</h3>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chKDownloadTVArt" name="chKDownloadTVArt" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chKDownloadTVArt" name="chKDownloadTVArt" />
<label for="chKDownloadTVArt">TV Series Art</label>
<input type="checkbox" data-mini="true" id="chkDownloadTVBanner" name="chkDownloadTVBanner" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadTVBanner" name="chkDownloadTVBanner" />
<label for="chkDownloadTVBanner">TV Series Banner</label>
<input type="checkbox" data-mini="true" id="chkDownloadTVLogo" name="chkDownloadTVLogo" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadTVLogo" name="chkDownloadTVLogo" />
<label for="chkDownloadTVLogo">TV Series Logo</label>
<input type="checkbox" data-mini="true" id="chkDownloadTVThumb" name="chkDownloadTVThumb" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadTVThumb" name="chkDownloadTVThumb" />
<label for="chkDownloadTVThumb">TV Series Thumb</label>
</div>
</div>
@ -73,13 +73,13 @@
<div data-role="collapsible">
<h3>TV Seasons</h3>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkDownloadSeasonBackdrops" name="chkDownloadSeasonBackdrops" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadSeasonBackdrops" name="chkDownloadSeasonBackdrops" />
<label for="chkDownloadSeasonBackdrops">TV Season Backdrops</label>
<input type="checkbox" data-mini="true" id="chkDownloadSeasonBanner" name="chkDownloadSeasonBanner" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadSeasonBanner" name="chkDownloadSeasonBanner" />
<label for="chkDownloadSeasonBanner">TV Season Banner</label>
<input type="checkbox" data-mini="true" id="chkDownloadSeasonThumb" name="chkDownloadSeasonThumb" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadSeasonThumb" name="chkDownloadSeasonThumb" />
<label for="chkDownloadSeasonThumb">TV Season Thumb</label>
</div>
@ -88,16 +88,16 @@
<div data-role="collapsible">
<h3>Music Artists</h3>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkDownloadArtistThumb" name="chkDownloadArtistThumb" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadArtistThumb" name="chkDownloadArtistThumb" />
<label for="chkDownloadArtistThumb">Music Artist Thumb (primary image)</label>
<input type="checkbox" data-mini="true" id="chkDownloadArtistBackdrops" name="chkDownloadArtistBackdrops" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadArtistBackdrops" name="chkDownloadArtistBackdrops" />
<label for="chkDownloadArtistBackdrops">Music Artist Backdrops</label>
<input type="checkbox" data-mini="true" id="chkDownloadArtistLogo" name="chkDownloadArtistLogo" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadArtistLogo" name="chkDownloadArtistLogo" />
<label for="chkDownloadArtistLogo">Music Artist Logo</label>
<input type="checkbox" data-mini="true" id="chkDownloadArtistBanner" name="chkDownloadArtistBanner" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadArtistBanner" name="chkDownloadArtistBanner" />
<label for="chkDownloadArtistBanner">Music Artist Banner</label>
</div>
@ -105,10 +105,10 @@
<div data-role="collapsible">
<h3>Music Albums</h3>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkDownloadAlbumPrimary" name="chkDownloadAlbumPrimary" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadAlbumPrimary" name="chkDownloadAlbumPrimary" />
<label for="chkDownloadAlbumPrimary">Music Album Cover</label>
<input type="checkbox" data-mini="true" id="chkDownloadAlbumBackdrops" name="chkDownloadAlbumBackdrops" onchange="MetadataImagesPage.submit();" />
<input type="checkbox" data-mini="true" id="chkDownloadAlbumBackdrops" name="chkDownloadAlbumBackdrops" />
<label for="chkDownloadAlbumBackdrops">Music Album Backdrops</label>
</div>
@ -118,7 +118,7 @@
<ul data-role="listview" class="ulForm">
<li>
<label for="selectTmdbPosterDownloadSize">Tmdb poster download size: </label>
<select id="selectTmdbPosterDownloadSize" name="selectTmdbPosterDownloadSize" onchange="MetadataImagesPage.submit();">
<select id="selectTmdbPosterDownloadSize" name="selectTmdbPosterDownloadSize">
<option value="original">original</option>
<option value="w92">w92</option>
<option value="w154">w154</option>
@ -129,7 +129,7 @@
</li>
<li>
<label for="selectTmdbBackdropDownloadSize">Tmdb backdrop download size: </label>
<select id="selectTmdbBackdropDownloadSize" name="selectTmdbBackdropDownloadSize" onchange="MetadataImagesPage.submit();">
<select id="selectTmdbBackdropDownloadSize" name="selectTmdbBackdropDownloadSize">
<option value="original">original</option>
<option value="w380">w380</option>
<option value="w780">w780</option>
@ -138,17 +138,20 @@
</li>
<li>
<label for="selectTmdbPersonImageDownloadSize">Tmdb person image download size: </label>
<select id="selectTmdbPersonImageDownloadSize" name="selectTmdbPersonImageDownloadSize" onchange="MetadataImagesPage.submit();">
<select id="selectTmdbPersonImageDownloadSize" name="selectTmdbPersonImageDownloadSize">
<option value="original">original</option>
<option value="w45">w45</option>
<option value="w185">w185</option>
<option value="h632">h632</option>
</select>
</li>
<li style="display: none;">
<button class="btnSubmit" type="submit" data-theme="b">
<li>
<button type="submit" data-theme="b" data-icon="ok">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
Cancel
</button>
</li>
</ul>
</form>

View file

@ -33,7 +33,7 @@
var checkedAttribute = configuration.InternetProviderExcludeTypes.indexOf(type) != -1 ? ' checked="checked"' : '';
html += '<input' + checkedAttribute + ' class="chkItemType" data-mini="true" data-itemtype="' + type + '" type="checkbox" name="' + id + '" id="' + id + '" onchange="AdvancedMetadataConfigurationPage.submit();" />';
html += '<input' + checkedAttribute + ' class="chkItemType" data-mini="true" data-itemtype="' + type + '" type="checkbox" name="' + id + '" id="' + id + '" />';
html += '<label for="' + id + '">' + type + '</label>';
}
@ -42,15 +42,11 @@
$('#divItemTypes', page).html(html).trigger("create");
},
submit: function () {
$('.btnSubmit', $.mobile.activePage)[0].click();
},
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.InternetProviderExcludeTypes = $.map($('.chkItemType:checked', form), function (currentCheckbox) {
@ -58,7 +54,7 @@
return currentCheckbox.getAttribute('data-itemtype');
});
ApiClient.updateServerConfiguration(config);
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission

View file

@ -0,0 +1,50 @@
(function ($, document, window) {
$(document).on('pageshow', "#clientSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
$('#txtWeatherLocation', page).val(config.WeatherLocation);
$('#txtMinResumePct', page).val(config.MinResumePct);
$('#txtMaxResumePct', page).val(config.MaxResumePct);
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
$('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");
$('input:first', page).focus();
Dashboard.hideLoadingMsg();
});
});
function clientSettingsPage() {
var self = this;
self.onSubmit = function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.WeatherLocation = $('#txtWeatherLocation', form).val();
config.WeatherUnit = $('#selectWeatherUnit', form).val();
config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val();
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.ClientSettingsPage = new clientSettingsPage();
})($, document, window);

View file

@ -1,46 +0,0 @@
var DisplaySettingsPage = {
onPageShow: function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
$('#txtWeatherLocation', page).val(config.WeatherLocation);
$('#txtMinResumePct', page).val(config.MinResumePct);
$('#txtMaxResumePct', page).val(config.MaxResumePct);
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
$('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");
Dashboard.hideLoadingMsg();
});
},
submit: function() {
$('.btnSubmit', $.mobile.activePage)[0].click();
},
onSubmit: function () {
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.WeatherLocation = $('#txtWeatherLocation', form).val();
config.WeatherUnit = $('#selectWeatherUnit', form).val();
config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val();
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
ApiClient.updateServerConfiguration(config);
});
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#displaySettingsPage", DisplaySettingsPage.onPageShow);

View file

@ -79,15 +79,11 @@
$('#selectLanguage', '#metadataConfigurationPage').html(html).selectmenu("refresh");
},
submit: function () {
$('.btnSubmit', $.mobile.activePage)[0].click();
},
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.EnableInternetProviders = $('#chkEnableInternetProviders', form).checked();
@ -96,7 +92,7 @@
config.PreferredMetadataLanguage = $('#selectLanguage', form).val();
config.MetadataCountryCode = $('#selectCountry', form).val();
ApiClient.updateServerConfiguration(config);
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission

View file

@ -42,15 +42,11 @@
Dashboard.hideLoadingMsg();
},
submit: function () {
$('.btnSubmit', $.mobile.activePage)[0].click();
},
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.TmdbFetchedProfileSize = $('#selectTmdbPersonImageDownloadSize', form).val();
@ -79,7 +75,7 @@
config.DownloadMusicAlbumImages.Primary = $('#chkDownloadAlbumPrimary', form).checked();
config.DownloadMusicAlbumImages.Backdrops = $('#chkDownloadAlbumBackdrops', form).checked();
ApiClient.updateServerConfiguration(config);
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission

View file

@ -775,9 +775,9 @@ var Dashboard = {
href: "userprofiles.html",
selected: page.hasClass("userProfilesConfigurationPage") || (pageElem.id == "mediaLibraryPage" && getParameterByName('userId'))
}, {
name: "Display Settings",
href: "uisettings.html",
selected: pageElem.id == "displaySettingsPage"
name: "Client Settings",
href: "clientsettings.html",
selected: pageElem.id == "clientSettingsPage"
}, {
name: "Advanced",
href: "advanced.html",