Paper Menu with multi selection
-
+
diff --git a/dashboard-ui/bower_components/paper-menu-button/paper-menu-button.html b/dashboard-ui/bower_components/paper-menu-button/paper-menu-button.html
index 51488cedd5..ace55c107e 100644
--- a/dashboard-ui/bower_components/paper-menu-button/paper-menu-button.html
+++ b/dashboard-ui/bower_components/paper-menu-button/paper-menu-button.html
@@ -108,9 +108,10 @@ Custom property | Description | Default
vertical-offset="[[verticalOffset]]"
open-animation-config="[[openAnimationConfig]]"
close-animation-config="[[closeAnimationConfig]]"
- no-animations="[[noAnimations]]">
+ no-animations="[[noAnimations]]"
+ focus-target="[[_dropdownContent]]">
-
+
@@ -147,7 +148,8 @@ Custom property | Description | Default
opened: {
type: Boolean,
value: false,
- notify: true
+ notify: true,
+ observer: '_openedChanged'
},
/**
@@ -205,7 +207,7 @@ Custom property | Description | Default
* Set to true to disable automatically closing the dropdown after
* a selection has been made.
*/
- ignoreActivate: {
+ ignoreSelect: {
type: Boolean,
value: false
},
@@ -268,6 +270,14 @@ Custom property | Description | Default
}
}];
}
+ },
+
+ /**
+ * This is the element intended to be bound as the focus target
+ * for the `iron-dropdown` contained by `paper-menu-button`.
+ */
+ _dropdownContent: {
+ type: Object
}
},
@@ -277,7 +287,14 @@ Custom property | Description | Default
},
listeners: {
- 'iron-activate': '_onIronActivate'
+ 'iron-select': '_onIronSelect'
+ },
+
+ /**
+ * The content element that is contained by the menu button, if any.
+ */
+ get contentElement() {
+ return Polymer.dom(this.$.content).getDistributedNodes()[0];
},
/**
@@ -300,14 +317,14 @@ Custom property | Description | Default
},
/**
- * When an `iron-activate` event is received, the dropdown should
+ * When an `iron-select` event is received, the dropdown should
* automatically close on the assumption that a value has been chosen.
*
* @param {CustomEvent} event A CustomEvent instance with type
- * set to `"iron-activate"`.
+ * set to `"iron-select"`.
*/
- _onIronActivate: function(event) {
- if (!this.ignoreActivate) {
+ _onIronSelect: function(event) {
+ if (!this.ignoreSelect) {
this.close();
}
},
@@ -321,6 +338,12 @@ Custom property | Description | Default
*/
_openedChanged: function(opened, oldOpened) {
if (opened) {
+ // TODO(cdata): Update this when we can measure changes in distributed
+ // children in an idiomatic way.
+ // We poke this property in case the element has changed. This will
+ // cause the focus target for the `iron-dropdown` to be updated as
+ // necessary:
+ this._dropdownContent = this.contentElement;
this.fire('paper-dropdown-open');
} else if (oldOpened != null) {
this.fire('paper-dropdown-close');
diff --git a/dashboard-ui/bower_components/paper-styles/.bower.json b/dashboard-ui/bower_components/paper-styles/.bower.json
index 91d22f3562..04e2128c81 100644
--- a/dashboard-ui/bower_components/paper-styles/.bower.json
+++ b/dashboard-ui/bower_components/paper-styles/.bower.json
@@ -34,7 +34,7 @@
"tag": "v1.0.11",
"commit": "347542e9ebe3e6e5f0830ee10e1c20c12956ff2c"
},
- "_source": "git://github.com/polymerelements/paper-styles.git",
+ "_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0",
- "_originalSource": "polymerelements/paper-styles"
+ "_originalSource": "PolymerElements/paper-styles"
}
\ No newline at end of file
diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json
index 5968472cc4..890d7da958 100644
--- a/dashboard-ui/bower_components/polymer/.bower.json
+++ b/dashboard-ui/bower_components/polymer/.bower.json
@@ -23,14 +23,14 @@
"web-component-tester": "*"
},
"private": true,
- "homepage": "https://github.com/polymer/polymer",
+ "homepage": "https://github.com/Polymer/polymer",
"_release": "1.1.0",
"_resolution": {
"type": "version",
"tag": "v1.1.0",
"commit": "67fb2f85fd66d8556fc07cf1dec41ff5273fa68a"
},
- "_source": "git://github.com/polymer/polymer.git",
+ "_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0",
- "_originalSource": "polymer/polymer"
+ "_originalSource": "Polymer/polymer"
}
\ No newline at end of file
diff --git a/dashboard-ui/css/card.css b/dashboard-ui/css/card.css
index a1e3964911..41aa528968 100644
--- a/dashboard-ui/css/card.css
+++ b/dashboard-ui/css/card.css
@@ -255,6 +255,7 @@
left: 0;
right: 0;
text-align: center;
+ line-height: initial;
}
.cardContent .cardText {
diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css
index 3a7c56b7fb..6915975aa3 100644
--- a/dashboard-ui/css/librarybrowser.css
+++ b/dashboard-ui/css/librarybrowser.css
@@ -391,7 +391,7 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
background-size: cover;
background-position: center 15%;
background-repeat: no-repeat;
- height: 560px;
+ height: 600px;
position: relative;
}
@@ -529,6 +529,13 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
height: 40px;
}
+@media all and (max-width: 1000px) {
+
+ .detailImageContainer img {
+ max-width: 240px;
+ }
+}
+
@media all and (max-width: 800px) {
.parentName {
@@ -756,56 +763,56 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
@media all and (max-height: 900px), (max-width: 800px) {
.itemBackdrop:not(.noBackdrop) {
- height: 500px;
+ height: 550px;
}
}
@media all and (max-height: 800px), (max-width: 700px) {
.itemBackdrop:not(.noBackdrop) {
- height: 400px;
+ height: 450px;
}
}
@media all and (max-height: 700px) {
.itemBackdrop:not(.noBackdrop) {
- height: 300px;
+ height: 350px;
}
}
@media all and (max-width: 540px) {
.itemBackdrop:not(.noBackdrop) {
- height: 240px;
+ height: 290px;
}
}
@media all and (max-height: 540px) {
.itemBackdrop:not(.noBackdrop) {
- height: 200px;
+ height: 250px;
}
}
@media all and (max-height: 460px) {
.itemBackdrop:not(.noBackdrop) {
- height: 150px;
+ height: 200px;
}
}
@media all and (max-height: 300px) {
.itemBackdrop:not(.noBackdrop) {
- height: 100px;
+ height: 150px;
}
}
@media all and (max-height: 250px) {
.itemBackdrop:not(.noBackdrop) {
- height: 70px;
+ height: 120px;
}
}
@@ -866,6 +873,7 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
max-width: 180px;
}
}
+
@media all and (min-width: 750px) {
.detailPageContent {
width: 950px;
diff --git a/dashboard-ui/itembynamedetails.html b/dashboard-ui/itembynamedetails.html
deleted file mode 100644
index 41ac75fc1b..0000000000
--- a/dashboard-ui/itembynamedetails.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js
index 73e986d5d6..18cc0d0645 100644
--- a/dashboard-ui/scripts/itembynamedetailpage.js
+++ b/dashboard-ui/scripts/itembynamedetailpage.js
@@ -1,345 +1,299 @@
(function ($, document, LibraryBrowser) {
- var currentItem;
- var shape;
- var _childrenItemsFunction;
+ function renderItems(page, item) {
- function getPromise() {
-
- var id = getParameterByName('id');
-
- if (id) {
- return ApiClient.getItem(Dashboard.getCurrentUserId(), id);
- }
-
- var name = getParameterByName('genre');
-
- if (name) {
- return ApiClient.getGenre(name, Dashboard.getCurrentUserId());
- }
-
- name = getParameterByName('musicgenre');
-
- if (name) {
- return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId());
- }
-
- name = getParameterByName('gamegenre');
-
- if (name) {
- return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId());
- }
-
- name = getParameterByName('musicartist');
-
- if (name) {
- return ApiClient.getArtist(name, Dashboard.getCurrentUserId());
- }
- else {
- throw new Error('Invalid request');
- }
- }
-
- function reload(page) {
-
- Dashboard.showLoadingMsg();
-
- getPromise().done(function (item) {
-
- var context = getParameterByName('context');
-
- var editQuery = '?id=' + item.Id;
-
- currentItem = item;
-
- LibraryMenu.setTitle(item.Name);
- Backdrops.setBackdrops(page, [item]);
-
- var name = item.Name;
-
- Dashboard.setPageTitle(name);
-
- $('.itemName', page).html(name);
-
- renderDetails(page, item, context);
- renderTabs(page, item, context);
-
- $(page).trigger('displayingitem', [{
-
- item: item,
- context: context
- }]);
-
- Dashboard.getCurrentUser().done(function (user) {
-
- if (MediaController.canPlay(item)) {
- $('.btnPlay', page).visible(true);
- } else {
- $('.btnPlay', page).visible(false);
- }
-
- if (SyncManager.isAvailable(item, user)) {
- $('.btnSync', page).removeClass('hide');
- } else {
- $('.btnSync', page).addClass('hide');
- }
-
- var editImagesHref = user.Policy.IsAdministrator ? 'edititemmetadata.html' + (editQuery + "&tab=3") : null;
-
- $('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item, editImagesHref, true));
-
- if (LibraryBrowser.getMoreCommands(item, user).length) {
- $('.btnMoreCommands', page).visible(true);
- } else {
- $('.btnMoreCommands', page).visible(false);
- }
-
- });
-
- Dashboard.hideLoadingMsg();
- });
- }
-
- function renderTabs(page, item, context) {
-
- var html = '';
+ var elem = page.querySelector('#childrenContent');
- var elem = $('#itemTabs', page).html(html).trigger('create');
+ elem.innerHTML = sections.map(function (section) {
- bindRadioEvents(page);
+ var html = '';
- var selectedRadio = null;
+ html += '';
- if (context) {
- selectedRadio = $('.context-' + context + ':first', elem);
+ html += '
';
+
+ html += '
';
+ html += '
';
+
+ html += '
';
+
+ return html;
+
+ }).join('');
+
+ var sectionElems = elem.querySelectorAll('.homePageSection');
+ for (var i = 0, length = sectionElems.length; i < length; i++) {
+ renderSection(page, item, sectionElems[i], sectionElems[i].getAttribute('data-type'));
}
-
- if (selectedRadio && selectedRadio.length) {
- selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click');
- } else {
- $('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click');
- }
-
}
- function bindRadioEvents(page) {
+ function renderSection(page, item, element, type) {
- $("#radioMusicVideos", page).on("click", function () {
+ switch (type) {
- shape = "poster";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "MusicVideo",
- PersonTypes: "",
- ArtistIds: ""
- });
+ case 'Movie':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Movie",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 10
+ }, {
+ shape: "detailPagePortrait",
+ showTitle: true,
+ centerText: true,
+ overlayPlayButton: true
+ });
+ break;
- });
+ case 'MusicVideo':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "MusicVideo",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 10
+ }, {
+ shape: "detailPagePortrait",
+ showTitle: true,
+ centerText: true,
+ overlayPlayButton: true
+ });
+ break;
- $("#radioMovies", page).on("click", function () {
+ case 'Game':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Game",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 10
+ }, {
+ shape: "detailPagePortrait",
+ showTitle: true,
+ centerText: true
+ });
+ break;
- shape = "poster";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "Movie",
- PersonTypes: "",
- ArtistIds: ""
- });
+ case 'Trailer':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Trailer",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 10
+ }, {
+ shape: "detailPagePortrait",
+ showTitle: true,
+ centerText: true,
+ overlayPlayButton: true
+ });
+ break;
- });
+ case 'Series':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Series",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 10
+ }, {
+ shape: "detailPagePortrait",
+ showTitle: true,
+ centerText: true
+ });
+ break;
- $("#radioShows", page).on("click", function () {
+ case 'MusicAlbum':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "MusicAlbum",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 8
+ }, {
+ shape: "detailPageSquare",
+ playFromHere: true,
+ showTitle: true,
+ showParentTitle: true,
+ centerText: true,
+ overlayPlayButton: true
+ });
+ break;
- shape = "poster";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "Series",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
+ case 'Episode':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Episode",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 6
+ }, {
+ shape: "detailPage169",
+ showTitle: true,
+ showParentTitle: true,
+ centerText: true,
+ overlayPlayButton: true
+ });
+ break;
- $("#radioTrailers", page).on("click", function () {
+ case 'Audio':
+ loadItems(element, item, type, {
+ MediaTypes: "",
+ IncludeItemTypes: "Audio",
+ PersonTypes: "",
+ ArtistIds: "",
+ Limit: 100
+ }, {
+ playFromHere: true,
+ defaultAction: 'playallfromhere',
+ smallIcon: true
+ });
+ break;
- shape = "poster";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "Trailer",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
-
- $("#radioGames", page).on("click", function () {
-
- shape = "poster";
- loadItems(page, {
- IncludeItemTypes: "",
- MediaTypes: "Game",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
-
- $("#radioEpisodes", page).on("click", function () {
-
- shape = "backdrop";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "Episode",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
-
- $("#radioAlbums", page).on("click", function () {
-
- shape = "square";
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "MusicAlbum",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
-
- $("#radioSongs", page).on("click", function () {
-
- loadItems(page, {
- MediaTypes: "",
- IncludeItemTypes: "Audio",
- PersonTypes: "",
- ArtistIds: ""
- });
- });
+ default:
+ break;
+ }
}
- function renderDetails(page, item, context) {
+ function loadItems(element, item, type, query, listOptions) {
- //LibraryBrowser.renderDetailPageBackdrop(page, item);
- LibraryBrowser.renderOverview(page.querySelectorAll('.itemOverview'), item);
+ query = getQuery(query, item);
- renderUserDataIcons(page, item);
- LibraryBrowser.renderLinks(page.querySelector('#itemLinks'), item);
+ getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).done(function (result) {
- LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
+ var html = '';
- if (item.Type == "Person" && item.PremiereDate) {
-
- try {
- var birthday = parseISO8601Date(item.PremiereDate, { toLocal: true }).toDateString();
-
- $('#itemBirthday', page).show().html(Globalize.translate('BirthDateValue').replace('{0}', birthday));
+ if (query.Limit && result.TotalRecordCount > query.Limit) {
+ // Add more button
+ var link = element.querySelector('a');
+ link.classList.remove('hide');
+ link.setAttribute('href', getMoreItemsHref(item, type));
+ } else {
+ element.querySelector('a').classList.add('hide');
}
- catch (err) {
- $('#itemBirthday', page).hide();
+
+ listOptions.items = result.Items;
+ var trigger = false;
+
+ if (type == 'Audio') {
+ html = LibraryBrowser.getListViewHtml(listOptions);
+ trigger = true;
+ } else {
+ html = LibraryBrowser.getPosterViewHtml(listOptions);
}
- } else {
- $('#itemBirthday', page).hide();
+
+ var itemsContainer = element.querySelector('.itemsContainer');
+ itemsContainer.innerHTML = html;
+
+ $(itemsContainer).createCardMenus();
+
+ if (trigger) {
+ $(itemsContainer).trigger('create');
+ }
+ ImageLoader.lazyChildren(itemsContainer);
+ });
+ }
+
+ function getMoreItemsHref(item, type) {
+
+ return 'secondaryitems.html?type=' + type + '&parentid=' + item.Id;
+ }
+
+ function addCurrentItemToQuery(query, item) {
+
+ if (item.Type == "Person") {
+ query.PersonIds = item.Id;
}
-
- if (item.Type == "Person" && item.EndDate) {
-
- try {
- var deathday = parseISO8601Date(item.EndDate, { toLocal: true }).toDateString();
-
- $('#itemDeathDate', page).show().html(Globalize.translate('DeathDateValue').replace('{0}', deathday));
- }
- catch (err) {
- $('#itemBirthday', page).hide();
- }
- } else {
+ else if (item.Type == "Genre") {
+ query.Genres = item.Name;
}
-
- if (item.Type == "Person" && item.ProductionLocations && item.ProductionLocations.length) {
-
- var gmap = '' + item.ProductionLocations[0] + '';
-
- $('#itemBirthLocation', page).show().html(Globalize.translate('BirthPlaceValue').replace('{0}', gmap)).trigger('create');
- } else {
- $('#itemBirthLocation', page).hide();
+ else if (item.Type == "MusicGenre") {
+ query.Genres = item.Name;
+ }
+ else if (item.Type == "GameGenre") {
+ query.Genres = item.Name;
+ }
+ else if (item.Type == "Studio") {
+ query.StudioIds = item.Id;
+ }
+ else if (item.Type == "MusicArtist") {
+ query.ArtistIds = item.Id;
}
}
- function renderUserDataIcons(page, item) {
- $('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
- }
-
- function addCurrentItemToQuery(query) {
-
- if (currentItem.Type == "Person") {
- query.PersonIds = currentItem.Id;
- }
- else if (currentItem.Type == "Genre") {
- query.Genres = currentItem.Name;
- }
- else if (currentItem.Type == "MusicGenre") {
- query.Genres = currentItem.Name;
- }
- else if (currentItem.Type == "GameGenre") {
- query.Genres = currentItem.Name;
- }
- else if (currentItem.Type == "Studio") {
- query.StudioIds = currentItem.Id;
- }
- else if (currentItem.Type == "MusicArtist") {
- query.ArtistIds = currentItem.Id;
- }
- }
-
- function getQuery(options) {
+ function getQuery(options, item) {
var query = {
@@ -359,14 +313,14 @@
query.SortBy = "AlbumArtist,Album,SortName";
}
- addCurrentItemToQuery(query);
+ addCurrentItemToQuery(query, item);
return query;
}
- function getItemsFunction(options) {
+ function getItemsFunction(options, item) {
- var query = getQuery(options);
+ var query = getQuery(options, item);
return function (index, limit, fields) {
@@ -383,187 +337,8 @@
}
- function loadItems(page, options) {
-
- Dashboard.showLoadingMsg();
-
- _childrenItemsFunction = getItemsFunction(options);
-
- var query = getQuery(options);
-
- getItemsFunction(options)(options.StartIndex, options.Limit, options.Fields).done(function (result) {
-
- var html = '';
-
- if (result.TotalRecordCount > query.Limit) {
-
- var pagingHtml = LibraryBrowser.getQueryPagingHtml({
- startIndex: query.StartIndex,
- limit: query.Limit,
- totalRecordCount: result.TotalRecordCount,
- showLimit: false,
- updatePageSizeSetting: false
- });
-
- page.querySelector('.listTopPaging').innerHTML = pagingHtml;
-
- $('.viewSettings', page).show();
- } else {
- $('.listTopPaging', page).html('');
- $('.viewSettings', page).hide();
- }
-
- var screenWidth = $(window).width();
-
- if (query.IncludeItemTypes == "Audio") {
-
- html = "" + LibraryBrowser.getListViewHtml({
- items: result.Items,
- playFromHere: true,
- defaultAction: 'playallfromhere',
- smallIcon: true
- }) + "
";
- }
- else if (query.IncludeItemTypes == "Movie" || query.IncludeItemTypes == "Trailer") {
-
- html = LibraryBrowser.getPosterViewHtml({
- items: result.Items,
- shape: "portrait",
- context: 'movies',
- showTitle: true,
- centerText: true
- });
-
- }
- else if (query.IncludeItemTypes == "Episode") {
-
- html += LibraryBrowser.getPosterViewHtml({
- items: result.Items,
- shape: "backdrop",
- showTitle: true,
- showParentTitle: true,
- overlayText: screenWidth >= 600
- });
-
- }
- else if (query.IncludeItemTypes == "Series") {
-
- html = LibraryBrowser.getPosterViewHtml({
- items: result.Items,
- shape: "backdrop",
- preferThumb: true,
- context: 'tv'
- });
-
- }
- else if (query.IncludeItemTypes == "MusicAlbum") {
-
- html = LibraryBrowser.getPosterViewHtml({
- items: result.Items,
- shape: "square",
- context: 'music',
- playFromHere: true,
- showTitle: true,
- showParentTitle: true
- });
-
- }
- else {
-
- html = "" + LibraryBrowser.getListViewHtml({
- items: result.Items,
- smallIcon: true
- }) + "
";
- }
-
- html += LibraryBrowser.getQueryPagingHtml({
- startIndex: query.StartIndex,
- limit: query.Limit,
- totalRecordCount: result.TotalRecordCount,
- showLimit: false,
- updatePageSizeSetting: false
- });
-
- var elem = page.querySelector('#items');
- elem.innerHTML = html;
- ImageLoader.lazyChildren(elem);
-
- // Do we still need this?
- $(elem).trigger('create');
-
- $('.btnNextPage', page).on('click', function () {
-
- query.StartIndex = query.StartIndex + query.Limit;
- loadItems(page, query);
- });
-
- $('.btnPreviousPage', page).on('click', function () {
-
- query.StartIndex = query.StartIndex - query.Limit;
- loadItems(page, query);
- });
-
- $('.selectPageSize', page).on('change', function () {
- query.Limit = parseInt(this.value);
- query.StartIndex = 0;
- loadItems(page, query);
- });
-
- Dashboard.hideLoadingMsg();
- });
- }
-
- $(document).on('pageinitdepends', "#itemByNameDetailPage", function () {
-
- var page = this;
-
- $('.btnPlay', page).on('click', function () {
- var userdata = currentItem.UserData || {};
- LibraryBrowser.showPlayMenu(this, currentItem.Id, currentItem.Type, false, "Audio", userdata.PlaybackPositionTicks);
- });
-
- $('.itemsContainer', page).on('playallfromhere', function (e, index) {
-
- LibraryBrowser.playAllFromHere(_childrenItemsFunction, index);
-
- }).on('queueallfromhere', function (e, index) {
-
- LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index);
-
- });
-
- $('.btnMoreCommands', page).on('click', function () {
-
- var button = this;
-
- Dashboard.getCurrentUser().done(function (user) {
-
- LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
- });
- });
-
- $('.btnSync', page).on('click', function () {
-
- SyncManager.showMenu({
- items: [currentItem]
- });
- });
-
- var btnMore = page.querySelectorAll('.btnMoreCommands iron-icon');
- for (var i = 0, length = btnMore.length; i < length; i++) {
- btnMore[i].icon = AppInfo.moreIcon;
- }
-
- }).on('pagebeforeshowready', "#itemByNameDetailPage", function () {
-
- var page = this;
-
- reload(page);
-
- }).on('pagebeforehide', "#itemByNameDetailPage", function () {
-
- currentItem = null;
- });
-
+ window.ItemsByName = {
+ renderItems: renderItems
+ };
})(jQuery, document, LibraryBrowser);
\ No newline at end of file
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js
index 962f35fc46..97da04e451 100644
--- a/dashboard-ui/scripts/itemdetailpage.js
+++ b/dashboard-ui/scripts/itemdetailpage.js
@@ -2,13 +2,47 @@
var currentItem;
- function reload(page) {
+ function getPromise() {
var id = getParameterByName('id');
+ if (id) {
+ return ApiClient.getItem(Dashboard.getCurrentUserId(), id);
+ }
+
+ var name = getParameterByName('genre');
+
+ if (name) {
+ return ApiClient.getGenre(name, Dashboard.getCurrentUserId());
+ }
+
+ name = getParameterByName('musicgenre');
+
+ if (name) {
+ return ApiClient.getMusicGenre(name, Dashboard.getCurrentUserId());
+ }
+
+ name = getParameterByName('gamegenre');
+
+ if (name) {
+ return ApiClient.getGameGenre(name, Dashboard.getCurrentUserId());
+ }
+
+ name = getParameterByName('musicartist');
+
+ if (name) {
+ return ApiClient.getArtist(name, Dashboard.getCurrentUserId());
+ }
+ else {
+ throw new Error('Invalid request');
+ }
+ }
+
+ function reload(page) {
+
Dashboard.showLoadingMsg();
- ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
+ getPromise().done(function (item) {
reloadFromItem(page, item);
});
@@ -251,6 +285,11 @@
$('#childrenCollapsible', page).removeClass('hide');
renderChannelGuide(page, item, user);
}
+ else if (item.Type == 'Studio' || item.Type == 'Person' || item.Type == 'Genre' || item.Type == 'MusicGenre' || item.Type == 'GameGenre' || item.Type == 'MusicArtist') {
+
+ $('#childrenCollapsible', page).removeClass('hide');
+ renderItemsByName(page, item, user);
+ }
else if (item.IsFolder) {
if (item.Type == "BoxSet") {
@@ -460,7 +499,7 @@
var artist = artists[i];
- html.push('' + artist.Name + '');
+ html.push('' + artist.Name + '');
}
@@ -620,7 +659,7 @@
}
if (item.Studios.length) {
- html += ' on ' + item.Studios[0].Name + '';
+ html += ' on ' + item.Studios[0].Name + '';
}
if (html) {
@@ -833,6 +872,15 @@
}
}
+ function renderItemsByName(page, item, user) {
+
+ require('scripts/itembynamedetailpage'.split(','), function () {
+
+
+ window.ItemsByName.renderItems(page, item);
+ });
+ }
+
function renderChannelGuide(page, item, user) {
require('scripts/livetvcomponents,scripts/livetvchannel,livetvcss'.split(','), function () {
@@ -1438,7 +1486,7 @@
}
var cast = casts[i];
- var href = isStatic ? '#' : 'itembynamedetails.html?context=' + context + '&id=' + cast.Id + '';
+ var href = isStatic ? '#' : 'itemdetails.html?context=' + context + '&id=' + cast.Id + '';
html += '';
var imgUrl;
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js
index c04a698215..ce47e23d6d 100644
--- a/dashboard-ui/scripts/librarybrowser.js
+++ b/dashboard-ui/scripts/librarybrowser.js
@@ -428,7 +428,7 @@
var artist = artists[i];
var css = cssClass ? (' class="' + cssClass + '"') : '';
- html.push('' + artist.Name + '');
+ html.push('' + artist.Name + '');
}
@@ -824,26 +824,26 @@
return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Genre") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "MusicGenre") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "GameGenre") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Studio") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Person") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.Type == "Recording") {
return "itemdetails.html?id=" + id;
}
if (item.Type == "MusicArtist") {
- return "itembynamedetails.html?id=" + id + contextSuffix;
+ return "itemdetails.html?id=" + id + contextSuffix;
}
if (item.IsFolder) {
@@ -3176,7 +3176,7 @@
if (isStatic) {
html += item.Studios[i].Name;
} else {
- html += '' + item.Studios[i].Name + '';
+ html += '' + item.Studios[i].Name + '';
}
}
@@ -3217,7 +3217,7 @@
if (isStatic) {
html += genres[i];
} else {
- html += '' + genres[i] + '';
+ html += '' + genres[i] + '';
}
}
diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js
index 199d2a5442..b0ee602660 100644
--- a/dashboard-ui/scripts/librarylist.js
+++ b/dashboard-ui/scripts/librarylist.js
@@ -417,13 +417,13 @@
Dashboard.navigate('itemdetails.html?id=' + albumid);
break;
case 'artist':
- Dashboard.navigate('itembynamedetails.html?context=music&id=' + artistid);
+ Dashboard.navigate('itemdetails.html?context=music&id=' + artistid);
break;
case 'play':
MediaController.play(itemId);
break;
case 'playallfromhere':
- $(card).parents('.itemsContainer').trigger('playallfromhere', [index]);
+ playAllFromHere(index, $(card).parents('.itemsContainer'), 'play');
break;
case 'queue':
MediaController.queue(itemId);
@@ -440,7 +440,7 @@
});
break;
case 'queueallfromhere':
- $(card).parents('.itemsContainer').trigger('queueallfromhere', [index]);
+ playAllFromHere(index, $(card).parents('.itemsContainer'), 'queue');
break;
case 'sync':
SyncManager.showMenu({
@@ -1145,12 +1145,34 @@
index = elemWithAttributes.getAttribute('data-index');
itemsContainer = $(elem).parents('.itemsContainer');
- itemsContainer.trigger('playallfromhere', [index]);
+ playAllFromHere(index, itemsContainer, 'play');
}
return false;
}
+ function playAllFromHere(index, itemsContainer, method) {
+
+ var ids = $('.mediaItem', itemsContainer).get().map(function(i) {
+ return i.getAttribute('data-itemid') || i.parentNode.getAttribute('data-itemid');
+ });
+
+ ids = ids.slice(index);
+
+ ApiClient.getItems(Dashboard.getCurrentUserId(), {
+
+ Ids: ids.join(','),
+ Fields: 'MediaSources,Chapters',
+ Limit: 100
+
+ }).done(function (result) {
+
+ MediaController[method]({
+ items: result.Items
+ });
+ });
+ }
+
$(document).on('pageinitdepends', ".libraryPage", function () {
var page = this;
diff --git a/dashboard-ui/scripts/livetvseriestimers.js b/dashboard-ui/scripts/livetvseriestimers.js
index e9cf6b5033..f95b698bc2 100644
--- a/dashboard-ui/scripts/livetvseriestimers.js
+++ b/dashboard-ui/scripts/livetvseriestimers.js
@@ -78,7 +78,7 @@
html += '';
- html += '';
+ html += '';
html += '';
}
diff --git a/dashboard-ui/scripts/livetvtimers.js b/dashboard-ui/scripts/livetvtimers.js
index ef11e56f42..f7835dfab0 100644
--- a/dashboard-ui/scripts/livetvtimers.js
+++ b/dashboard-ui/scripts/livetvtimers.js
@@ -101,7 +101,7 @@
html += '';
}
- html += '
';
+ html += '
';
html += '';
}
diff --git a/dashboard-ui/scripts/reports.js b/dashboard-ui/scripts/reports.js
index 6fc52a8393..8f990d810d 100644
--- a/dashboard-ui/scripts/reports.js
+++ b/dashboard-ui/scripts/reports.js
@@ -106,7 +106,7 @@
html += '
' + rItem.Name + '';
break;
case "ItemByNameDetails":
- html += '
' + rItem.Name + '';
+ html += '
' + rItem.Name + '';
break;
case "EmbeddedImage":
if (rRow.HasEmbeddedImage) {
@@ -237,7 +237,7 @@
var rItem = group.Items[j];
html += '
"")
- html += ' href="itembynamedetails.html?id=' + rItem.Id + '"';
+ html += ' href="itemdetails.html?id=' + rItem.Id + '"';
html += '>' + rItem.Name + ' ' + '';
html += '';
}
diff --git a/dashboard-ui/scripts/secondaryitems.js b/dashboard-ui/scripts/secondaryitems.js
index c61a02dbcd..4a72f9af21 100644
--- a/dashboard-ui/scripts/secondaryitems.js
+++ b/dashboard-ui/scripts/secondaryitems.js
@@ -1,10 +1,32 @@
(function ($, document) {
- var view = LibraryBrowser.getDefaultItemsView('Poster', 'Poster');
-
var data = {};
- function getQuery() {
+ function addCurrentItemToQuery(query, item) {
+
+ if (item.Type == "Person") {
+ query.PersonIds = item.Id;
+ }
+ else if (item.Type == "Genre") {
+ query.Genres = item.Name;
+ }
+ else if (item.Type == "MusicGenre") {
+ query.Genres = item.Name;
+ }
+ else if (item.Type == "GameGenre") {
+ query.Genres = item.Name;
+ }
+ else if (item.Type == "Studio") {
+ query.StudioIds = item.Id;
+ }
+ else if (item.Type == "MusicArtist") {
+ query.ArtistIds = item.Id;
+ } else {
+ query.ParentId = item.Id;
+ }
+ }
+
+ function getQuery(parentItem) {
var key = getSavedQueryKey();
var pageData = data[key];
@@ -33,7 +55,10 @@
pageData.query.Filters = filters;
}
- pageData.query.ParentId = getParameterByName('parentid') || LibraryMenu.getTopParentId();
+ if (parentItem) {
+ addCurrentItemToQuery(pageData.query, parentItem);
+ }
+
LibraryBrowser.loadSavedQueryValues(key, pageData.query);
}
return pageData.query;
@@ -59,11 +84,11 @@
}
}
- function reloadItems(page) {
+ function reloadItems(page, parentItem) {
Dashboard.showLoadingMsg();
- var query = getQuery();
+ var query = getQuery(parentItem);
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
@@ -79,46 +104,63 @@
});
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
+ var trigger = false;
- var posterOptions = {
- items: result.Items,
- shape: "auto",
- centerText: true,
- lazy: true,
- overlayText: true
- };
+ if (query.IncludeItemTypes == "Audio") {
- if (query.IncludeItemTypes == "MusicAlbum") {
- posterOptions.overlayText = false;
- posterOptions.showParentTitle = true;
- posterOptions.overlayPlayButton = true;
- }
- else if (query.IncludeItemTypes == "MusicArtist") {
- posterOptions.overlayText = false;
- posterOptions.overlayPlayButton = true;
- }
- else if (query.IncludeItemTypes == "Episode") {
- posterOptions.overlayText = false;
- posterOptions.showParentTitle = true;
- posterOptions.overlayPlayButton = true;
- posterOptions.centerText = false;
- }
+ html = '
' + LibraryBrowser.getListViewHtml({
+ items: result.Items,
+ playFromHere: true,
+ defaultAction: 'playallfromhere',
+ smallIcon: true
+ }) + '
';
+ trigger = true;
- // Poster
- html = LibraryBrowser.getPosterViewHtml(posterOptions);
+ } else {
+ var posterOptions = {
+ items: result.Items,
+ shape: "auto",
+ centerText: true,
+ lazy: true,
+ overlayText: true
+ };
+
+ if (query.IncludeItemTypes == "MusicAlbum") {
+ posterOptions.overlayText = false;
+ posterOptions.showParentTitle = true;
+ posterOptions.overlayPlayButton = true;
+ }
+ else if (query.IncludeItemTypes == "MusicArtist") {
+ posterOptions.overlayText = false;
+ posterOptions.overlayPlayButton = true;
+ }
+ else if (query.IncludeItemTypes == "Episode") {
+ posterOptions.overlayText = false;
+ posterOptions.showParentTitle = true;
+ posterOptions.overlayPlayButton = true;
+ posterOptions.centerText = false;
+ }
+
+ // Poster
+ html = LibraryBrowser.getPosterViewHtml(posterOptions);
+ }
var elem = page.querySelector('#items');
elem.innerHTML = html + pagingHtml;
ImageLoader.lazyChildren(elem);
+ if (trigger) {
+ $(elem).trigger('create');
+ }
+
$('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit;
- reloadItems(page);
+ reloadItems(page, parentItem);
});
$('.btnPreviousPage', page).on('click', function () {
query.StartIndex -= query.Limit;
- reloadItems(page);
+ reloadItems(page, parentItem);
});
LibraryBrowser.setLastRefreshed(page);
@@ -139,10 +181,14 @@
if (getParameterByName('parentid')) {
ApiClient.getItem(Dashboard.getCurrentUserId(), getParameterByName('parentid')).done(function (parent) {
LibraryMenu.setTitle(parent.Name);
+
+ if (LibraryBrowser.needsRefresh(page)) {
+ reloadItems(page, parent);
+ }
});
}
- if (LibraryBrowser.needsRefresh(page)) {
+ else if (LibraryBrowser.needsRefresh(page)) {
reloadItems(page);
}
});
diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js
index 0f7e60fed6..164ff82fec 100644
--- a/dashboard-ui/scripts/site.js
+++ b/dashboard-ui/scripts/site.js
@@ -1173,22 +1173,22 @@ var Dashboard = {
var type = (cmd.ItemType || "").toLowerCase();
if (type == "genre") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
else if (type == "musicgenre") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
else if (type == "gamegenre") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
else if (type == "studio") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
else if (type == "person") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
else if (type == "musicartist") {
- url = "itembynamedetails.html?id=" + cmd.ItemId;
+ url = "itemdetails.html?id=" + cmd.ItemId;
}
if (url) {
diff --git a/dashboard-ui/thirdparty/emby-icons.html b/dashboard-ui/thirdparty/emby-icons.html
index c7416cf1a2..a68af9f3ee 100644
--- a/dashboard-ui/thirdparty/emby-icons.html
+++ b/dashboard-ui/thirdparty/emby-icons.html
@@ -126,6 +126,7 @@ See [iron-iconset](#iron-iconset) and [iron-iconset-svg](#iron-iconset-svg) for
+
diff --git a/dashboard-ui/vulcanize-out.html b/dashboard-ui/vulcanize-out.html
index 80c925b2ad..263056bf82 100644
--- a/dashboard-ui/vulcanize-out.html
+++ b/dashboard-ui/vulcanize-out.html
@@ -18671,6 +18671,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
+