diff --git a/dashboard-ui/itembynamedetails.html b/dashboard-ui/itembynamedetails.html index a676f1b9b..c0940bd37 100644 --- a/dashboard-ui/itembynamedetails.html +++ b/dashboard-ui/itembynamedetails.html @@ -141,6 +141,7 @@
+ ${ButtonSync}
@@ -149,9 +150,10 @@
+ ${ButtonSync}

-
+
diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index aa15ae1a8..b846cb2a1 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -82,6 +82,12 @@ $('.btnPlay', page).hide(); } + if (SyncManager.isAvailable(item, user)) { + $('.btnSync', page).removeClass('hide'); + } else { + $('.btnSync', page).addClass('hide'); + } + var editImagesHref = user.Configuration.IsAdministrator ? 'edititemimages.html' + editQuery : null; $('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item, editImagesHref, true)); @@ -389,7 +395,7 @@ SortOrder: "Ascending", IncludeItemTypes: "", Recursive: true, - Fields: "AudioInfo,SeriesInfo,ParentId,PrimaryImageAspectRatio", + Fields: "AudioInfo,SeriesInfo,ParentId,PrimaryImageAspectRatio,SyncInfo", Limit: LibraryBrowser.getDefaultPageSize(), StartIndex: 0, CollapseBoxSetItems: false @@ -536,6 +542,13 @@ }); }); + $('.btnSync', page).on('click', function () { + + SyncManager.showMenu({ + items: [currentItem] + }); + }); + }).on('pageshow', "#itemByNameDetailPage", function () { var page = this; diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index 8e3e85fed..7875c5585 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -252,7 +252,10 @@ closeContextMenu(); SyncManager.showMenu({ - items: [id] + items: [ + { + Id: id + }] }); return false; diff --git a/dashboard-ui/scripts/sync.js b/dashboard-ui/scripts/sync.js index 8aeaefeba..98413f728 100644 --- a/dashboard-ui/scripts/sync.js +++ b/dashboard-ui/scripts/sync.js @@ -40,7 +40,8 @@ Name: $('#txtSyncJobName', form).val(), SyncNewContent: $('#chkSyncNewContent', form).checked(), - UnwatchedOnly: $('#chkUnwatchedOnly', form).checked() + UnwatchedOnly: $('#chkUnwatchedOnly', form).checked(), + ItemLimit: $('#txtItemLimit').val() || null }; ApiClient.ajax({ @@ -62,11 +63,16 @@ var userId = Dashboard.getCurrentUserId(); - ApiClient.getJSON(ApiClient.getUrl('Sync/Targets', { + ApiClient.getJSON(ApiClient.getUrl('Sync/Options', { - UserId: userId + UserId: userId, + ItemIds: options.items.map(function (i) { + return i.Id || i; + }).join(',') - })).done(function (targets) { + })).done(function (result) { + + var targets = result.Targets; var html = '
'; @@ -75,7 +81,7 @@ html += '
'; - if (options.items.length > 1) { + if (result.Options.indexOf('Name') != -1) { html += '

'; html += ''; @@ -119,19 +125,32 @@ //html += '

' + Globalize.translate('HeaderSettings') + '

'; //html += '
'; - html += '
'; - html += '
'; - html += ''; - html += ''; - html += '
' + Globalize.translate('OptionAutomaticallySyncNewContentHelp') + '
'; - html += '
'; + if (result.Options.indexOf('UnwatchedOnly') != -1) { + html += '
'; + html += '
'; + html += ''; + html += ''; + html += '
' + Globalize.translate('OptionSyncUnwatchedVideosOnlyHelp') + '
'; + html += '
'; + } - html += '
'; - html += '
'; - html += ''; - html += ''; - html += '
' + Globalize.translate('OptionSyncUnwatchedVideosOnlyHelp') + '
'; - html += '
'; + if (result.Options.indexOf('SyncNewContent') != -1) { + html += '
'; + html += '
'; + html += ''; + html += ''; + html += '
' + Globalize.translate('OptionAutomaticallySyncNewContentHelp') + '
'; + html += '
'; + } + + if (result.Options.indexOf('ItemLimit') != -1) { + html += '
'; + html += '
'; + html += ''; + html += ''; + html += '
' + Globalize.translate('LabelItemLimitHelp') + '
'; + html += '
'; + } //html += '
'; //html += '
'; @@ -159,6 +178,33 @@ }); } + function showUnwatchedFilter(items) { + + return items.filter(function (i) { + + return i.MediaType == "Video" || i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist"; + + }).length > 0; + } + + function showItemLimit(items) { + + return items.length > 1 || items.filter(function (i) { + + return i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist"; + + }).length > 0; + } + + function showSyncNew(items) { + + return items.filter(function (i) { + + return i.IsFolder || i.Type == "Person" || i.Type == "Genre" || i.Type == "MusicGenre" || i.Type == "GameGenre" || i.Type == "Studio" || i.Type == "MusicArtist"; + + }).length > 0; + } + function isAvailable(item, user) { //return false;