-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71b5617
commit 083535a
Showing
22 changed files
with
349 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
MediaBrowser.WebDashboard/dashboard-ui/components/recordingeditor/recordingeditor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
define(['dialogHelper', 'loading', 'jQuery', 'paper-checkbox', 'paper-input', 'emby-collapsible', 'paper-button', 'paper-icon-button-light'], function (dialogHelper, loading, $) { | ||
|
||
var currentDialog; | ||
var recordingUpdated = false; | ||
var currentItemId; | ||
|
||
function renderTimer(context, item) { | ||
|
||
var programInfo = item.ProgramInfo || {}; | ||
|
||
$('.itemName', context).html(item.Name); | ||
|
||
$('.itemEpisodeName', context).html(programInfo.EpisodeTitle || ''); | ||
|
||
$('.itemCommunityRating', context).html(LibraryBrowser.getRatingHtml(programInfo)); | ||
|
||
LibraryBrowser.renderGenres($('.itemGenres', context), programInfo); | ||
LibraryBrowser.renderOverview(context.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', context).css("display", "inline-block") | ||
.html('<img src="' + imgUrl + '" style="max-width:200px;max-height:200px;" />'); | ||
|
||
} else { | ||
$('.timerPageImageContainer', context).hide(); | ||
} | ||
|
||
$('.itemMiscInfo', context).html(LibraryBrowser.getMiscInfoHtml(programInfo)); | ||
|
||
$('#txtPrePaddingMinutes', context).val(item.PrePaddingSeconds / 60); | ||
$('#txtPostPaddingMinutes', context).val(item.PostPaddingSeconds / 60); | ||
|
||
if (item.Status == 'New') { | ||
$('.timerStatus', context).hide(); | ||
} else { | ||
$('.timerStatus', context).show().html('Status: ' + item.Status); | ||
} | ||
|
||
loading.hide(); | ||
} | ||
|
||
function closeDialog(isSubmitted) { | ||
|
||
recordingUpdated = isSubmitted; | ||
dialogHelper.close(currentDialog); | ||
} | ||
|
||
function onSubmit(e) { | ||
|
||
loading.show(); | ||
|
||
var form = this; | ||
|
||
ApiClient.getLiveTvTimer(currentItemId).then(function (item) { | ||
|
||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60; | ||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60; | ||
ApiClient.updateLiveTvTimer(item).then(function () { | ||
loading.hide(); | ||
require(['toast'], function (toast) { | ||
toast(Globalize.translate('MessageRecordingSaved')); | ||
closeDialog(true); | ||
}); | ||
}); | ||
}); | ||
|
||
e.preventDefault(); | ||
|
||
// Disable default form submission | ||
return false; | ||
} | ||
|
||
function init(context) { | ||
|
||
context.querySelector('.btnCancel').addEventListener('click', function () { | ||
|
||
closeDialog(false); | ||
}); | ||
|
||
context.querySelector('form').addEventListener('submit', onSubmit); | ||
|
||
context.querySelector('.btnHeaderSave').addEventListener('click', function (e) { | ||
|
||
context.querySelector('.btnSave').click(); | ||
}); | ||
} | ||
|
||
function reload(context, id) { | ||
|
||
loading.show(); | ||
currentItemId = id; | ||
|
||
ApiClient.getLiveTvTimer(id).then(function (result) { | ||
|
||
renderTimer(context, result); | ||
loading.hide(); | ||
}); | ||
} | ||
|
||
function showEditor(itemId) { | ||
|
||
return new Promise(function (resolve, reject) { | ||
|
||
recordingUpdated = false; | ||
loading.show(); | ||
|
||
var xhr = new XMLHttpRequest(); | ||
xhr.open('GET', 'components/recordingeditor/recordingeditor.template.html', true); | ||
|
||
xhr.onload = function (e) { | ||
|
||
var template = this.response; | ||
var dlg = dialogHelper.createDialog({ | ||
removeOnClose: true, | ||
size: 'small' | ||
}); | ||
|
||
dlg.classList.add('ui-body-b'); | ||
dlg.classList.add('background-theme-b'); | ||
|
||
dlg.classList.add('formDialog'); | ||
|
||
var html = ''; | ||
|
||
html += Globalize.translateDocument(template); | ||
|
||
dlg.innerHTML = html; | ||
document.body.appendChild(dlg); | ||
|
||
dialogHelper.open(dlg); | ||
|
||
currentDialog = dlg; | ||
|
||
dlg.addEventListener('close', function () { | ||
|
||
if (recordingUpdated) { | ||
resolve(); | ||
} else { | ||
reject(); | ||
} | ||
}); | ||
|
||
init(dlg); | ||
|
||
reload(dlg, itemId); | ||
} | ||
|
||
xhr.send(); | ||
}); | ||
} | ||
|
||
return { | ||
show: showEditor | ||
}; | ||
}); |
Oops, something went wrong.