support opening remote control menu from dashboard

This commit is contained in:
Luke Pulverenti 2013-12-26 14:24:12 -05:00
parent 6e4a7594fc
commit 80df2d3d84
3 changed files with 26 additions and 12 deletions

View File

@ -610,7 +610,8 @@ form, .readOnlyContent {
/* Dashboard home */
.tblConnections td {
padding: .5em 0 .5em 1.25em;
padding: 1em 0 1em 1.5em;
vertical-align: top;
}
.tblConnections td:first-child {
@ -618,7 +619,7 @@ form, .readOnlyContent {
}
.tblConnections img {
height: 54px;
height: 48px;
}
.clientNowPlayingImage {

View File

@ -85,6 +85,8 @@
var table = $('.tblConnections', page);
$('.trSession', table).addClass('deadSession');
var deviceId = ApiClient.deviceId();
for (var i = 0, length = dashboardInfo.ActiveConnections.length; i < length; i++) {
@ -106,7 +108,16 @@
html += '</td>';
html += '<td>';
html += '<div>' + connection.Client + '</div>';
html += '<div>';
if (deviceId == connection.DeviceId) {
html += connection.Client;
} else {
html += '<a href="#" onclick="RemoteControl.showMenu({sessionId:\'' + connection.Id + '\'});">' + connection.Client + '</a>';
}
html += '</div>';
html += '<div>' + connection.ApplicationVersion + '</div>';
html += '<div>' + connection.DeviceName + '</div>';
html += '</td>';

View File

@ -653,7 +653,7 @@
$('.chkSelectItem:first', elem).checked(true);
}
function showMenu(sessions) {
function showMenu(sessions, options) {
var html = '<div data-role="popup" id="remoteControlFlyout" data-theme="a">';
@ -700,9 +700,9 @@
html += '<div><label for="txtMessage">Message text</label></div>';
html += '<div style="display:inline-block;width:80%;"><input id="txtMessage" name="txtMessage" type="text" /></div>';
html += '<input id="txtMessage" name="txtMessage" type="text" />';
html += '<button type="button" data-icon="mail" class="btnSendMessage" data-mini="true" data-inline="true">Send</button>';
html += '<button type="button" data-icon="mail" class="btnSendMessage" data-mini="true">Send</button>';
html += '</p>';
@ -726,8 +726,8 @@
$(this).off("popupafterclose").remove();
});
renderSessionsInControlMenu(popup, sessions);
updateSessionInfo(popup, sessions);
renderSessionsInControlMenu(popup, sessions, options);
updateSessionInfo(popup, sessions, options);
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("SessionsStart", "1000,1000");
@ -983,8 +983,10 @@
}
}
function renderSessionsInControlMenu(popup, sessions) {
function renderSessionsInControlMenu(popup, sessions, options) {
options = options || {};
var deviceId = ApiClient.deviceId();
// don't display the current session
@ -994,7 +996,7 @@
var elem = $('#selectSession', popup);
var currentValue = elem.val();
var currentValue = options.sessionId || elem.val();
if (currentValue) {
@ -1044,10 +1046,10 @@
showMenuForItem(options, ApiClient.getSessions(sessionQuery));
};
self.showMenu = function () {
self.showMenu = function (options) {
ApiClient.getSessions(sessionQuery).done(function (sessions) {
showMenu(sessions);
showMenu(sessions, options);
});
};