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

fixes #1277 - Web: Wrong position of image and buttons during "Play To"

This commit is contained in:
Luke Pulverenti 2016-08-14 01:30:31 -04:00
parent 781f63d9ac
commit b6040d998e
8 changed files with 92 additions and 164 deletions

View file

@ -59,14 +59,20 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
} catch (err) {
if (options.actions) {
options.actions = [];
show(title, options, timeoutMs);
showNonPersistentNotification(title, options, timeoutMs);
} else {
throw err;
}
}
}
function show(title, options, timeoutMs) {
function showNotification(options, timeoutMs, apiClient) {
var title = options.title;
options.data = options.data || {};
options.data.serverId = apiClient.serverInfo().Id;
options.icon = options.icon || getIconUrl();
resetRegistration();
@ -103,7 +109,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
});
}
show(notification.title, notification, 15000);
showNotification(notification, 15000, apiClient);
}
function onLibraryChanged(data, apiClient) {
@ -140,6 +146,9 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
}
function getIconUrl(name) {
name = name || 'notificationicon.png';
return require.toUrl('.').split('?')[0] + '/' + name;
}
@ -153,8 +162,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
var notification = {
tag: "install" + installation.Id,
data: {},
icon: getIconUrl('/notificationicon.png')
data: {}
};
if (status == 'completed') {
@ -173,8 +181,14 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
notification.actions =
[
{ action: 'cancel-install-' + installation.Id, title: globalize.translate('sharedcomponents#ButtonCancel')/*, icon: 'https://example/like.png'*/ }
{
action: 'cancel-install',
title: globalize.translate('sharedcomponents#ButtonCancel'),
icon: getIconUrl()
}
];
notification.data.id = installation.id;
}
if (status == 'progress') {
@ -186,7 +200,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
var timeout = status == 'cancelled' ? 5000 : 0;
show(notification.title, notification, timeout);
showNotification(notification, timeout, apiClient);
});
}
@ -210,4 +224,41 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
showPackageInstallNotification(apiClient, data, "progress");
});
events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) {
var serverId = apiClient.serverInfo().Id;
var notification = {
tag: "restart" + serverId,
title: globalize.translate('sharedcomponents#ServerNameIsShuttingDown', apiClient.serverInfo().Name)
};
showNotification(notification, 0, apiClient);
});
events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) {
var serverId = apiClient.serverInfo().Id;
var notification = {
tag: "restart" + serverId,
title: globalize.translate('sharedcomponents#ServerNameIsRestarting', apiClient.serverInfo().Name)
};
showNotification(notification, 0, apiClient);
});
events.on(serverNotifications, 'RestartRequired', function (e, apiClient, data) {
var serverId = apiClient.serverInfo().Id;
var notification = {
tag: "restart" + serverId,
title: globalize.translate('sharedcomponents#PleaseRestartServerName', apiClient.serverInfo().Name)
};
notification.actions =
[
{
action: 'restart',
title: globalize.translate('sharedcomponents#ButtonRestart'),
icon: getIconUrl()
}
];
showNotification(notification, 0, apiClient);
});
});