diff --git a/dashboard-ui/edititemmetadata.html b/dashboard-ui/edititemmetadata.html index 53a652623b..27ced96e9c 100644 --- a/dashboard-ui/edititemmetadata.html +++ b/dashboard-ui/edititemmetadata.html @@ -296,6 +296,7 @@ @@ -448,10 +449,58 @@ + + diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 7321b13aa2..8ebe59a703 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -165,10 +165,10 @@ DashboardPage.renderHasPendingRestart(page, true); } else if (msg.MessageType == "ServerShuttingDown") { - DashboardPage.renderHasPendingRestart(page, false); + DashboardPage.renderHasPendingRestart(page, true); } else if (msg.MessageType == "ServerRestarting") { - DashboardPage.renderHasPendingRestart(page, false); + DashboardPage.renderHasPendingRestart(page, true); } else if (msg.MessageType == "ScheduledTasksInfo") { diff --git a/dashboard-ui/scripts/edititemmetadata.js b/dashboard-ui/scripts/edititemmetadata.js index ac28f527c8..3ec6847021 100644 --- a/dashboard-ui/scripts/edititemmetadata.js +++ b/dashboard-ui/scripts/edititemmetadata.js @@ -430,7 +430,7 @@ populateListView($('#listCountries', page), item.ProductionLocations || []); populateListView($('#listGenres', page), item.Genres); - populatePeople($('#peopleList', page), item.People || []); + populatePeople(page, item.People || []); populateListView($('#listStudios', page), (item.Studios || []).map(function (element) { return element.Name || ''; })); @@ -544,11 +544,13 @@ } } - function populatePeople(elem, people) { + function populatePeople(page, people) { var lastType = ''; var html = ''; + var elem = $('#peopleList', page); + for (var i = 0, length = people.length; i < length; i++) { var person = people[i]; @@ -560,7 +562,7 @@ lastType = type; } - html += '
  • '; + html += '
  • '; html += '

    ' + (person.Name || 'Unknown name') + '

    '; @@ -581,8 +583,61 @@ var index = parseInt(this.getAttribute('data-index')); currentItem.People.splice(index, 1); - populatePeople(elem, currentItem.People); + populatePeople(page, currentItem.People); }); + + $('.btnEditPerson', elem).on('click', function () { + + var index = parseInt(this.getAttribute('data-index')); + + editPerson(page, currentItem.People[index], index); + }); + } + + function editPerson(page, person, index) { + + $('#popupEditPerson', page).popup("open"); + + $('#txtPersonName', page).val(person.Name || ''); + $('#selectPersonType', page).val(person.Type || '').selectmenu('refresh'); + $('#txtPersonRole', page).val(person.Role || ''); + + if (index == null) { + index = ''; + } + + $("#fldPersonIndex", page).val(index); + } + + function savePersonInfo(page) { + + $('#popupEditPerson', page).popup("close"); + + var index = $("#fldPersonIndex", page).val(); + var person; + + var isNew = true; + + if (index) { + + isNew = false; + index = parseInt(index); + + person = currentItem.People[index]; + + } else { + person = {}; + } + + person.Name = $('#txtPersonName', page).val(); + person.Type = $('#selectPersonType', page).val(); + person.Role = $('#txtPersonRole', page).val(); + + if (isNew) { + currentItem.People.push(person); + } + + populatePeople(page, currentItem.People); } function convertTo24HourFormat(time) { @@ -913,6 +968,14 @@ searchForIdentificationResults(page); return false; }; + + self.onPersonInfoFormSubmit = function () { + + var page = $(this).parents('.page'); + + savePersonInfo(page); + return false; + }; } window.EditItemMetadataPage = new editItemMetadataPage(); @@ -1205,6 +1268,11 @@ } }); + $("#btnAddPerson", page).on('click', function (event, data) { + + editPerson(page, {}); + }); + }).on('pagebeforeshow', "#editItemMetadataPage", function () { var page = this;