From 92bca2bd4028466c051aa90aca245387b9035953 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 May 2016 10:11:15 -0400 Subject: [PATCH 1/4] update components --- .../bower_components/emby-webcomponents/.bower.json | 8 ++++---- .../emby-webcomponents/actionsheet/actionsheet.css | 4 ++-- .../bower_components/emby-webcomponents/datetime.js | 1 + dashboard-ui/bower_components/polymer/.bower.json | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index e82737fc4..3d19b423c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.2.61", - "_release": "1.2.61", + "version": "1.2.62", + "_release": "1.2.62", "_resolution": { "type": "version", - "tag": "1.2.61", - "commit": "d28f24510d524454f235f9f83979639e8b0913d6" + "tag": "1.2.62", + "commit": "33db92857995b9f96342d5b966d1ad5df27ed278" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.css b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.css index 6fa8ee118..f0ed4b55b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.css +++ b/dashboard-ui/bower_components/emby-webcomponents/actionsheet/actionsheet.css @@ -61,8 +61,8 @@ } .layout-tv .actionSheetMenuItem { - padding-top: .6em; - padding-bottom: .6em; + padding-top: .2em; + padding-bottom: .2em; } .actionSheetItemIcon { diff --git a/dashboard-ui/bower_components/emby-webcomponents/datetime.js b/dashboard-ui/bower_components/emby-webcomponents/datetime.js index dc9f11309..50c8fbc61 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/datetime.js +++ b/dashboard-ui/bower_components/emby-webcomponents/datetime.js @@ -134,6 +134,7 @@ if (timeLower.indexOf('am') != -1 || timeLower.indexOf('pm') != -1) { + time = timeLower; var hour = date.getHours() % 12; var suffix = date.getHours() > 11 ? 'pm' : 'am'; if (!hour) { diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json index bbad7fe7b..3e8a4009a 100644 --- a/dashboard-ui/bower_components/polymer/.bower.json +++ b/dashboard-ui/bower_components/polymer/.bower.json @@ -34,6 +34,6 @@ "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514" }, "_source": "git://github.com/Polymer/polymer.git", - "_target": "^1.1.0", + "_target": "^1.0.0", "_originalSource": "Polymer/polymer" } \ No newline at end of file From 58bb39c2d1678fd535badc60ffa751e88e1d5abf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 May 2016 13:49:58 -0400 Subject: [PATCH 2/4] update icons --- .../emby-apiclient/.bower.json | 8 +-- .../emby-apiclient/connectionmanager.js | 2 +- .../emby-webcomponents/.bower.json | 8 +-- .../emby-webcomponents/alert/alert.js | 11 +++- .../emby-webcomponents/layoutmanager.js | 4 +- .../emby-webcomponents/prompt/prompt.js | 11 +++- .../emby-webcomponents/slideshow/slideshow.js | 32 ++++++----- .../emby-webcomponents/slideshow/style.css | 4 +- .../bower_components/iron-icon/.bower.json | 6 +- .../iron-selector/.bower.json | 4 +- .../metadataeditor/metadataeditor.js | 2 +- dashboard-ui/css/librarymenu.css | 3 +- dashboard-ui/css/notifications.css | 4 +- .../css/polymer/paper-icon-button-light.css | 19 +++++++ dashboard-ui/css/site.css | 14 ++--- dashboard-ui/scripts/librarymenu.js | 55 ++++++------------- dashboard-ui/scripts/site.js | 2 +- 17 files changed, 101 insertions(+), 88 deletions(-) create mode 100644 dashboard-ui/css/polymer/paper-icon-button-light.css diff --git a/dashboard-ui/bower_components/emby-apiclient/.bower.json b/dashboard-ui/bower_components/emby-apiclient/.bower.json index b0c2f515b..afe0e821c 100644 --- a/dashboard-ui/bower_components/emby-apiclient/.bower.json +++ b/dashboard-ui/bower_components/emby-apiclient/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.1.54", - "_release": "1.1.54", + "version": "1.1.55", + "_release": "1.1.55", "_resolution": { "type": "version", - "tag": "1.1.54", - "commit": "80b29ca19f79c58f1b9e7f105c5b637761a9c5f9" + "tag": "1.1.55", + "commit": "c985db6d4a2c6013dcb3bcb200532144a909732c" }, "_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git", "_target": "^1.1.51", diff --git a/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js b/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js index 6ae1796ab..45eed983d 100644 --- a/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js +++ b/dashboard-ui/bower_components/emby-apiclient/connectionmanager.js @@ -215,7 +215,7 @@ return connectUser; }; - var minServerVersion = '3.0.5785'; + var minServerVersion = '3.0.5818'; self.minServerVersion = function (val) { if (val) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 3d19b423c..57edd2e79 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -16,12 +16,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.2.62", - "_release": "1.2.62", + "version": "1.2.65", + "_release": "1.2.65", "_resolution": { "type": "version", - "tag": "1.2.62", - "commit": "33db92857995b9f96342d5b966d1ad5df27ed278" + "tag": "1.2.65", + "commit": "882a508b902015305d2058b236131c53f95f320a" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.0", diff --git a/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js b/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js index f347c0bc7..5bb807da8 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js +++ b/dashboard-ui/bower_components/emby-webcomponents/alert/alert.js @@ -1,4 +1,11 @@ -define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.html', 'css!./../prompt/style.css', 'paper-button', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { +define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.html', 'css!./../prompt/style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { + + function getIcon(icon, cssClass, canFocus, autoFocus) { + + var tabIndex = canFocus ? '' : ' tabindex="-1"'; + autoFocus = autoFocus ? ' autofocus' : ''; + return ''; + } return function (options) { @@ -37,7 +44,7 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.h html += '
'; if (backButton) { - html += ''; + html += getIcon('dialog:arrow-back', 'btnPromptExit', false); } if (options.title) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js b/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js index 62b2be20b..2776d4d38 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/layoutmanager.js @@ -1,4 +1,4 @@ -define(['browser', 'appSettings'], function (browser, appSettings) { +define(['browser', 'appSettings', 'events'], function (browser, appSettings, events) { function setLayout(self, layout, selectedLayout) { @@ -32,6 +32,8 @@ define(['browser', 'appSettings'], function (browser, appSettings) { appSettings.set('layout', layout); } } + + events.trigger(self, 'modechange'); }; self.getSavedLayout = function (layout) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js b/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js index ff0b701fa..ef629db1c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js +++ b/dashboard-ui/bower_components/emby-webcomponents/prompt/prompt.js @@ -1,4 +1,11 @@ -define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css!./style.css', 'paper-button', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { +define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css!./style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { + + function getIcon(icon, cssClass, canFocus, autoFocus) { + + var tabIndex = canFocus ? '' : ' tabindex="-1"'; + autoFocus = autoFocus ? ' autofocus' : ''; + return ''; + } return function (options) { @@ -36,7 +43,7 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css html += '
'; if (backButton) { - html += ''; + html += getIcon('dialog:arrow-back', 'btnPromptExit', false); } if (options.title) { diff --git a/dashboard-ui/bower_components/emby-webcomponents/slideshow/slideshow.js b/dashboard-ui/bower_components/emby-webcomponents/slideshow/slideshow.js index ba9b88c19..65569594b 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/slideshow/slideshow.js +++ b/dashboard-ui/bower_components/emby-webcomponents/slideshow/slideshow.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'css!./style', 'html!./icons', 'iron-icon-set', 'paper-icon-button', 'paper-spinner'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost) { +define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'focusManager', 'apphost', 'css!./style', 'html!./icons', 'iron-icon-set', 'paper-icon-button-light', 'paper-spinner'], function (dialogHelper, inputmanager, connectionManager, layoutManager, focusManager, appHost) { function getImageUrl(item, options, apiClient) { @@ -96,6 +96,13 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f } } + function getIcon(icon, cssClass, canFocus, autoFocus) { + + var tabIndex = canFocus ? '' : ' tabindex="-1"'; + autoFocus = autoFocus ? ' autofocus' : ''; + return ''; + } + return function (options) { var self = this; @@ -125,31 +132,30 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f html += '
'; html += '
'; - html += ''; - html += ''; + html += getIcon('slideshow:keyboard-arrow-left', 'btnSlideshowPrevious slideshowButton', false); + html += getIcon('slideshow:keyboard-arrow-right', 'btnSlideshowNext slideshowButton', false); html += '
'; if (actionButtonsOnTop) { if (appHost.supports('filedownload')) { - html += ''; + html += getIcon('slideshow:file-download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) { - html += ''; + html += getIcon('slideshow:share', 'btnShare slideshowButton', true); } } - html += ''; + html += getIcon('slideshow:close', 'slideshowButton btnSlideshowExit', false); html += '
'; if (!actionButtonsOnTop) { html += '
'; - //html += ''; - html += ''; + html += getIcon('slideshow:pause', 'btnSlideshowPause slideshowButton', true, true); if (appHost.supports('filedownload')) { - html += ''; + html += getIcon('slideshow:file-download', 'btnDownload slideshowButton', true); } if (appHost.supports('sharing')) { - html += ''; + html += getIcon('slideshow:share', 'btnShare slideshowButton', true); } html += '
'; @@ -361,7 +367,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f function play() { - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause'); + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause iron-icon'); if (btnSlideshowPause) { btnSlideshowPause.icon = "slideshow:pause"; } @@ -371,7 +377,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f function pause() { - var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause'); + var btnSlideshowPause = dlg.querySelector('.btnSlideshowPause iron-icon'); if (btnSlideshowPause) { btnSlideshowPause.icon = "slideshow:play-arrow"; } @@ -381,7 +387,7 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f function playPause() { - var paused = dlg.querySelector('.btnSlideshowPause').icon != "slideshow:pause"; + var paused = dlg.querySelector('.btnSlideshowPause iron-icon').icon != "slideshow:pause"; if (paused) { play(); } else { diff --git a/dashboard-ui/bower_components/emby-webcomponents/slideshow/style.css b/dashboard-ui/bower_components/emby-webcomponents/slideshow/style.css index 8395c5273..08c7f64ec 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/slideshow/style.css +++ b/dashboard-ui/bower_components/emby-webcomponents/slideshow/style.css @@ -45,7 +45,7 @@ top: 50%; } -.slideshowDialog paper-icon-button { +.slideshowDialog .slideshowButton { width: 5.2vh; height: 5.2vh; color: #fff; @@ -54,7 +54,7 @@ min-height: 40px; } -.layout-tv .slideshowDialog paper-icon-button { +.layout-tv .slideshowDialog .slideshowButtonn { width: 7vh; height: 7vh; } diff --git a/dashboard-ui/bower_components/iron-icon/.bower.json b/dashboard-ui/bower_components/iron-icon/.bower.json index 9784e3a3b..f0167baf1 100644 --- a/dashboard-ui/bower_components/iron-icon/.bower.json +++ b/dashboard-ui/bower_components/iron-icon/.bower.json @@ -32,14 +32,14 @@ "web-component-tester": "^4.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/PolymerElements/iron-icon", + "homepage": "https://github.com/polymerelements/iron-icon", "_release": "1.0.8", "_resolution": { "type": "version", "tag": "v1.0.8", "commit": "f36b38928849ef3853db727faa8c9ef104d611eb" }, - "_source": "git://github.com/PolymerElements/iron-icon.git", + "_source": "git://github.com/polymerelements/iron-icon.git", "_target": "^1.0.0", - "_originalSource": "PolymerElements/iron-icon" + "_originalSource": "polymerelements/iron-icon" } \ No newline at end of file diff --git a/dashboard-ui/bower_components/iron-selector/.bower.json b/dashboard-ui/bower_components/iron-selector/.bower.json index 1da99816d..e5306ccfc 100644 --- a/dashboard-ui/bower_components/iron-selector/.bower.json +++ b/dashboard-ui/bower_components/iron-selector/.bower.json @@ -36,7 +36,7 @@ "tag": "v1.5.1", "commit": "e3e34408fad8f7cde59c4255cf3fe90f7dcf91d8" }, - "_source": "git://github.com/polymerelements/iron-selector.git", + "_source": "git://github.com/PolymerElements/iron-selector.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-selector" + "_originalSource": "PolymerElements/iron-selector" } \ No newline at end of file diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.js b/dashboard-ui/components/metadataeditor/metadataeditor.js index aa8cc9d6b..673db258d 100644 --- a/dashboard-ui/components/metadataeditor/metadataeditor.js +++ b/dashboard-ui/components/metadataeditor/metadataeditor.js @@ -1,4 +1,4 @@ -define(['dialogHelper', 'datetime', 'jQuery', 'paper-checkbox', 'paper-input', 'paper-item-body', 'paper-icon-item', 'paper-textarea', 'paper-fab'], function (dialogHelper, $, datetime) { +define(['dialogHelper', 'datetime', 'jQuery', 'paper-checkbox', 'paper-input', 'paper-item-body', 'paper-icon-item', 'paper-textarea', 'paper-fab'], function (dialogHelper, datetime, $) { var currentContext; var metadataEditorInfo; diff --git a/dashboard-ui/css/librarymenu.css b/dashboard-ui/css/librarymenu.css index 240504c17..769d7293b 100644 --- a/dashboard-ui/css/librarymenu.css +++ b/dashboard-ui/css/librarymenu.css @@ -210,7 +210,7 @@ } .dashboardDocument .viewMenuBar { - background-color: #43A047; + background-color: #222; box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12); height: auto; } @@ -224,7 +224,6 @@ } .dashboardDocument .viewMenuBar #selectionBar { - background: #fff !important; height: 3px; } diff --git a/dashboard-ui/css/notifications.css b/dashboard-ui/css/notifications.css index 72736892a..15302c3db 100644 --- a/dashboard-ui/css/notifications.css +++ b/dashboard-ui/css/notifications.css @@ -11,7 +11,7 @@ font-weight: 500; position: relative; border-radius: 1000px; - background: #2E7D32; + background: #444; line-height: 28px; min-width: 30px; display: inline-flex; @@ -21,7 +21,7 @@ } .levelNormal { - background-color: #444; + background-color: #43A047; } .levelWarning { diff --git a/dashboard-ui/css/polymer/paper-icon-button-light.css b/dashboard-ui/css/polymer/paper-icon-button-light.css new file mode 100644 index 000000000..979220497 --- /dev/null +++ b/dashboard-ui/css/polymer/paper-icon-button-light.css @@ -0,0 +1,19 @@ +[is=paper-icon-button-light] { + width: 40px; + height: 40px; + padding: .5em; +} + + [is=paper-icon-button-light] iron-icon, [is=paper-icon-button-light] img { + width: 100%; + height: 100%; + } + + [is=paper-icon-button-light] #background { + transition: opacity .3s ease-out; + } + + [is=paper-icon-button-light]:focus #background { + background-color: currentcolor !important; + opacity: .2 !important; + } diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index 01a897283..c1818b075 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -489,7 +489,7 @@ div[data-role='page'] { outline: none; } -a[data-role='button'], button:not([data-role='none']):not(.clearButton) { +a[data-role='button'], .type-interior button:not([data-role='none']):not(.clearButton) { -webkit-font-smoothing: antialiased; -webkit-user-select: none; background-clip: padding-box; @@ -512,24 +512,18 @@ a[data-role='button'], button:not([data-role='none']):not(.clearButton) { box-shadow: 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.15) /*{global-box-shadow-color}*/; } - a[data-role='button'][data-iconpos='notext'], button[data-iconpos='notext']:not([data-role='none']):not(.clearButton) { + a[data-role='button'][data-iconpos='notext'], .type-interior button[data-iconpos='notext']:not([data-role='none']):not(.clearButton) { padding: 4px; border-radius: 50px; outline: 0; } - a[data-role='button']:not([data-inline='true']), button:not([data-role='none']):not([data-inline='true']):not(.clearButton) { + a[data-role='button']:not([data-inline='true']), .type-interior button:not([data-role='none']):not([data-inline='true']):not(.clearButton) { display: block; margin: .5em 0 !important; } - a[data-role='button']:focus, button:not([data-role='none']):focus { - -webkit-box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/; - -moz-box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/; - box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/; - } - -button:not([data-role='none']):not([data-inline='true']):not(.clearButton) { +.type-interior button:not([data-role='none']):not([data-inline='true']):not(.clearButton) { width: 100%; } diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index 4550c28e2..e777b0311 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -9,37 +9,36 @@ html += '
'; var backIcon = browserInfo.safari ? 'chevron-left' : 'arrow-back'; - html += ''; + html += ''; - html += ''; - - html += ''; + html += ''; + html += ''; html += '
' + Globalize.translate('ButtonHome') + '
'; html += '
'; html += ''; - html += ''; + html += ''; if (AppInfo.enableSearchInTopMenu) { - html += ''; + html += ''; html += '
'; html += '
'; html += ''; - html += ''; + html += ''; html += '
'; html += '
'; } - html += ''; + html += ''; - html += '
0
'; + html += ''; - html += ''; + html += ''; if (!browserInfo.mobile && !Dashboard.isConnectMode()) { - html += ''; + html += ''; } html += '
'; @@ -108,26 +107,15 @@ function updateHeaderUserButton(headerUserButton, src, icon) { - var oldButton = headerUserButton; - - // There seems to be a bug in paper-icon-button where it doesn't refresh it's display after switching between icon and src image - // So work around that by just replacing the element altogether - - var headerUserButton = document.createElement('paper-icon-button'); - headerUserButton.className = oldButton.className; - headerUserButton.addEventListener('click', onHeaderUserButtonClick); - if (src) { headerUserButton.classList.add('headerUserButtonRound'); - headerUserButton.src = src; + headerUserButton.innerHTML = ''; } else if (icon) { headerUserButton.classList.remove('headerUserButtonRound'); - headerUserButton.icon = icon; + headerUserButton.innerHTML = ''; } else { headerUserButton.classList.remove('headerUserButtonRound'); } - - oldButton.parentNode.replaceChild(headerUserButton, oldButton); } function updateLocalUser(user) { @@ -208,7 +196,7 @@ html += '
'; html += ''; - html += ''; + html += ''; html += '
' + Globalize.translate('ButtonHome') + '
'; html += '
'; @@ -217,11 +205,11 @@ html += '
'; html += ''; - html += ''; + html += ''; html += '
' + Globalize.translate('ButtonMetadataManager') + '
'; html += '
'; html += ''; - html += ''; + html += ''; html += '
' + Globalize.translate('ButtonReports') + '
'; html += '
'; @@ -453,15 +441,6 @@ function createDashboardMenu() { var html = ''; - //html += '
'; - //html += '
'; - //html += '
'; - //html += localUser.Name; - //html += '
'; - //html += ''; - //html += '
'; - //html += '
'; - html += ''; @@ -760,7 +739,7 @@ var helpUrl = page.getAttribute('data-helpurl'); if (helpUrl) { - html += ''; + html += ''; } } @@ -1119,7 +1098,7 @@ var headerCreated; var userRequiresUpdateAfterHeader; - require(['paper-icon-button', 'emby-icons', 'paper-button'], function () { + require(['paper-icon-button-light', 'emby-icons'], function () { renderHeader(); headerCreated = true; diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 9caf15df8..d48667420 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1893,7 +1893,7 @@ var AppInfo = {}; define("paper-dialog-scrollable", ["html!" + bowerPath + "/paper-dialog-scrollable/paper-dialog-scrollable.html"]); define("paper-button", ["html!" + bowerPath + "/paper-button/paper-button.html"]); define("paper-icon-button", ["html!" + bowerPath + "/paper-icon-button/paper-icon-button.html"]); - define("paper-icon-button-light", ["html!" + bowerPath + "/paper-icon-button/paper-icon-button-light.html"]); + define("paper-icon-button-light", ["html!" + bowerPath + "/paper-icon-button/paper-icon-button-light.html", 'css!css/polymer/paper-icon-button-light.css']); define("paper-drawer-panel", ["html!" + bowerPath + "/paper-drawer-panel/paper-drawer-panel.html"]); define("paper-radio-group", ["html!" + bowerPath + "/paper-radio-group/paper-radio-group.html"]); define("paper-radio-button", ["html!" + bowerPath + "/paper-radio-button/paper-radio-button.html"]); From 70393a9136508c387a8b97670c56f3a41d64c62f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 May 2016 14:17:02 -0400 Subject: [PATCH 3/4] update recordings --- dashboard-ui/livetv.html | 17 +-- dashboard-ui/scripts/librarybrowser.js | 140 ++++++++++++++--------- dashboard-ui/scripts/librarylist.js | 2 +- dashboard-ui/scripts/livetvcomponents.js | 17 +++ dashboard-ui/scripts/livetvrecordings.js | 69 ++++++++++- dashboard-ui/scripts/livetvsuggested.js | 4 - dashboard-ui/scripts/livetvtimers.js | 58 ---------- dashboard-ui/scripts/nowplayingbar.js | 2 +- dashboard-ui/scripts/playlistmanager.js | 3 + dashboard-ui/strings/en-US.json | 3 +- 10 files changed, 188 insertions(+), 127 deletions(-) delete mode 100644 dashboard-ui/scripts/livetvtimers.js diff --git a/dashboard-ui/livetv.html b/dashboard-ui/livetv.html index 982b40302..87845c4e5 100644 --- a/dashboard-ui/livetv.html +++ b/dashboard-ui/livetv.html @@ -6,7 +6,6 @@ ${TabGuide} ${TabChannels} ${TabRecordings} - ${TabScheduled} ${TabSeries}
@@ -79,6 +77,13 @@

+
+
+

${HeaderUpcomingRecordings}

+
+
+
+
-
-
-
-
-
+
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index a0da6e86e..365638fc7 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -456,6 +456,9 @@ canShare: function (item, user) { + if (item.Type == 'Timer') { + return false; + } return user.Policy.EnablePublicSharing; }, @@ -721,7 +724,7 @@ supportsEditing: function (itemType) { - if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView") { + if (itemType == "UserRootFolder" || /*itemType == "CollectionFolder" ||*/ itemType == "UserView" || itemType == 'Timer') { return false; } @@ -756,7 +759,10 @@ if (item.MediaType == 'Video' && item.Type != 'TvChannel' && item.Type != 'Program' && item.LocationType != 'Virtual') { commands.push('editsubtitles'); } - commands.push('editimages'); + + if (item.Type != 'Timer') { + commands.push('editimages'); + } } if (user.Policy.IsAdministrator) { @@ -1139,6 +1145,9 @@ return "itemdetails.html?id=" + id; } + if (item.Type == "Timer") { + return "livetvtimer.html?id=" + id; + } if (item.Type == "BoxSet") { return "itemdetails.html?id=" + id; } @@ -1531,7 +1540,7 @@ }); } - if (item.UserData.PlaybackPositionTicks) { + if (item.UserData && item.UserData.PlaybackPositionTicks) { atts.push({ name: 'positionticks', value: (item.UserData.PlaybackPositionTicks || 0) @@ -1594,7 +1603,7 @@ supportsAddingToCollection: function (item) { - var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'Episode', 'TvChannel', 'Program', 'MusicAlbum']; + var invalidTypes = ['Person', 'Genre', 'MusicGenre', 'Studio', 'GameGenre', 'BoxSet', 'Playlist', 'UserView', 'CollectionFolder', 'Audio', 'Episode', 'TvChannel', 'Program', 'MusicAlbum', 'Timer']; return !item.CollectionType && invalidTypes.indexOf(item.Type) == -1 && item.MediaType != 'Photo'; }, @@ -1675,7 +1684,10 @@ if (item.MediaType == 'Video' && item.Type != 'TvChannel' && item.Type != 'Program' && item.LocationType != 'Virtual') { itemCommands.push('editsubtitles'); } - itemCommands.push('editimages'); + + if (item.Type != 'Timer') { + itemCommands.push('editimages'); + } return itemCommands; }, @@ -1969,17 +1981,18 @@ showTitle = true; } var coverImage = options.coverImage; + var imageItem = item.Type == 'Timer' ? (item.ProgramInfo || item) : item; - if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.34) { + if (options.autoThumb && imageItem.ImageTags && imageItem.ImageTags.Primary && imageItem.PrimaryImageAspectRatio && imageItem.PrimaryImageAspectRatio >= 1.34) { width = posterWidth; height = primaryImageAspectRatio ? Math.round(posterWidth / primaryImageAspectRatio) : null; - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getImageUrl(imageItem.Id, { type: "Primary", maxHeight: height, maxWidth: width, - tag: item.ImageTags.Primary, + tag: imageItem.ImageTags.Primary, enableImageEnhancers: enableImageEnhancers }); @@ -1991,80 +2004,80 @@ } } - } else if (options.autoThumb && item.ImageTags && item.ImageTags.Thumb) { + } else if (options.autoThumb && imageItem.ImageTags && imageItem.ImageTags.Thumb) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Thumb", maxWidth: thumbWidth, - tag: item.ImageTags.Thumb, + tag: imageItem.ImageTags.Thumb, enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { + } else if (options.preferBackdrop && imageItem.BackdropImageTags && imageItem.BackdropImageTags.length) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Backdrop", maxWidth: thumbWidth, - tag: item.BackdropImageTags[0], + tag: imageItem.BackdropImageTags[0], enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) { + } else if (options.preferThumb && imageItem.ImageTags && imageItem.ImageTags.Thumb) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Thumb", maxWidth: thumbWidth, - tag: item.ImageTags.Thumb, + tag: imageItem.ImageTags.Thumb, enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferBanner && item.ImageTags && item.ImageTags.Banner) { + } else if (options.preferBanner && imageItem.ImageTags && imageItem.ImageTags.Banner) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Banner", maxWidth: bannerWidth, - tag: item.ImageTags.Banner, + tag: imageItem.ImageTags.Banner, enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferThumb && item.SeriesThumbImageTag && options.inheritThumb !== false) { + } else if (options.preferThumb && imageItem.SeriesThumbImageTag && options.inheritThumb !== false) { - imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.SeriesId, { type: "Thumb", maxWidth: thumbWidth, - tag: item.SeriesThumbImageTag, + tag: imageItem.SeriesThumbImageTag, enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferThumb && item.ParentThumbItemId && options.inheritThumb !== false) { + } else if (options.preferThumb && imageItem.ParentThumbItemId && options.inheritThumb !== false) { - imgUrl = ApiClient.getThumbImageUrl(item.ParentThumbItemId, { + imgUrl = ApiClient.getThumbImageUrl(imageItem.ParentThumbItemId, { type: "Thumb", maxWidth: thumbWidth, enableImageEnhancers: enableImageEnhancers }); - } else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) { + } else if (options.preferThumb && imageItem.BackdropImageTags && imageItem.BackdropImageTags.length) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Backdrop", maxWidth: thumbWidth, - tag: item.BackdropImageTags[0], + tag: imageItem.BackdropImageTags[0], enableImageEnhancers: enableImageEnhancers }); forceName = true; - } else if (item.ImageTags && item.ImageTags.Primary) { + } else if (imageItem.ImageTags && imageItem.ImageTags.Primary) { width = posterWidth; height = primaryImageAspectRatio ? Math.round(posterWidth / primaryImageAspectRatio) : null; - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getImageUrl(imageItem.Id, { type: "Primary", maxHeight: height, maxWidth: width, - tag: item.ImageTags.Primary, + tag: imageItem.ImageTags.Primary, enableImageEnhancers: enableImageEnhancers }); @@ -2076,25 +2089,25 @@ } } } - else if (item.ParentPrimaryImageTag) { + else if (imageItem.ParentPrimaryImageTag) { - imgUrl = ApiClient.getImageUrl(item.ParentPrimaryImageItemId, { + imgUrl = ApiClient.getImageUrl(imageItem.ParentPrimaryImageItemId, { type: "Primary", maxWidth: posterWidth, tag: item.ParentPrimaryImageTag, enableImageEnhancers: enableImageEnhancers }); } - else if (item.AlbumId && item.AlbumPrimaryImageTag) { + else if (imageItem.AlbumId && imageItem.AlbumPrimaryImageTag) { height = squareSize; width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null; - imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.AlbumId, { type: "Primary", maxHeight: height, maxWidth: width, - tag: item.AlbumPrimaryImageTag, + tag: imageItem.AlbumPrimaryImageTag, enableImageEnhancers: enableImageEnhancers }); @@ -2106,46 +2119,46 @@ } } } - else if (item.Type == 'Season' && item.ImageTags && item.ImageTags.Thumb) { + else if (imageItem.Type == 'Season' && imageItem.ImageTags && imageItem.ImageTags.Thumb) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Thumb", maxWidth: thumbWidth, - tag: item.ImageTags.Thumb, + tag: imageItem.ImageTags.Thumb, enableImageEnhancers: enableImageEnhancers }); } - else if (item.BackdropImageTags && item.BackdropImageTags.length) { + else if (imageItem.BackdropImageTags && imageItem.BackdropImageTags.length) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Backdrop", maxWidth: thumbWidth, - tag: item.BackdropImageTags[0], + tag: imageItem.BackdropImageTags[0], enableImageEnhancers: enableImageEnhancers }); - } else if (item.ImageTags && item.ImageTags.Thumb) { + } else if (imageItem.ImageTags && imageItem.ImageTags.Thumb) { - imgUrl = ApiClient.getScaledImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.Id, { type: "Thumb", maxWidth: thumbWidth, - tag: item.ImageTags.Thumb, + tag: imageItem.ImageTags.Thumb, enableImageEnhancers: enableImageEnhancers }); - } else if (item.SeriesThumbImageTag) { + } else if (imageItem.SeriesThumbImageTag) { - imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, { + imgUrl = ApiClient.getScaledImageUrl(imageItem.SeriesId, { type: "Thumb", maxWidth: thumbWidth, - tag: item.SeriesThumbImageTag, + tag: imageItem.SeriesThumbImageTag, enableImageEnhancers: enableImageEnhancers }); - } else if (item.ParentThumbItemId) { + } else if (imageItem.ParentThumbItemId) { - imgUrl = ApiClient.getThumbImageUrl(item, { + imgUrl = ApiClient.getThumbImageUrl(imageItem, { type: "Thumb", maxWidth: thumbWidth, enableImageEnhancers: enableImageEnhancers @@ -2284,7 +2297,7 @@ html += '
' + mediaSourceCount + '
'; } - var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData)); + var progressHtml = options.showProgress === false || item.IsFolder ? '' : LibraryBrowser.getItemProgressBarHtml((item.Type == 'Recording' ? item : item.UserData || {})); var footerOverlayed = false; @@ -2412,6 +2425,31 @@ lines.push(item.ProductionYear || ''); } + if (options.showAirTime) { + + var airTimeText; + if (item.StartDate) { + + try { + var date = datetime.parseISO8601Date(item.StartDate); + + airTimeText = date.toLocaleDateString(); + + airTimeText += ', ' + datetime.getDisplayTime(date); + + if (item.EndDate) { + date = datetime.parseISO8601Date(item.EndDate); + airTimeText += ' - ' + datetime.getDisplayTime(date); + } + } + catch (e) { + console.log("Error parsing date: " + item.PremiereDate); + } + } + + lines.push(airTimeText || ''); + } + if (item.Type == 'TvChannel') { if (item.CurrentProgram) { diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 2eb4a5e62..5dae5e7c1 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -420,7 +420,7 @@ }); } - if (user.Policy.EnablePublicSharing) { + if (user.Policy.EnablePublicSharing && commands.indexOf('share') != -1) { items.push({ name: Globalize.translate('ButtonShare'), id: 'share', diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index 7224c3f01..cbd3ede7e 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -2,6 +2,23 @@ function getTimersHtml(timers) { + var items = timers.map(function (t) { + t.Type = 'Timer'; + return t; + }); + + var html = LibraryBrowser.getPosterViewHtml({ + items: items, + shape: "square", + showTitle: true, + showAirTime: true, + lazy: true, + cardLayout: true, + showDetailsMenu: true + }); + + return Promise.resolve(html); + return new Promise(function (resolve, reject) { require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () { diff --git a/dashboard-ui/scripts/livetvrecordings.js b/dashboard-ui/scripts/livetvrecordings.js index 9bd11972c..1844c9abc 100644 --- a/dashboard-ui/scripts/livetvrecordings.js +++ b/dashboard-ui/scripts/livetvrecordings.js @@ -78,9 +78,7 @@ ImageLoader.lazyChildren(recordingItems); } - function reload(page) { - - Dashboard.showLoadingMsg(); + function renderActiveRecordings(page) { ApiClient.getLiveTvRecordings({ @@ -93,6 +91,9 @@ renderRecordings(page.querySelector('#activeRecordings'), result.Items); }); + } + + function renderLatestRecordings(page) { ApiClient.getLiveTvRecordings({ @@ -105,6 +106,68 @@ renderRecordings(page.querySelector('#latestRecordings'), result.Items); }); + } + + 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')); + }); + + reload(page); + }); + }); + }); + } + + function renderTimers(page, timers) { + + LiveTvHelpers.getTimersHtml(timers).then(function (html) { + + var elem = page.querySelector('#upcomingRecordings'); + + if (html) { + elem.classList.remove('hide'); + } else { + elem.classList.add('hide'); + } + + elem.querySelector('.itemsContainer').innerHTML = html; + + ImageLoader.lazyChildren(elem); + + $('.btnDeleteTimer', elem).on('click', function () { + + var id = this.getAttribute('data-timerid'); + + deleteTimer(page, id); + }); + }); + } + + function renderUpcomingRecordings(page) { + + ApiClient.getLiveTvTimers().then(function (result) { + + renderTimers(page, result.Items); + }); + } + + function reload(page) { + + Dashboard.showLoadingMsg(); + + renderUpcomingRecordings(page); + renderActiveRecordings(page); + renderLatestRecordings(page); ApiClient.getLiveTvRecordingGroups({ diff --git a/dashboard-ui/scripts/livetvsuggested.js b/dashboard-ui/scripts/livetvsuggested.js index 0b70aaf1f..c42977dc3 100644 --- a/dashboard-ui/scripts/livetvsuggested.js +++ b/dashboard-ui/scripts/livetvsuggested.js @@ -168,10 +168,6 @@ renderMethod = 'renderRecordingsTab'; break; case 4: - depends.push('scripts/livetvtimers'); - renderMethod = 'renderTimersTab'; - break; - case 5: depends.push('scripts/livetvseriestimers'); renderMethod = 'renderSeriesTimersTab'; break; diff --git a/dashboard-ui/scripts/livetvtimers.js b/dashboard-ui/scripts/livetvtimers.js deleted file mode 100644 index e6d082d5f..000000000 --- a/dashboard-ui/scripts/livetvtimers.js +++ /dev/null @@ -1,58 +0,0 @@ -define(['jQuery'], function ($) { - - 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')); - }); - - reload(page); - }); - }); - }); - } - - function renderTimers(page, timers) { - - LiveTvHelpers.getTimersHtml(timers).then(function (html) { - var elem = $('#items', page).html(html)[0]; - - ImageLoader.lazyChildren(elem); - - $('.btnDeleteTimer', elem).on('click', function () { - - var id = this.getAttribute('data-timerid'); - - deleteTimer(page, id); - }); - - Dashboard.hideLoadingMsg(); - }); - } - - function reload(page) { - - Dashboard.showLoadingMsg(); - - ApiClient.getLiveTvTimers().then(function (result) { - - renderTimers(page, result.Items); - }); - } - - window.LiveTvPage.renderTimersTab = function (page, tabContent) { - - if (LibraryBrowser.needsRefresh(tabContent)) { - reload(tabContent); - } - }; - -}); \ No newline at end of file diff --git a/dashboard-ui/scripts/nowplayingbar.js b/dashboard-ui/scripts/nowplayingbar.js index 9e4378398..14e10f4e8 100644 --- a/dashboard-ui/scripts/nowplayingbar.js +++ b/dashboard-ui/scripts/nowplayingbar.js @@ -1,4 +1,4 @@ -define(['datetime', 'jQuery'], function (datetime, $) { +define(['datetime', 'jQuery', 'paper-icon-button'], function (datetime, $) { var currentPlayer; diff --git a/dashboard-ui/scripts/playlistmanager.js b/dashboard-ui/scripts/playlistmanager.js index 8878712b4..a97624832 100644 --- a/dashboard-ui/scripts/playlistmanager.js +++ b/dashboard-ui/scripts/playlistmanager.js @@ -14,6 +14,9 @@ if (item.Type == 'Program') { return false; } + if (item.Type == 'Timer') { + return false; + } return item.RunTimeTicks || item.IsFolder || item.Type == "Genre" || item.Type == "MusicGenre" || item.Type == "MusicArtist"; } }; diff --git a/dashboard-ui/strings/en-US.json b/dashboard-ui/strings/en-US.json index 0cdfc90eb..b2eabf60c 100644 --- a/dashboard-ui/strings/en-US.json +++ b/dashboard-ui/strings/en-US.json @@ -2349,5 +2349,6 @@ "LabelOriginalTitle": "Original title:", "LabelSortTitle": "Sort title:", "OptionConvertRecordingPreserveAudio": "Preserve original audio when converting recordings", - "OptionConvertRecordingPreserveAudioHelp": "This will provide better audio but may require transcoding during playback on some devices." + "OptionConvertRecordingPreserveAudioHelp": "This will provide better audio but may require transcoding during playback on some devices.", + "HeaderUpcomingRecordings": "Upcoming Recordings" } From 36745b1a4ac8410e0097c66d72f1a4199a2ac9f5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 May 2016 14:54:14 -0400 Subject: [PATCH 4/4] update recordings --- dashboard-ui/scripts/librarybrowser.js | 5 ++ dashboard-ui/scripts/librarylist.js | 34 ++++++++- dashboard-ui/scripts/livetvcomponents.js | 97 +----------------------- dashboard-ui/scripts/livetvrecordings.js | 38 ++-------- dashboard-ui/scripts/livetvsuggested.js | 1 + 5 files changed, 48 insertions(+), 127 deletions(-) diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 365638fc7..4f7962824 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -2425,6 +2425,11 @@ lines.push(item.ProductionYear || ''); } + if (options.showChannelName) { + + lines.push(item.ChannelName || ''); + } + if (options.showAirTime) { var airTimeText; diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 5dae5e7c1..1a824a248 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -229,6 +229,27 @@ } } + function deleteTimer(id, itemsContainer) { + + 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.hideLoadingMsg(); + itemsContainer.dispatchEvent(new CustomEvent('timercancelled', {})); + }); + }); + }); + } + function showContextMenu(card, options) { var displayContextItem = card; @@ -323,8 +344,16 @@ }); } + if (itemType == 'Timer' && user.Policy.EnableLiveTvManagement) { + items.push({ + name: Globalize.translate('ButtonCancel'), + id: 'canceltimer', + ironIcon: 'cancel' + }); + } + items.push({ - name: Globalize.translate('ButtonOpen'), + name: itemType == 'Timer' ? Globalize.translate('ButtonEdit') : Globalize.translate('ButtonOpen'), id: 'open', ironIcon: 'folder-open' }); @@ -581,6 +610,9 @@ case 'externalplayer': LibraryBrowser.playInExternalPlayer(itemId); break; + case 'canceltimer': + deleteTimer(itemId, $(card).parents('.itemsContainer')[0]); + break; case 'share': require(['sharingmanager'], function (sharingManager) { sharingManager.showMenu({ diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index cbd3ede7e..772e10961 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -12,108 +12,13 @@ shape: "square", showTitle: true, showAirTime: true, + showChannelName: true, lazy: true, cardLayout: true, showDetailsMenu: true }); return Promise.resolve(html); - - return new Promise(function (resolve, reject) { - - require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () { - var html = ''; - var index = ''; - var imgUrl; - - for (var i = 0, length = timers.length; i < length; i++) { - - var timer = timers[i]; - - var startDateText = LibraryBrowser.getFutureDateText(datetime.parseISO8601Date(timer.StartDate, true)); - - if (startDateText != index) { - - if (index) { - html += '
'; - html += '
'; - } - - html += '
'; - html += '

' + startDateText + '

'; - html += '
'; - index = startDateText; - } - - html += ''; - - var program = timer.ProgramInfo || {}; - - imgUrl = null; - if (program.ImageTags && program.ImageTags.Primary) { - - imgUrl = ApiClient.getScaledImageUrl(program.Id, { - height: 80, - tag: program.ImageTags.Primary, - type: "Primary" - }); - } - - if (imgUrl) { - html += ''; - } - else if (program.IsKids) { - html += ''; - } - else if (program.IsSports) { - html += ''; - } - else if (program.IsMovie) { - html += ''; - } - else if (program.IsNews) { - html += ''; - } - else { - html += ''; - } - - html += ''; - html += ''; - - html += '
'; - html += timer.Name; - html += '
'; - - html += '
'; - html += datetime.getDisplayTime(timer.StartDate); - html += ' - ' + datetime.getDisplayTime(timer.EndDate); - html += '
'; - - html += '
'; - html += '
'; - - if (timer.SeriesTimerId) { - html += '
'; - html += '
'; - html += '
'; - html += '
'; - html += '
'; - } - - html += ''; - - html += '
'; - } - - if (timers.length) { - html += '
'; - html += '
'; - } - - resolve(html); - }); - }); } window.LiveTvHelpers = { diff --git a/dashboard-ui/scripts/livetvrecordings.js b/dashboard-ui/scripts/livetvrecordings.js index 1844c9abc..9f78b5b91 100644 --- a/dashboard-ui/scripts/livetvrecordings.js +++ b/dashboard-ui/scripts/livetvrecordings.js @@ -108,26 +108,6 @@ }); } - 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')); - }); - - reload(page); - }); - }); - }); - } - function renderTimers(page, timers) { LiveTvHelpers.getTimersHtml(timers).then(function (html) { @@ -143,13 +123,6 @@ elem.querySelector('.itemsContainer').innerHTML = html; ImageLoader.lazyChildren(elem); - - $('.btnDeleteTimer', elem).on('click', function () { - - var id = this.getAttribute('data-timerid'); - - deleteTimer(page, id); - }); }); } @@ -181,11 +154,16 @@ }); } + window.LiveTvPage.initRecordingsTab = function (page, tabContent) { + + tabContent.querySelector('#upcomingRecordings .itemsContainer').addEventListener('timercancelled', function () { + reload(tabContent); + }); + }; + window.LiveTvPage.renderRecordingsTab = function (page, tabContent) { - if (LibraryBrowser.needsRefresh(tabContent)) { - reload(tabContent); - } + reload(tabContent); }; }); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvsuggested.js b/dashboard-ui/scripts/livetvsuggested.js index c42977dc3..9e65f2c69 100644 --- a/dashboard-ui/scripts/livetvsuggested.js +++ b/dashboard-ui/scripts/livetvsuggested.js @@ -165,6 +165,7 @@ break; case 3: depends.push('scripts/livetvrecordings'); + initMethod = 'initRecordingsTab'; renderMethod = 'renderRecordingsTab'; break; case 4: