remove invitation section that would require connect

This commit is contained in:
dkanada 2019-01-16 15:01:17 +09:00
parent b8a0e1ab29
commit 50fe0d6413
2 changed files with 4 additions and 70 deletions

View File

@ -47,6 +47,7 @@ define(["loading", "appRouter", "layoutManager", "appSettings", "apphost", "focu
function showServerConnectionFailure() {
alertText(globalize.translate("MessageUnableToConnectToServer"), globalize.translate("HeaderConnectionFailure"))
}
return function(view, params) {
function connectToServer(server) {
loading.show(), connectionManager.connectToServer(server, {
@ -81,62 +82,6 @@ define(["loading", "appRouter", "layoutManager", "appSettings", "apphost", "focu
})
}
function acceptInvitation(id) {
loading.show(), connectionManager.acceptServer(id).then(function() {
loading.hide(), loadServers(), loadInvitations()
}, showGeneralError)
}
function rejectInvitation(id) {
loading.show(), connectionManager.rejectServer(id).then(function() {
loading.hide(), loadServers(), loadInvitations()
}, showGeneralError)
}
function showPendingInviteMenu(elem) {
var card = dom.parentWithClass(elem, "inviteItem"),
invitationId = card.getAttribute("data-id"),
menuItems = [];
menuItems.push({
name: globalize.translate("sharedcomponents#Accept"),
id: "accept"
}), menuItems.push({
name: globalize.translate("sharedcomponents#Reject"),
id: "reject"
}), require(["actionsheet"], function(actionsheet) {
actionsheet.show({
items: menuItems,
positionTo: elem,
callback: function(id) {
switch (id) {
case "accept":
acceptInvitation(invitationId);
break;
case "reject":
rejectInvitation(invitationId)
}
}
})
})
}
function getPendingInviteHtml(item) {
var cardBoxCssClass = "cardBox";
layoutManager.tv && (cardBoxCssClass += " cardBox-focustransform");
var innerOpening = '<div class="' + cardBoxCssClass + '">';
return '<button raised class="card overflowSquareCard loginSquareCard scalableCard overflowSquareCard-scalable btnInviteMenu inviteItem" style="display:inline-block;" data-id="' + item.Id + '">' + innerOpening + '<div class="cardScalable card-focuscontent"><div class="cardPadder cardPadder-square"></div><div class="cardContent"><div class="cardImageContainer coveredImage" style="background:#0288D1;border-radius:.15em;"><i class="cardImageIcon md-icon">&#xE1BA;</i></div></div></div><div class="cardFooter"><div class="cardText cardTextCentered">' + item.Name + "</div></div></div></button>"
}
function renderInvitations(list) {
list.length ? view.querySelector(".invitationSection").classList.remove("hide") : view.querySelector(".invitationSection").classList.add("hide");
var html = list.map(getPendingInviteHtml).join("");
view.querySelector(".invitations").innerHTML = html
}
function loadInvitations() {
connectionManager.isLoggedIntoConnect() ? connectionManager.getUserInvitations().then(renderInvitations) : renderInvitations([])
}
function onServerClick(server) {
var menuItems = [];
menuItems.push({
@ -175,7 +120,9 @@ define(["loading", "appRouter", "layoutManager", "appSettings", "apphost", "focu
var backdropUrl = staticBackdrops.getRandomImageUrl();
view.addEventListener("viewshow", function(e) {
var isRestored = e.detail.isRestored;
appRouter.setTitle(null), backdrop.setBackdrop(backdropUrl), isRestored || (loadServers(), loadInvitations())
appRouter.setTitle(null);
backdrop.setBackdrop(backdropUrl);
isRestored || loadServers();
}), view.querySelector(".servers").addEventListener("click", function(e) {
var card = dom.parentWithClass(e.target, "card");
if (card) {
@ -188,9 +135,6 @@ define(["loading", "appRouter", "layoutManager", "appSettings", "apphost", "focu
})[0])
}
}
}), view.querySelector(".invitations").addEventListener("click", function(e) {
var btnInviteMenu = dom.parentWithClass(e.target, "btnInviteMenu");
btnInviteMenu && showPendingInviteMenu(btnInviteMenu)
})
}
});

View File

@ -7,19 +7,9 @@
<div is="emby-itemscontainer" class="scrollSlider focuscontainer-x padded-left padded-right servers flex-grow" style="display: block; text-align: center;" data-hovermenu="false" data-multiselect="false"></div>
</div>
</div>
<div class="padded-top padded-left padded-right flex flex-shrink-zero justify-content-center verticalSection flex-wrap-wrap" style="margin-left:auto;margin-right:auto;">
<a is="emby-linkbutton" href="addserver.html" class="raised block cancel btnAddServer flex-shrink-zero" style="margin: .25em;">
<span>${ButtonAddServer}</span>
</a>
</div>
<div class="verticalSection invitationSection hide flex-shrink-zero flex flex-direction-column" style="margin-bottom:200px;">
<div>
<h1 class="sectionTitle sectionTitle-cards padded-left padded-right" style="text-align: center;">${Invitations}</h1>
</div>
<div is="emby-scroller" class="padded-bottom-focusscale flex-grow flex" data-mousewheel="false" data-horizontal="true" data-centerfocus="card">
<div is="emby-itemscontainer" class="scrollSlider focuscontainer-x padded-left padded-right invitations flex-grow" style="display:block;text-align:center;" data-hovermenu="false" data-multiselect="false"></div>
</div>
</div>
</div>