1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

restored people editing

This commit is contained in:
Luke Pulverenti 2014-06-04 12:15:44 -04:00
parent e0996c055a
commit 8c19923b73
3 changed files with 123 additions and 6 deletions

View file

@ -296,6 +296,7 @@
<div data-mini="true" data-role="collapsible" id="peopleCollapsible" style="display: none; margin-top: 1em;"> <div data-mini="true" data-role="collapsible" id="peopleCollapsible" style="display: none; margin-top: 1em;">
<h3>People</h3> <h3>People</h3>
<div> <div>
<button type="button" id="btnAddPerson" data-icon="plus" data-mini="true" data-theme="a">Add Person</button>
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="peopleList"></ul> <ul data-role="listview" data-inset="true" data-split-icon="delete" id="peopleList"></ul>
</div> </div>
</div> </div>
@ -448,10 +449,58 @@
</div> </div>
<div data-role="popup" data-transition="slidefade" id="popupEditPerson" class="popup" data-theme="a">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
<h3 style="margin: .5em;">Person Info</h3>
</div>
<div data-role="content">
<form class="popupEditPersonForm">
<div>
<label for="txtPersonName">Name:</label>
<input type="text" id="txtPersonName" required="required" data-mini="true" />
</div>
<div>
<label for="selectPersonType">Type:</label>
<select id="selectPersonType" data-mini="true">
<option value=""></option>
<option value="Actor">Actor</option>
<option value="Composer">Composer</option>
<option value="Director">Director</option>
<option value="GuestStar">Guest Star</option>
<option value="Producer">Producer</option>
<option value="Writer">Writer</option>
</select>
</div>
<div>
<label for="txtPersonRole">Role:</label>
<input type="text" id="txtPersonRole" data-mini="true" />
<div class="fieldDescription">Role is generally only applicable to actors.</div>
</div>
<br />
<input type="hidden" id="fldPersonIndex" />
<p>
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
Ok
</button>
<button type="button" data-icon="delete" onclick="$(this).parents('.popup').popup('close');" data-mini="true">
Cancel
</button>
</p>
</form>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit); $('.editItemMetadataForm').off('submit', EditItemMetadataPage.onSubmit).on('submit', EditItemMetadataPage.onSubmit);
$('.popupConfirmDeleteForm').off('submit', EditItemMetadataPage.onDeleteFormSubmitted).on('submit', EditItemMetadataPage.onDeleteFormSubmitted); $('.popupConfirmDeleteForm').off('submit', EditItemMetadataPage.onDeleteFormSubmitted).on('submit', EditItemMetadataPage.onDeleteFormSubmitted);
$('.popupIdentifyForm').off('submit', EditItemMetadataPage.onIdentificationFormSubmitted).on('submit', EditItemMetadataPage.onIdentificationFormSubmitted); $('.popupIdentifyForm').off('submit', EditItemMetadataPage.onIdentificationFormSubmitted).on('submit', EditItemMetadataPage.onIdentificationFormSubmitted);
$('.popupEditPersonForm').off('submit', EditItemMetadataPage.onPersonInfoFormSubmit).on('submit', EditItemMetadataPage.onPersonInfoFormSubmit);
</script> </script>
</div> </div>

View file

@ -165,10 +165,10 @@
DashboardPage.renderHasPendingRestart(page, true); DashboardPage.renderHasPendingRestart(page, true);
} }
else if (msg.MessageType == "ServerShuttingDown") { else if (msg.MessageType == "ServerShuttingDown") {
DashboardPage.renderHasPendingRestart(page, false); DashboardPage.renderHasPendingRestart(page, true);
} }
else if (msg.MessageType == "ServerRestarting") { else if (msg.MessageType == "ServerRestarting") {
DashboardPage.renderHasPendingRestart(page, false); DashboardPage.renderHasPendingRestart(page, true);
} }
else if (msg.MessageType == "ScheduledTasksInfo") { else if (msg.MessageType == "ScheduledTasksInfo") {

View file

@ -430,7 +430,7 @@
populateListView($('#listCountries', page), item.ProductionLocations || []); populateListView($('#listCountries', page), item.ProductionLocations || []);
populateListView($('#listGenres', page), item.Genres); 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 || ''; })); 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 lastType = '';
var html = ''; var html = '';
var elem = $('#peopleList', page);
for (var i = 0, length = people.length; i < length; i++) { for (var i = 0, length = people.length; i < length; i++) {
var person = people[i]; var person = people[i];
@ -560,7 +562,7 @@
lastType = type; lastType = type;
} }
html += '<li><a href="#">'; html += '<li><a class="btnEditPerson" href="#" data-index="' + i + '">';
html += '<h3>' + (person.Name || 'Unknown name') + '</h3>'; html += '<h3>' + (person.Name || 'Unknown name') + '</h3>';
@ -581,8 +583,61 @@
var index = parseInt(this.getAttribute('data-index')); var index = parseInt(this.getAttribute('data-index'));
currentItem.People.splice(index, 1); 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) { function convertTo24HourFormat(time) {
@ -913,6 +968,14 @@
searchForIdentificationResults(page); searchForIdentificationResults(page);
return false; return false;
}; };
self.onPersonInfoFormSubmit = function () {
var page = $(this).parents('.page');
savePersonInfo(page);
return false;
};
} }
window.EditItemMetadataPage = new editItemMetadataPage(); window.EditItemMetadataPage = new editItemMetadataPage();
@ -1205,6 +1268,11 @@
} }
}); });
$("#btnAddPerson", page).on('click', function (event, data) {
editPerson(page, {});
});
}).on('pagebeforeshow', "#editItemMetadataPage", function () { }).on('pagebeforeshow', "#editItemMetadataPage", function () {
var page = this; var page = this;