add path picker

This commit is contained in:
Luke Pulverenti 2016-06-03 16:01:16 -04:00
parent 8edd6fc958
commit 5406262f6b
3 changed files with 34 additions and 4 deletions

View File

@ -1,4 +1,4 @@
define(['jQuery', 'paper-checkbox', 'paper-button', 'emby-input', 'paper-item-body', 'paper-icon-item'], function ($) {
define(['jQuery', 'paper-checkbox', 'paper-button', 'emby-input', 'paper-item-body', 'paper-icon-item', 'paper-icon-button-light'], function ($) {
return function (page, providerId, options) {
@ -153,6 +153,27 @@
page.querySelector('.btnSubmitListingsContainer').click();
};
function onSelectPathClick(e) {
var page = $(e.target).parents('.xmltvForm')[0];
require(['directorybrowser'], function (directoryBrowser) {
var picker = new directoryBrowser();
picker.show({
callback: function (path) {
if (path) {
var txtPath = page.querySelector('.txtPath');
txtPath.value = path;
txtPath.focus();
}
picker.close();
}
});
});
}
self.init = function () {
options = options || {};
@ -174,6 +195,8 @@
return false;
});
page.querySelector('#btnSelectPath').addEventListener("click", onSelectPathClick);
page.querySelector('.chkAllTuners').addEventListener('change', function (e) {
if (e.target.checked) {
page.querySelector('.selectTunersSection').classList.add('hide');

View File

@ -1,9 +1,15 @@
<h1>Xml TV</h1>
<form>
<form class="xmltvForm">
<div>
<div class="inputContainer">
<input is="emby-input" class="txtPath" label="${LabelPath}" required="required" autocomplete="off" />
<div style="display: flex; align-items: center;">
<div style="flex-grow:1;">
<input is="emby-input" class="txtPath" label="${LabelPath}" required="required" autocomplete="off" />
</div>
<button type="button" is="paper-icon-button-light" id="btnSelectPath"><iron-icon icon="search"></iron-icon></button>
</div>
<div class="fieldDescription">${XmlTvPathHelp}</div>
</div>
<div class="inputContainer">
<input is="emby-input" class="txtKids" label="${LabelKidsCategories}" autocomplete="off" />

View File

@ -2363,5 +2363,6 @@
"LabelNewsCategories": "News categories:",
"XmlTvNewsCategoriesHelp": "Programs with these categories will be displayed as news programs. Separate multiple with '|'.",
"LabelKidsCategories": "Children's categories:",
"XmlTvKidsCategoriesHelp": "Programs with these categories will be displayed as programs for children. Separate multiple with '|'."
"XmlTvKidsCategoriesHelp": "Programs with these categories will be displayed as programs for children. Separate multiple with '|'.",
"XmlTvPathHelp": "A path to an xml tv file. Emby will read this file and periodically check it for updates. You are responsible for creating and updating the file."
}