mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
create collections from movies page
This commit is contained in:
parent
d3a7d45969
commit
e0996c055a
5 changed files with 270 additions and 71 deletions
|
@ -62,30 +62,27 @@
|
||||||
border-width: 0 !important;
|
border-width: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.libraryMenuButton {
|
.libraryMenuButton img {
|
||||||
/*padding-left: 10px;
|
border: 1px solid #444 !important;
|
||||||
opacity: .85;*/
|
padding: .5em;
|
||||||
|
background-color: #181818;
|
||||||
|
border-radius: 5px;
|
||||||
|
height: 14px!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headerHomeButton {
|
.libraryMenuButton:hover {
|
||||||
padding-right: 0!important;
|
opacity: 1!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.libraryMenuButton img, .headerHomeButton img {
|
.libraryMenuButton img:hover {
|
||||||
border: 1px solid #444 !important;
|
background-color: #38c;
|
||||||
padding: .5em;
|
}
|
||||||
background-color: #181818;
|
|
||||||
border-radius: 5px;
|
|
||||||
height: 14px!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.libraryMenuButton:hover {
|
@media all and (min-width: 600px) {
|
||||||
opacity: 1!important;
|
.libraryMenuButton {
|
||||||
}
|
opacity: .9;
|
||||||
|
|
||||||
.libraryMenuButton img:hover, .headerHomeButton img:hover {
|
|
||||||
background-color: #38c;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.libraryMenuButtonText {
|
.libraryMenuButtonText {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
@ -321,14 +318,6 @@
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 600px) {
|
|
||||||
|
|
||||||
.headerSettingsButton {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media all and (max-width: 500px) {
|
@media all and (max-width: 500px) {
|
||||||
|
|
||||||
.libraryMenuButtonText {
|
.libraryMenuButtonText {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<title>${TitleMediaBrowser}</title>
|
<title>${TitleMediaBrowser}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="moviesPage" data-role="page" class="page libraryPage" data-theme="b">
|
<div id="moviesPage" data-role="page" class="page libraryPage collectionEditorPage" data-theme="b">
|
||||||
|
|
||||||
<div class="libraryViewNav scopedLibraryViewNav">
|
<div class="libraryViewNav scopedLibraryViewNav">
|
||||||
<a href="movieslatest.html">${TabLatest}</a>
|
<a href="movieslatest.html">${TabLatest}</a>
|
||||||
|
@ -38,13 +38,45 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="selectionCommands" style="display: none;">
|
<div class="selectionCommands" style="display: none;">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="selectionCommandsControlGroup">
|
<div class="selectionCommandsControlGroup">
|
||||||
<button class="btnMergeVersions" data-mini="true" data-icon="recycle" data-inline="true" title="${ButtonGroupVersions}">${ButtonGroupVersions}</button>
|
<button class="btnMergeVersions" data-mini="true" data-icon="recycle" data-inline="true" title="${ButtonGroupVersions}">${ButtonGroupVersions}</button>
|
||||||
|
<button class="btnAddToCollection" data-mini="true" data-icon="plus" data-inline="true" title="${ButtonAddToCollection}">${ButtonAddToCollection}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="items" class="itemsContainer"></div>
|
<div id="items" class="itemsContainer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-role="panel" class="newCollectionPanel" data-position="right" data-display="overlay" data-position-fixed="true">
|
||||||
|
<form class="newCollectionForm">
|
||||||
|
|
||||||
|
<h3>${HeaderAddToCollection}</h3>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<label for="selectCollectionToAddTo">${LabelSelectCollection}</label>
|
||||||
|
<select id="selectCollectionToAddTo" data-mini="true"></select>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="newCollectionInfo">
|
||||||
|
<div>
|
||||||
|
<label for="txtNewCollectionName">${LabelName}</label>
|
||||||
|
<input type="text" id="txtNewCollectionName" required="required" />
|
||||||
|
<div class="fieldDescription">${NewCollectionNameExample}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<label for="chkEnableInternetMetadata">${OptionSearchForInternetMetadata}</label>
|
||||||
|
<input type="checkbox" id="chkEnableInternetMetadata" data-mini="true" />
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<input class="fldSelectedItemIds" type="hidden" />
|
||||||
|
<button type="submit" data-icon="plus" data-mini="true">${ButtonSubmit}</button>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-position-fixed="true">
|
<div data-role="panel" id="sortPanel" data-position="right" data-display="overlay" data-position-fixed="true">
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
@ -210,6 +242,9 @@
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('.newCollectionForm').off('submit', BoxSetEditor.onNewCollectionSubmit).on('submit', BoxSetEditor.onNewCollectionSubmit);
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -300,7 +300,7 @@
|
||||||
if (selection.length < 2) {
|
if (selection.length < 2) {
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('MessagePleaseSelectItemsToGroup'),
|
message: Globalize.translate('MessagePleaseSelectTwoItems'),
|
||||||
title: Globalize.translate('HeaderError')
|
title: Globalize.translate('HeaderError')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -324,6 +324,7 @@
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
|
url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
|
||||||
|
|
||||||
|
@ -331,13 +332,30 @@
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
hideSelections();
|
hideSelections(page);
|
||||||
|
|
||||||
$('.itemsContainer', page).trigger('needsrefresh');
|
$('.itemsContainer', page).trigger('needsrefresh');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addToCollection(page) {
|
||||||
|
|
||||||
|
var selection = getSelectedItems(page);
|
||||||
|
|
||||||
|
if (selection.length < 1) {
|
||||||
|
|
||||||
|
Dashboard.alert({
|
||||||
|
message: Globalize.translate('MessagePleaseSelectOneItem'),
|
||||||
|
title: Globalize.translate('HeaderError')
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BoxSetEditor.showPanel(page, selection);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', ".libraryPage", function () {
|
$(document).on('pageinit', ".libraryPage", function () {
|
||||||
|
|
||||||
|
@ -351,6 +369,16 @@
|
||||||
combineVersions(page);
|
combineVersions(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.btnAddToCollection', page).on('click', function () {
|
||||||
|
addToCollection(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
hideSelections(page);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, document, window);
|
})(jQuery, document, window);
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
$(document).trigger('headercreated');
|
$(document).trigger('headercreated');
|
||||||
|
|
||||||
$('.libraryMenuButton').on('click', showLibraryMenu);
|
$('.libraryMenuButton').createHoverTouch().on('hovertouch', showLibraryMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemHref(item) {
|
function getItemHref(item) {
|
||||||
|
@ -86,10 +86,15 @@
|
||||||
|
|
||||||
updateLibraryNavLinks($.mobile.activePage);
|
updateLibraryNavLinks($.mobile.activePage);
|
||||||
|
|
||||||
$(panel).panel('toggle');
|
$(panel).panel('toggle').off('mouseleave.librarymenu').on('mouseleave.librarymenu', function () {
|
||||||
|
|
||||||
|
$(this).panel("close");
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLibraryMenu(panel) {
|
function updateLibraryMenu(panel) {
|
||||||
|
|
||||||
var userId = Dashboard.getCurrentUserId();
|
var userId = Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
ApiClient.getItems(userId, {
|
ApiClient.getItems(userId, {
|
||||||
|
@ -181,9 +186,9 @@
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLibraryMenuText(text) {
|
function setLibraryMenuText(text) {
|
||||||
|
|
||||||
$('.libraryMenuButtonText').html('<span>' + text + '</span>');
|
$('.libraryMenuButtonText').html('<span>' + text + '</span>');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -197,7 +202,7 @@
|
||||||
showLibraryMenu: showLibraryMenu,
|
showLibraryMenu: showLibraryMenu,
|
||||||
|
|
||||||
getTopParentId: getTopParentId,
|
getTopParentId: getTopParentId,
|
||||||
|
|
||||||
setText: setLibraryMenuText
|
setText: setLibraryMenuText
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -349,4 +354,54 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(window, document, jQuery);
|
})(window, document, jQuery);
|
||||||
|
|
||||||
|
$.fn.createHoverTouch = function () {
|
||||||
|
|
||||||
|
var preventHover = false;
|
||||||
|
var timerId;
|
||||||
|
|
||||||
|
function startTimer(elem) {
|
||||||
|
|
||||||
|
stopTimer();
|
||||||
|
|
||||||
|
timerId = setTimeout(function () {
|
||||||
|
|
||||||
|
$(elem).trigger('hovertouch');
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopTimer(elem) {
|
||||||
|
|
||||||
|
if (timerId) {
|
||||||
|
clearTimeout(timerId);
|
||||||
|
timerId = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $(this).on('mouseenter', function () {
|
||||||
|
|
||||||
|
if (preventHover === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
startTimer(this);
|
||||||
|
|
||||||
|
}).on('mouseleave', function () {
|
||||||
|
|
||||||
|
stopTimer(this);
|
||||||
|
|
||||||
|
}).on('touchstart', function () {
|
||||||
|
|
||||||
|
preventHover = true;
|
||||||
|
|
||||||
|
}).on('click', function () {
|
||||||
|
|
||||||
|
preventHover = true;
|
||||||
|
|
||||||
|
if (preventHover) {
|
||||||
|
$(this).trigger('hovertouch');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
|
@ -104,13 +104,6 @@
|
||||||
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
|
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNewCollectionPanel(page) {
|
|
||||||
|
|
||||||
$('.newCollectionPanel', page).panel('toggle');
|
|
||||||
|
|
||||||
$('#txtNewCollectionName', page).val('').focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).on('pageinit', "#boxsetsPage", function () {
|
$(document).on('pageinit', "#boxsetsPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
@ -199,21 +192,54 @@
|
||||||
}).on('pageshow', "#boxsetsPage", function () {
|
}).on('pageshow', "#boxsetsPage", function () {
|
||||||
|
|
||||||
updateFilterControls(this);
|
updateFilterControls(this);
|
||||||
|
|
||||||
}).on('collectionedit', "#boxsetsPage", function () {
|
|
||||||
|
|
||||||
reloadItems(this);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery, document);
|
})(jQuery, document);
|
||||||
|
|
||||||
(function ($, document) {
|
(function ($, document) {
|
||||||
|
|
||||||
function showNewCollectionPanel(page) {
|
function showNewCollectionPanel(page, items) {
|
||||||
|
|
||||||
$('.newCollectionPanel', page).panel('toggle');
|
$('.fldSelectedItemIds', page).val(items.join(','));
|
||||||
|
|
||||||
$('#txtNewCollectionName', page).val('').focus();
|
var panel = $('.newCollectionPanel', page).panel('toggle');
|
||||||
|
|
||||||
|
populateCollections(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateCollections(panel) {
|
||||||
|
|
||||||
|
var select = $('#selectCollectionToAddTo', panel);
|
||||||
|
|
||||||
|
if (!select.length) {
|
||||||
|
|
||||||
|
$('#txtNewCollectionName', panel).val('').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.newCollectionInfo', panel).hide();
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
|
||||||
|
Recursive: true,
|
||||||
|
IncludeItemTypes: "BoxSet"
|
||||||
|
};
|
||||||
|
|
||||||
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
html += '<option value="">' + Globalize.translate('OptionNewCollection') + '</option>';
|
||||||
|
|
||||||
|
html += result.Items.map(function (i) {
|
||||||
|
|
||||||
|
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
||||||
|
});
|
||||||
|
|
||||||
|
select.html(html).val('').selectmenu('refresh').trigger('change');
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', ".collectionEditorPage", function () {
|
$(document).on('pageinit', ".collectionEditorPage", function () {
|
||||||
|
@ -222,7 +248,18 @@
|
||||||
|
|
||||||
$('.btnNewCollection', page).on('click', function () {
|
$('.btnNewCollection', page).on('click', function () {
|
||||||
|
|
||||||
showNewCollectionPanel(page);
|
showNewCollectionPanel(page, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selectCollectionToAddTo', page).on('change', function () {
|
||||||
|
|
||||||
|
if (this.value) {
|
||||||
|
$('.newCollectionInfo', page).hide();
|
||||||
|
$('#txtNewCollectionName', page).removeAttr('required');
|
||||||
|
} else {
|
||||||
|
$('.newCollectionInfo', page).show();
|
||||||
|
$('#txtNewCollectionName', page).attr('required', 'required');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}).on('pagebeforeshow', ".collectionEditorPage", function () {
|
}).on('pagebeforeshow', ".collectionEditorPage", function () {
|
||||||
|
@ -240,36 +277,91 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function createCollection(page) {
|
||||||
|
|
||||||
|
var url = ApiClient.getUrl("Collections", {
|
||||||
|
|
||||||
|
Name: $('#txtNewCollectionName', page).val(),
|
||||||
|
IsLocked: !$('#chkEnableInternetMetadata', page).checked(),
|
||||||
|
Ids: $('.fldSelectedItemIds', page).val() || ''
|
||||||
|
|
||||||
|
//ParentId: getParameterByName('parentId') || LibraryMenu.getTopParentId()
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
dataType: "json"
|
||||||
|
|
||||||
|
}).done(function (result) {
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
var id = result.Id;
|
||||||
|
var destination = 'itemdetails.html?id=' + id;
|
||||||
|
|
||||||
|
var context = getParameterByName('context');
|
||||||
|
|
||||||
|
if (context) {
|
||||||
|
destination += "&context=" + context;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.newCollectionPanel', page).panel('toggle');
|
||||||
|
Dashboard.navigate(destination);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addToCollection(page, id) {
|
||||||
|
|
||||||
|
var url = ApiClient.getUrl("Collections/" + id + "/Items", {
|
||||||
|
|
||||||
|
Ids: $('.fldSelectedItemIds', page).val() || ''
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url
|
||||||
|
|
||||||
|
}).done(function () {
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
var destination = 'itemdetails.html?id=' + id;
|
||||||
|
|
||||||
|
var context = getParameterByName('context');
|
||||||
|
|
||||||
|
if (context) {
|
||||||
|
destination += "&context=" + context;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.newCollectionPanel', page).panel('toggle');
|
||||||
|
Dashboard.navigate(destination);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
window.BoxSetEditor = {
|
window.BoxSetEditor = {
|
||||||
|
|
||||||
|
showPanel: function (page, items) {
|
||||||
|
showNewCollectionPanel(page, items);
|
||||||
|
},
|
||||||
|
|
||||||
onNewCollectionSubmit: function () {
|
onNewCollectionSubmit: function () {
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
var page = $(this).parents('.page');
|
var page = $(this).parents('.page');
|
||||||
|
|
||||||
var url = ApiClient.getUrl("Collections", {
|
var collectionId = $('#selectCollectionToAddTo', page).val();
|
||||||
|
|
||||||
Name: $('#txtNewCollectionName', page).val(),
|
if (collectionId) {
|
||||||
IsLocked: !$('#chkEnableInternetMetadata', page).checked(),
|
addToCollection(page, collectionId);
|
||||||
|
} else {
|
||||||
ParentId: getParameterByName('parentId') || LibraryMenu.getTopParentId()
|
createCollection(page);
|
||||||
|
}
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
|
|
||||||
}).done(function () {
|
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
|
||||||
|
|
||||||
$('.newCollectionPanel', page).panel('toggle');
|
|
||||||
|
|
||||||
$(page).trigger('collectionedit');
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue