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

minor dashboard cleanup

This commit is contained in:
Luke Pulverenti 2013-12-25 22:44:26 -05:00
parent 0f4e147e72
commit c24735332f
29 changed files with 285 additions and 197 deletions

View file

@ -1,6 +1,6 @@
(function ($, document, window) {
$(document).on('pageshow', "#clientSettingsPage", function () {
$(document).on('pageshow', "#appsPlaybackPage", function () {
Dashboard.showLoadingMsg();
@ -8,11 +8,9 @@
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();
@ -20,19 +18,15 @@
});
});
function clientSettingsPage() {
window.AppsPlaybackPage = {
var self = this;
self.onSubmit = function () {
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();
@ -42,9 +36,8 @@
// Disable default form submission
return false;
};
}
}
window.ClientSettingsPage = new clientSettingsPage();
};
})($, document, window);

View file

@ -0,0 +1,41 @@
(function ($, document, window) {
$(document).on('pageshow', "#appsWeatherPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
$('#txtWeatherLocation', page).val(config.WeatherLocation);
$('#selectWeatherUnit', page).val(config.WeatherUnit).selectmenu("refresh");
$('input:first', page).focus();
Dashboard.hideLoadingMsg();
});
});
window.AppsWeatherPage = {
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.WeatherLocation = $('#txtWeatherLocation', form).val();
config.WeatherUnit = $('#selectWeatherUnit', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})($, document, window);

View file

@ -293,7 +293,7 @@
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
html += '<span style="color:#267F00;margin-right:5px;font-weight:bold;"> - ' + progress + '%</span>';
html += '<button type="button" data-icon="stop" data-iconpos="notext" data-inline="true" data-theme="b" data-mini="true" onclick="DashboardPage.stopTask(\'' + task.Id + '\');">Stop</button>';
html += '<button type="button" data-icon="stop" data-iconpos="notext" data-inline="true" data-mini="true" onclick="DashboardPage.stopTask(\'' + task.Id + '\');">Stop</button>';
}
else if (task.State == "Cancelling") {
html += '<span style="color:#cc0000;"> - Stopping</span>';

View file

@ -4,7 +4,7 @@
var html = "";
html += "<option value=''>None</option>";
html += "<option value=''></option>";
var ratings = [];
var i, length, rating;

View file

@ -2,24 +2,56 @@
onPageShow: function () {
var page = this;
MediaLibraryPage.lastVirtualFolderName = "";
MediaLibraryPage.reloadLibrary(this);
MediaLibraryPage.reloadUsers(page);
$('#selectUser', page).on('change.reloadLibrary', function() {
MediaLibraryPage.reloadLibrary(page);
});
},
onPageHide: function() {
$('#selectUser', page).off('click.reloadLibrary');
},
reloadUsers: function (page) {
ApiClient.getUsers().done(function (users) {
var html = users.map(function (u) {
return '<option value="' + u.Id + '">' + u.Name + '</option>';
});
html = '<option value="">Default Library</option>' + html;
$('#selectUser', page).html(html).val('').selectmenu('refresh');
MediaLibraryPage.reloadLibrary(page);
});
},
getCurrentUserId: function(page) {
return $('#selectUser', page).val();
},
reloadLibrary: function (page) {
Dashboard.showLoadingMsg();
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId(page);
if (userId) {
$('#userProfileNavigation', page).show();
$('#defaultNavigation', page).hide();
ApiClient.getUser(userId).done(function (user) {
Dashboard.setPageTitle(user.Name);
$('#fldUseDefaultLibrary', page).show();
@ -42,9 +74,6 @@
} else {
$('#userProfileNavigation', page).hide();
$('#defaultNavigation', page).show();
ApiClient.getVirtualFolders().done(function (result) {
MediaLibraryPage.reloadVirtualFolders(page, result);
});
@ -138,8 +167,8 @@
Dashboard.showLoadingMsg();
var userId = getParameterByName("userId");
var page = $.mobile.activePage;
var userId = MediaLibraryPage.getCurrentUserId(page);
ApiClient.getUser(userId).done(function (user) {
@ -159,7 +188,7 @@
MediaLibraryPage.getTextValue("Add Media Collection", "Name (Movies, Music, TV, etc):", "", true, function (name, type) {
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
MediaLibraryPage.lastVirtualFolderName = name;
@ -180,7 +209,7 @@
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
@ -297,7 +326,7 @@
if (virtualFolder.Name != newName) {
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
@ -330,7 +359,7 @@
if (confirmResult) {
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
@ -355,7 +384,7 @@
if (confirmResult) {
var userId = getParameterByName("userId");
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
@ -380,4 +409,4 @@
}
};
$(document).on('pageshow', ".mediaLibraryPage", MediaLibraryPage.onPageShow);
$(document).on('pageshow', ".mediaLibraryPage", MediaLibraryPage.onPageShow).on('pagehide', ".mediaLibraryPage", MediaLibraryPage.onPageHide);

View file

@ -487,8 +487,8 @@ var Dashboard = {
html += '<img style="max-height:125px;max-width:200px;" src="' + imageUrl + '" />';
html += '</p>';
html += '<p><button type="button" onclick="Dashboard.navigate(\'edituser.html?userId=' + user.Id + '\');" data-icon="user">View Profile</button></p>';
html += '<p><button type="button" onclick="Dashboard.logout();" data-icon="lock">Sign Out</button></p>';
html += '<p><a data-mini="true" data-role="button" href="edituser.html?userId=' + user.Id + '" data-icon="user">View Profile</button></a>';
html += '<p><button data-mini="true" type="button" onclick="Dashboard.logout();" data-icon="lock">Sign Out</button></p>';
html += '</div>';
html += '</div>';
@ -624,7 +624,7 @@ var Dashboard = {
var html = '<div class="content-secondary ui-bar-a toolsSidebar">';
html += '<h1><a href="index.html" class="imageLink" style="margin-left: 0;margin-right: 20px;"> <img src="css/images/mblogoicon.png" /></a>Tools</h1>';
html += '<h1><a href="index.html" class="imageLink" style="margin-left: 0;margin-right: 15px;"> <img src="css/images/mblogoicon.png" style="height:28px;" /></a>Tools</h1>';
html += '<div class="sidebarLinks">';
@ -633,6 +633,10 @@ var Dashboard = {
for (var i = 0, length = links.length; i < length; i++) {
var link = links[i];
if (link.divider) {
html += "<div class='sidebarDivider'></div>";
}
if (link.href) {
@ -645,7 +649,7 @@ var Dashboard = {
}
}
html += '<a href="edititemmetadata.html" style="margin-top: 1em;">Metadata Manager</a>';
//html += '<a href="edititemmetadata.html">Metadata Manager</a>';
// collapsible
html += '</div>';
@ -666,7 +670,8 @@ var Dashboard = {
href: "dashboard.html",
selected: pageElem.id == "dashboardPage"
}, {
name: "Default Media Library",
name: "Media Library",
divider: true,
href: "library.html",
selected: pageElem.id == "mediaLibraryPage" && !getParameterByName('userId')
}, {
@ -678,15 +683,17 @@ var Dashboard = {
href: "plugins.html",
selected: page.hasClass("pluginConfigurationPage")
}, {
name: "User Profiles",
name: "Users",
divider: true,
href: "userprofiles.html",
selected: page.hasClass("userProfilesConfigurationPage") || (pageElem.id == "mediaLibraryPage" && getParameterByName('userId'))
}, {
name: "Client Settings",
href: "clientsettings.html",
selected: pageElem.id == "clientSettingsPage"
name: "App Settings",
href: "appsplayback.html",
selected: page.hasClass("appsPage")
}, {
name: "Advanced",
divider: true,
href: "advanced.html",
selected: pageElem.id == "advancedConfigurationPage"
}, {
@ -695,6 +702,7 @@ var Dashboard = {
selected: pageElem.id == "scheduledTasksPage" || pageElem.id == "scheduledTaskPage"
}, {
name: "Help",
divider: true,
href: "support.html",
selected: pageElem.id == "supportPage" || pageElem.id == "logPage" || pageElem.id == "supporterPage" || pageElem.id == "supporterKeyPage" || pageElem.id == "aboutPage"
}];