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

update menus

This commit is contained in:
Luke Pulverenti 2015-06-22 11:43:19 -04:00
parent aa7ea8891c
commit 02b433a97f
41 changed files with 241 additions and 5948 deletions

View file

@ -2,6 +2,8 @@
function renderJob(page, job, dialogOptions) {
require(['paperbuttonstyle']);
var html = '';
html += '<div>';
@ -12,7 +14,9 @@
html += '<br/>';
html += '<br/>';
html += '<button type="submit" data-icon="check">' + Globalize.translate('ButtonSave') + '</button>';
html += '<button type="submit" data-role="none" class="clearButton">';
html += '<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>' + Globalize.translate('ButtonSave') + '</span></paper-button>';
html += '</button>';
$('.syncJobForm', page).html(html).trigger('create');
SyncManager.renderForm({
@ -131,66 +135,80 @@
var page = $(elem).parents('.page');
var listItem = $(elem).parents('li');
var id = listItem.attr('data-itemid');
var jobItemId = listItem.attr('data-itemid');
var status = listItem.attr('data-status');
var remove = listItem.attr('data-remove').toLowerCase() == 'true';
$('.jobMenu', page).popup("close").remove();
var html = '<div data-role="popup" class="jobMenu tapHoldMenu" data-theme="a">';
html += '<ul data-role="listview" style="min-width: 180px;">';
html += '<li data-role="list-divider">' + Globalize.translate('HeaderMenu') + '</li>';
var menuItems = [];
if (status == 'Failed') {
html += '<li data-icon="check"><a href="#" class="btnRetryJobItem" data-id="' + id + '">' + Globalize.translate('ButtonQueueForRetry') + '</a></li>';
menuItems.push({
name: Globalize.translate('ButtonQueueForRetry'),
id: 'retry',
ironIcon: 'check'
});
}
else if (status == 'Cancelled') {
html += '<li data-icon="check"><a href="#" class="btnRetryJobItem" data-id="' + id + '">' + Globalize.translate('ButtonReenable') + '</a></li>';
menuItems.push({
name: Globalize.translate('ButtonReenable'),
id: 'retry',
ironIcon: 'check'
});
}
else if (status == 'Queued' || status == 'Transferring' || status == 'Converting' || status == 'ReadyToTransfer') {
html += '<li data-icon="delete"><a href="#" class="btnCancelJobItem" data-id="' + id + '">' + Globalize.translate('ButtonCancelItem') + '</a></li>';
menuItems.push({
name: Globalize.translate('ButtonCancelItem'),
id: 'cancel',
ironIcon: 'delete'
});
}
else if (status == 'Synced' && remove) {
html += '<li data-icon="check"><a href="#" class="btnUnmarkForRemoval" data-id="' + id + '">' + Globalize.translate('ButtonUnmarkForRemoval') + '</a></li>';
menuItems.push({
name: Globalize.translate('ButtonUnmarkForRemoval'),
id: 'unmarkforremoval',
ironIcon: 'check'
});
}
else if (status == 'Synced') {
html += '<li data-icon="check"><a href="#" class="btnMarkForRemoval" data-id="' + id + '">' + Globalize.translate('ButtonMarkForRemoval') + '</a></li>';
menuItems.push({
name: Globalize.translate('ButtonMarkForRemoval'),
id: 'markforremoval',
ironIcon: 'delete'
});
}
html += '</ul>';
require(['actionsheet'], function () {
html += '</div>';
ActionSheetElement.show({
items: menuItems,
positionTo: elem,
callback: function (id) {
page.append(html);
switch (id) {
var flyout = $('.jobMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () {
case 'cancel':
cancelJobItem(page, jobItemId);
break;
case 'retry':
retryJobItem(page, jobItemId);
break;
case 'markforremoval':
markForRemoval(page, jobItemId);
break;
case 'unmarkforremoval':
unMarkForRemoval(page, jobItemId);
break;
default:
break;
}
}
});
$(this).off("popupafterclose").remove();
});
$('.btnCancelJobItem', flyout).on('click', function () {
cancelJobItem(page, this.getAttribute('data-id'));
});
$('.btnRetryJobItem', flyout).on('click', function () {
retryJobItem(page, this.getAttribute('data-id'));
});
$('.btnUnmarkForRemoval', flyout).on('click', function () {
unMarkForRemoval(page, this.getAttribute('data-id'));
});
$('.btnMarkForRemoval', flyout).on('click', function () {
markForRemoval(page, this.getAttribute('data-id'));
});
}
function cancelJobItem(page, jobItemId) {
$('.jobMenu', page).popup('close');
// Need a timeout because jquery mobile will not show a popup while another is in the act of closing
Dashboard.showLoadingMsg();
@ -209,8 +227,6 @@
function markForRemoval(page, jobItemId) {
$('.jobMenu', page).popup('close');
ApiClient.ajax({
type: "POST",
@ -224,8 +240,6 @@
function unMarkForRemoval(page, jobItemId) {
$('.jobMenu', page).popup('close');
ApiClient.ajax({
type: "POST",
@ -239,8 +253,6 @@
function retryJobItem(page, jobItemId) {
$('.jobMenu', page).popup('close');
ApiClient.ajax({
type: "POST",