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

move recording editor to popup

This commit is contained in:
Luke Pulverenti 2016-05-09 23:36:43 -04:00
parent 25f06c166b
commit 4d7b51f730
19 changed files with 322 additions and 248 deletions

View file

@ -2051,7 +2051,7 @@
Dashboard.getCurrentUser().then(function (user) {
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
LibraryBrowser.showMoreCommands(button, currentItem.Id, currentItem.Type, LibraryBrowser.getMoreCommands(currentItem, user));
});
});

View file

@ -776,7 +776,15 @@
});
},
showMoreCommands: function (positionTo, itemId, commands) {
editTimer: function (id) {
require(['components/recordingeditor/recordingeditor'], function (recordingeditor) {
recordingeditor.show(id);
});
},
showMoreCommands: function (positionTo, itemId, itemType, commands) {
var items = [];
@ -913,7 +921,11 @@
break;
}
case 'edit':
LibraryBrowser.editMetadata(itemId);
if (itemType == 'Timer') {
LibraryBrowser.editTimer(itemId);
} else {
LibraryBrowser.editMetadata(itemId);
}
break;
case 'editsubtitles':
LibraryBrowser.editSubtitles(itemId);
@ -1049,9 +1061,6 @@
return "itemdetails.html?id=" + id;
}
if (item.Type == "Timer") {
return "livetvtimer.html?id=" + id;
}
if (item.Type == "BoxSet") {
return "itemdetails.html?id=" + id;
}
@ -2195,6 +2204,10 @@
html += LibraryBrowser.getGroupCountIndicator(item);
}
if (item.SeriesTimerId) {
html += '<iron-icon icon="fiber-smart-record" class="seriesTimerIndicator"></iron-icon>';
}
html += LibraryBrowser.getSyncIndicator(item);
if (mediaSourceCount > 1) {
@ -3470,9 +3483,9 @@
else if (item.TimerId) {
var html = '';
html += '<a href="livetvtimer.html?id=' + item.TimerId + '">';
html += '<button type="button" class="clearButton" onclick="LibraryBrowser.editTimer(\'' + item.TimerId + '\');">';
html += '<div class="timerCircle"></div>';
html += '</a>';
html += '</button>';
miscInfo.push(html);
require(['livetvcss']);
}

View file

@ -532,7 +532,11 @@
break;
}
case 'edit':
LibraryBrowser.editMetadata(itemId);
if (itemType == 'Timer') {
LibraryBrowser.editTimer(itemId);
} else {
LibraryBrowser.editMetadata(itemId);
}
break;
case 'refresh':
ApiClient.refreshItem(itemId, {
@ -555,7 +559,11 @@
MediaController.shuffle(itemId);
break;
case 'open':
Dashboard.navigate(href);
if (itemType == 'Timer') {
LibraryBrowser.editTimer(itemId);
} else {
Dashboard.navigate(href);
}
break;
case 'album':
Dashboard.navigate('itemdetails.html?id=' + albumid);
@ -1378,6 +1386,15 @@
MediaController.instantMix(itemId);
}
else if (action == 'edit') {
var itemType = elemWithAttributes.getAttribute('data-itemtype');
if (itemType == 'Timer') {
LibraryBrowser.editTimer(itemId);
} else {
LibraryBrowser.editMetadata(itemId);
}
}
e.stopPropagation();
e.preventDefault();

View file

@ -74,7 +74,8 @@
showChannelName: true,
lazy: true,
cardLayout: true,
showDetailsMenu: true
showDetailsMenu: true,
defaultAction: 'edit'
});
html += '</div>';

View file

@ -1,130 +0,0 @@
define(['jQuery'], function ($) {
var currentItem;
function deleteTimer(page, id) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
ApiClient.cancelLiveTvTimer(id).then(function () {
require(['toast'], function (toast) {
toast(Globalize.translate('MessageRecordingCancelled'));
});
Dashboard.navigate('livetv.html');
});
});
});
}
function renderTimer(page, item) {
currentItem = item;
var programInfo = item.ProgramInfo || {};
$('.itemName', page).html(item.Name);
$('.itemEpisodeName', page).html(programInfo.EpisodeTitle || '');
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(programInfo));
LibraryBrowser.renderGenres($('.itemGenres', page), programInfo);
LibraryBrowser.renderOverview(page.querySelectorAll('.itemOverview'), programInfo);
if (programInfo.ImageTags && programInfo.ImageTags.Primary) {
var imgUrl = ApiClient.getScaledImageUrl(programInfo.Id, {
maxWidth: 200,
maxHeight: 200,
tag: programInfo.ImageTags.Primary,
type: "Primary"
});
$('.timerPageImageContainer', page).css("display", "inline-block")
.html('<img src="' + imgUrl + '" style="max-width:200px;max-height:200px;" />');
} else {
$('.timerPageImageContainer', page).hide();
}
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(programInfo));
$('#txtPrePaddingMinutes', page).val(item.PrePaddingSeconds / 60);
$('#txtPostPaddingMinutes', page).val(item.PostPaddingSeconds / 60);
if (item.Status == 'New') {
$('.timerStatus', page).hide();
} else {
$('.timerStatus', page).show().html('Status:&nbsp;&nbsp;&nbsp;' + item.Status);
}
Dashboard.hideLoadingMsg();
}
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getLiveTvTimer(currentItem.Id).then(function (item) {
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
ApiClient.updateLiveTvTimer(item).then(function () {
Dashboard.hideLoadingMsg();
require(['toast'], function (toast) {
toast(Globalize.translate('MessageRecordingSaved'));
});
});
});
// Disable default form submission
return false;
}
function reload(page) {
Dashboard.showLoadingMsg();
var id = getParameterByName('id');
ApiClient.getLiveTvTimer(id).then(function (result) {
renderTimer(page, result);
});
}
$(document).on('pageinit', "#liveTvTimerPage", function () {
var page = this;
$('#btnCancelTimer', page).on('click', function () {
deleteTimer(page, currentItem.Id);
});
$('.liveTvTimerForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pagebeforeshow', "#liveTvTimerPage", function () {
var page = this;
reload(page);
}).on('pagebeforehide', "#liveTvTimerPage", function () {
currentItem = null;
});
});

View file

@ -2628,12 +2628,6 @@ var AppInfo = {};
roles: 'admin'
});
defineRoute({
path: '/livetvtimer.html',
dependencies: ['scrollStyles'],
autoFocus: false
});
defineRoute({
path: '/livetvtunerprovider-hdhomerun.html',
dependencies: [],