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

move device routes to the usual location

This commit is contained in:
dkanada 2019-03-29 15:07:26 -07:00
parent 450a72792f
commit 3eec1cf2f7
9 changed files with 8 additions and 34 deletions

View file

@ -1537,18 +1537,11 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
var btnCssClass = 'cardOverlayButton cardOverlayButton-hover itemAction';
if (playbackManager.canPlay(item)) {
html += '<button is="paper-icon-button-light" class="' + btnCssClass + ' cardOverlayFab-primary" data-action="resume"><i class="md-icon cardOverlayButtonIcon">&#xE037;</i></button>';
}
html += '<div class="cardOverlayButton-br">';
//if (itemHelper.canEdit({ Policy: { IsAdministrator: true } }, item)) {
// //require(['emby-playstatebutton']);
// html += '<button is="paper-icon-button-light" class="' + btnCssClass + '" data-action="edit"><i class="md-icon cardOverlayButtonIcon cardOverlayButtonIcon-hover">&#xE254;</i></button>';
//}
var userData = item.UserData || {};
if (itemHelper.canMarkPlayed(item)) {

View file

@ -16,16 +16,13 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
var name = ((item.Type === 'Program' || item.Type === 'Recording') && (item.IsSeries || item.EpisodeTitle) ? item.EpisodeTitle : item.Name) || '';
if (item.Type === "TvChannel") {
if (item.ChannelNumber) {
return item.ChannelNumber + ' ' + name;
}
return name;
}
if (/*options.isInlineSpecial &&*/ item.Type === "Episode" && item.ParentIndexNumber === 0) {
if (item.Type === "Episode" && item.ParentIndexNumber === 0) {
name = globalize.translate('ValueSpecialEpisodeName', name);
} else if ((item.Type === "Episode" || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null && options.includeIndexNumber !== false) {
var displayIndexNumber = item.IndexNumber;
@ -104,7 +101,7 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
var itemType = item.Type;
if (itemType === "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType === "UserView") {
if (itemType === "UserRootFolder" || itemType === "UserView") {
return false;
}

View file

@ -2,14 +2,12 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
'use strict';
function addNotificationEvent(instance, name, handler) {
var localHandler = handler.bind(instance);
events.on(serverNotifications, name, localHandler);
instance[name] = localHandler;
}
function removeNotificationEvent(instance, name) {
var handler = instance[name];
if (handler) {
events.off(serverNotifications, name, handler);
@ -25,31 +23,22 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
var apiClient = connectionManager.getApiClient(serverId);
if (!button.classList.contains('playstatebutton-played')) {
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
setState(button, true);
} else {
apiClient.markUnplayed(apiClient.getCurrentUserId(), id, new Date());
setState(button, false);
}
}
function onUserDataChanged(e, apiClient, userData) {
var button = this;
if (userData.ItemId === button.getAttribute('data-id')) {
setState(button, userData.Played);
}
}
function setState(button, played, updateAttribute) {
var icon = button.iconElement;
if (!icon) {
button.iconElement = button.querySelector('i');
@ -57,18 +46,13 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
}
if (played) {
button.classList.add('playstatebutton-played');
if (icon) {
icon.classList.add('playstatebutton-icon-played');
icon.classList.remove('playstatebutton-icon-unplayed');
}
} else {
button.classList.remove('playstatebutton-played');
if (icon) {
icon.classList.remove('playstatebutton-icon-played');
icon.classList.add('playstatebutton-icon-unplayed');

View file

@ -43,7 +43,7 @@ define(["loading", "dom", "libraryMenu", "globalize", "humanedate", "emby-button
callback: function(id) {
switch (id) {
case "open":
Dashboard.navigate("devices/device.html?id=" + deviceId);
Dashboard.navigate("device.html?id=" + deviceId);
break;
case "delete":
deleteDevice(view, deviceId)
@ -57,7 +57,7 @@ define(["loading", "dom", "libraryMenu", "globalize", "humanedate", "emby-button
var html = "";
html += devices.map(function(device) {
var deviceHtml = "";
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>", deviceHtml += '<div class="cardBox visualCardBox">', deviceHtml += '<div class="cardScalable">', deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>', deviceHtml += '<a is="emby-linkbutton" href="' + (canEdit ? "devices/device.html?id=" + device.Id : "#") + '" class="cardContent cardImageContainer">';
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>", deviceHtml += '<div class="cardBox visualCardBox">', deviceHtml += '<div class="cardScalable">', deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>', deviceHtml += '<a is="emby-linkbutton" href="' + (canEdit ? "device.html?id=" + device.Id : "#") + '" class="cardContent cardImageContainer">';
var iconUrl = device.IconUrl;
return iconUrl && -1 === iconUrl.indexOf("://") && (iconUrl = ApiClient.getUrl(iconUrl)), iconUrl ? (deviceHtml += '<div class="cardImage" style="background-image:url(\'' + iconUrl + "');background-size: auto 64%;background-position:center center;\">", deviceHtml += "</div>") : deviceHtml += '<i class="cardImageIcon md-icon">tablet_android</i>', deviceHtml += "</a>", deviceHtml += "</div>", deviceHtml += '<div class="cardFooter">', (canEdit || canDelete(device.Id)) && (deviceHtml += '<div style="text-align:right; float:right;padding-top:5px;">', deviceHtml += '<button type="button" is="paper-icon-button-light" data-id="' + device.Id + '" title="' + globalize.translate("Menu") + '" class="btnDeviceMenu"><i class="md-icon">&#xE5D3;</i></button>', deviceHtml += "</div>"), deviceHtml += "<div class='cardText'>", deviceHtml += device.Name, deviceHtml += "</div>", deviceHtml += "<div class='cardText cardText-secondary'>", deviceHtml += device.AppName + " " + device.AppVersion, deviceHtml += "</div>", deviceHtml += "<div class='cardText cardText-secondary'>", device.LastUserName && (deviceHtml += device.LastUserName, deviceHtml += ", " + humane_date(device.DateLastActivity)), deviceHtml += "&nbsp;", deviceHtml += "</div>", deviceHtml += "</div>", deviceHtml += "</div>", deviceHtml += "</div>"
}).join(""), page.querySelector(".devicesList").innerHTML = html

View file

@ -33,7 +33,7 @@
</div>
<div class="dashboardSection" style="padding-left: 0;">
<a is="emby-linkbutton" href="devices/devices.html" style="margin-left:.8em!important;" class="button-flat sectionTitleTextButton">
<a is="emby-linkbutton" href="devices.html" style="margin-left:.8em!important;" class="button-flat sectionTitleTextButton">
<h3 style="margin:0;">${HeaderActiveDevices}</h3>
<i class="md-icon">&#xE5CC;</i>
</a>

View file

@ -307,7 +307,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
});
links.push({
name: globalize.translate("TabDevices"),
href: "devices/devices.html",
href: "devices.html",
pageIds: ["devicesPage", "devicePage"],
icon: "devices"
});

View file

@ -62,13 +62,13 @@ define([
controller: "dashboardhosting"
});
defineRoute({
path: "/devices/devices.html",
path: "/devices.html",
autoFocus: false,
roles: "admin",
controller: "devices"
});
defineRoute({
path: "/devices/device.html",
path: "/device.html",
autoFocus: false,
roles: "admin",
controller: "device"