mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update dlna profile list
This commit is contained in:
parent
4ed0a8d919
commit
ac9ab5502a
6 changed files with 97 additions and 193 deletions
|
@ -6,78 +6,76 @@
|
|||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
||||
|
||||
renderProfiles(page, result);
|
||||
renderUserProfiles(page, result);
|
||||
renderSystemProfiles(page, result);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function renderProfiles(page, profiles) {
|
||||
|
||||
renderUserProfiles(page, profiles);
|
||||
renderSystemProfiles(page, profiles);
|
||||
}
|
||||
|
||||
function renderUserProfiles(page, profiles) {
|
||||
|
||||
profiles = profiles.filter(function (p) {
|
||||
renderProfiles(page, page.querySelector('.customProfiles'), profiles.filter(function (p) {
|
||||
return p.Type == 'User';
|
||||
});
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
|
||||
var profile = profiles[i];
|
||||
|
||||
html += '<li>';
|
||||
html += '<a href="dlnaprofile.html?id=' + profile.Id + '">';
|
||||
html += profile.Name;
|
||||
html += '</a>';
|
||||
|
||||
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileid="' + profile.Id + '">' + Globalize.translate('Delete') + '</a>';
|
||||
|
||||
html += '</li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
var elem = $('.customProfiles', page).html(html).trigger('create');
|
||||
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
|
||||
var id = this.getAttribute('data-profileid');
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
function renderSystemProfiles(page, profiles) {
|
||||
|
||||
profiles = profiles.filter(function (p) {
|
||||
renderProfiles(page, page.querySelector('.systemProfiles'), profiles.filter(function (p) {
|
||||
return p.Type == 'System';
|
||||
}));
|
||||
}
|
||||
|
||||
function renderProfiles(page, element, profiles) {
|
||||
|
||||
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (profiles.length) {
|
||||
html += '<div class="paperList">';
|
||||
}
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
|
||||
var profile = profiles[i];
|
||||
|
||||
html += '<paper-icon-item>';
|
||||
|
||||
html += "<a item-icon class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>";
|
||||
html += '<paper-fab mini icon="dvr" class="blue"></paper-fab>';
|
||||
html += "</a>";
|
||||
|
||||
html += '<paper-item-body two-line>';
|
||||
html += "<a class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>";
|
||||
|
||||
html += "<div>" + profile.Name + "</div>";
|
||||
//html += "<div secondary>" + task.Description + "</div>";
|
||||
|
||||
html += "</a>";
|
||||
html += '</paper-item-body>';
|
||||
|
||||
if (profile.Type == 'User') {
|
||||
html += '<paper-icon-button icon="delete" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + Globalize.translate('ButtonDelete') + '"></paper-icon-button>';
|
||||
}
|
||||
|
||||
html += '</paper-icon-item>';
|
||||
}
|
||||
|
||||
if (profiles.length) {
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
element.innerHTML = html;
|
||||
|
||||
$('.btnDeleteProfile', element).on('click', function () {
|
||||
|
||||
var id = this.getAttribute('data-profileid');
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
});
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true">';
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
|
||||
var profile = profiles[i];
|
||||
|
||||
html += '<li>';
|
||||
html += '<a href="dlnaprofile.html?id=' + profile.Id + '">';
|
||||
html += profile.Name;
|
||||
html += '</a>';
|
||||
html += '</li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
$('.systemProfiles', page).html(html).trigger('create');
|
||||
}
|
||||
|
||||
function deleteProfile(page, id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue