From f0f5c26a2c40f8d3cec613da1ff47d218fbf1186 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 29 Aug 2015 20:40:52 -0400 Subject: [PATCH] update select server --- dashboard-ui/apiclient/connectionmanager.js | 21 +- dashboard-ui/apiclient/credentials.js | 3 + dashboard-ui/cordova/registrationservices.js | 9 + dashboard-ui/css/librarybrowser.css | 17 ++ dashboard-ui/css/pluginupdates.css | 11 - dashboard-ui/scripts/itemdetailpage.js | 2 +- dashboard-ui/scripts/selectserver.js | 193 ++++++------------ dashboard-ui/selectserver.html | 11 +- .../jquery.mobile.custom.theme.css | 6 - 9 files changed, 119 insertions(+), 154 deletions(-) delete mode 100644 dashboard-ui/css/pluginupdates.css diff --git a/dashboard-ui/apiclient/connectionmanager.js b/dashboard-ui/apiclient/connectionmanager.js index de9805c07..9c261cbc9 100644 --- a/dashboard-ui/apiclient/connectionmanager.js +++ b/dashboard-ui/apiclient/connectionmanager.js @@ -1232,31 +1232,42 @@ self.deleteServer = function (serverId) { - var connectToken = self.connectToken(); - if (!serverId) { throw new Error("null serverId"); } + var server = credentialProvider.credentials().Servers.filter(function (s) { + return s.Id == serverId; + }); + server = server.length ? server[0] : null; + var deferred = DeferredBuilder.Deferred(); function onDone() { var credentials = credentialProvider.credentials(); credentials.Servers = credentials.Servers.filter(function (s) { - return s.ConnectServerId != serverId; + return s.Id != serverId; }); credentialProvider.credentials(credentials); deferred.resolve(); } - if (!connectToken || !self.connectUserId()) { + if (!server.ConnectServerId) { onDone(); return deferred.promise(); } - var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId(); + var connectToken = self.connectToken(); + var connectUserId = self.connectUserId(); + + if (!connectToken || !connectUserId) { + onDone(); + return deferred.promise(); + } + + var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + server.ConnectServerId + "&userId=" + connectUserId; HttpClient.send({ type: "DELETE", diff --git a/dashboard-ui/apiclient/credentials.js b/dashboard-ui/apiclient/credentials.js index 1633b7577..f379e142a 100644 --- a/dashboard-ui/apiclient/credentials.js +++ b/dashboard-ui/apiclient/credentials.js @@ -96,6 +96,9 @@ if (server.LastConnectionMode != null) { existing.LastConnectionMode = server.LastConnectionMode; } + if (server.ConnectServerId) { + existing.ConnectServerId = server.ConnectServerId; + } existing.DateLastLocalConnection = Math.max(existing.DateLastLocalConnection || 0, server.DateLastLocalConnection || 0); return existing; diff --git a/dashboard-ui/cordova/registrationservices.js b/dashboard-ui/cordova/registrationservices.js index 3bc37f600..75e8968cd 100644 --- a/dashboard-ui/cordova/registrationservices.js +++ b/dashboard-ui/cordova/registrationservices.js @@ -49,11 +49,19 @@ return ConnectionManager.getRegistrationInfo(feature, ApiClient); } + var validatedFeatures = []; + function validateFeature(id, deferred) { + if (validatedFeatures.indexOf(id) != -1) { + deferred.resolve(); + return; + } + var info = IapManager.getProductInfo(id) || {}; if (info.owned) { + validatedFeatures.push(id); deferred.resolve(); return; } @@ -71,6 +79,7 @@ getRegistrationInfo(prefix + 'appunlock', productInfo.enableSupporterUnlock).done(function (registrationInfo) { if (registrationInfo.IsRegistered) { + validatedFeatures.push(id); deferred.resolve(); return; } diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 41bb40ea5..74daf517b 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -525,6 +525,11 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { .primaryDetailsContainer { float: left; padding: .75em 0 0 1.5em; + width: 68%; +} + +.portraitDetailImageContainer + .primaryDetailsContainer { + width: 75%; } .parentName { @@ -557,9 +562,21 @@ span.itemCommunityRating:not(:empty) + .userDataIcons { @media all and (max-width: 1000px) { + .primaryDetailsContainer { + width: 64%; + } + + .portraitDetailImageContainer + .primaryDetailsContainer { + width: 72%; + } + .detailImageContainer img { max-width: 240px; } + + .portraitDetailImageContainer img { + max-width: 180px; + } } @media all and (max-width: 800px) { diff --git a/dashboard-ui/css/pluginupdates.css b/dashboard-ui/css/pluginupdates.css deleted file mode 100644 index 6aaeb8456..000000000 --- a/dashboard-ui/css/pluginupdates.css +++ /dev/null @@ -1,11 +0,0 @@ -/* - Plugin updates Page - */ -#pluginUpdatesForm table { - width: 100%; -} - -#pluginUpdatesForm td + td { - text-align: center; - -} \ No newline at end of file diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index b88b8d72d..17736d04f 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -411,7 +411,7 @@ var topOverview = page.querySelector('.topOverview'); var bottomOverview = page.querySelector('.bottomOverview'); - var seasonOnBottom = screen.availHeight < 1080 || screen.availWidth < 1920; + var seasonOnBottom = screen.availHeight < 600 || screen.availWidth < 600; if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom) || (item.Type == 'Series' && seasonOnBottom)) { LibraryBrowser.renderOverview([bottomOverview], item); diff --git a/dashboard-ui/scripts/selectserver.js b/dashboard-ui/scripts/selectserver.js index 811744eba..69732078a 100644 --- a/dashboard-ui/scripts/selectserver.js +++ b/dashboard-ui/scripts/selectserver.js @@ -48,61 +48,29 @@ var html = ''; - var cssClass = "card squareCard bottomPaddedCard"; + html += ''; - html += "
"; + html += ''; - html += '
'; - html += '
'; + html += ''; + html += ''; - html += '
'; - - var href = server.href || "#"; - html += '
'; - - var imgUrl = server.Id == 'connect' ? 'css/images/logo536.png' : ''; - - if (imgUrl) { - html += '"; - - html += '
'; - - if (server.showOptions !== false) { - html += '
'; - html += ''; - html += "
"; - } - - html += '
'; + html += '
'; html += server.Name; - html += "
"; + html += '
'; - html += '
'; - html += ' '; - html += "
"; + html += '
'; + html += MediaBrowser.ServerInfo.getServerAddress(server, server.LastConnectionMode); + html += '
'; - // cardFooter - html += "
"; + html += ''; + html += '
'; - // cardBox - html += "
"; + if (server.Id) { + html += ''; + } - // card - html += "
"; + html += ''; return html; } @@ -111,8 +79,10 @@ if (servers.length) { $('.noServersMessage', page).hide(); + $('.serverList', page).show(); } else { $('.noServersMessage', page).show(); + $('.serverList', page).hide(); } var html = ''; @@ -123,16 +93,14 @@ $('.lnkServer', elem).on('click', function () { - var id = this.getAttribute('data-serverid'); + var item = $(this).parents('.serverItem')[0]; + var id = item.getAttribute('data-id'); - if (id != 'new' && id != 'connect') { + var server = servers.filter(function (s) { + return s.Id == id; + })[0]; - var server = servers.filter(function (s) { - return s.Id == id; - })[0]; - - connectToServer(page, server); - } + connectToServer(page, server); }); @@ -170,12 +138,12 @@ }); } - function deleteServer(page, id) { + function deleteServer(page, serverId) { Dashboard.showModalLoadingMsg(); // Add/Update connect info - ConnectionManager.deleteServer(id).done(function () { + ConnectionManager.deleteServer(serverId).done(function () { Dashboard.hideModalLoadingMsg(); @@ -208,10 +176,9 @@ function showServerMenu(elem) { - var card = $(elem).parents('.card'); + var card = $(elem).parents('.serverItem'); var page = $(elem).parents('.page'); var serverId = card.attr('data-id'); - var connectserverid = card.attr('data-connectserverid'); var menuItems = []; @@ -231,7 +198,7 @@ switch (id) { case 'delete': - deleteServer(page, connectserverid); + deleteServer(page, serverId); break; default: break; @@ -244,40 +211,45 @@ function showPendingInviteMenu(elem) { - var card = $(elem).parents('.card'); + var card = $(elem).parents('.inviteItem'); var page = $(elem).parents('.page'); - var id = card.attr('data-id'); + var invitationId = card.attr('data-id'); - $('.inviteMenu', page).popup("close").remove(); - - var html = '
'; - - html += ''; - - html += '
'; - - page.append(html); - - var flyout = $('.inviteMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () { - - $(this).off("popupafterclose").remove(); + var menuItems = []; + menuItems.push({ + name: Globalize.translate('ButtonAccept'), + id: 'accept', + ironIcon: 'add' }); - $('.btnAccept', flyout).on('click', function () { - acceptInvitation(page, this.getAttribute('data-id')); - $('.inviteMenu', page).popup("close").remove(); + menuItems.push({ + name: Globalize.translate('ButtonReject'), + id: 'reject', + ironIcon: 'cancel' }); - $('.btnReject', flyout).on('click', function () { - rejectInvitation(page, this.getAttribute('data-id')); - $('.inviteMenu', page).popup("close").remove(); + require(['actionsheet'], function () { + + ActionSheetElement.show({ + items: menuItems, + positionTo: elem, + callback: function (id) { + + switch (id) { + + case 'accept': + acceptInvitation(page, invitationId); + break; + case 'reject': + rejectInvitation(page, invitationId); + break; + default: + break; + } + } + }); + }); } @@ -285,50 +257,21 @@ var html = ''; - var cssClass = "card squareCard alternateHover bottomPaddedCard"; + html += ''; - html += "
"; + html += ''; - html += '
'; - html += '
'; + html += ''; - html += '
'; - - var href = "#"; - html += ''; - - html += '
'; - html += ''; - html += "
"; - - // cardContent - html += "
"; - - // cardScalable - html += "
"; - - html += '
'; - - html += '
'; - html += ''; - html += "
"; - - html += '
'; + html += '
'; html += invite.Name; - html += "
"; + html += '
'; - html += '
'; - html += ' '; - html += "
"; + html += ''; - // cardFooter - html += "
"; + html += ''; - // cardBox - html += "
"; - - // card - html += "
"; + html += '
'; return html; } @@ -371,8 +314,6 @@ Dashboard.showLoadingMsg(); - Backdrops.setDefault(page); - ConnectionManager.getAvailableServers().done(function (servers) { servers = servers.slice(0); diff --git a/dashboard-ui/selectserver.html b/dashboard-ui/selectserver.html index b9483f116..d25c13879 100644 --- a/dashboard-ui/selectserver.html +++ b/dashboard-ui/selectserver.html @@ -8,24 +8,25 @@
-
+

${HeaderSelectServer}

${ButtonHelp}
-
+

-
+ -