diff --git a/dashboard-ui/components/guestinviter/guestinviter.js b/dashboard-ui/components/guestinviter/guestinviter.js new file mode 100644 index 0000000000..47655d8c5b --- /dev/null +++ b/dashboard-ui/components/guestinviter/guestinviter.js @@ -0,0 +1,150 @@ +define(['paperdialoghelper', 'paper-input', 'paper-button', 'jqmcollapsible'], function (paperDialogHelper) { + + function renderLibrarySharingList(context, result) { + + var folderHtml = ''; + + folderHtml += '
'; + + folderHtml += result.Items.map(function (i) { + + var currentHtml = ''; + + var id = 'chkShareFolder' + i.Id; + + currentHtml += ''; + + var isChecked = true; + var checkedHtml = isChecked ? ' checked="checked"' : ''; + + currentHtml += ''; + + return currentHtml; + + }).join(''); + + folderHtml += '
'; + + $('.librarySharingList', context).html(folderHtml).trigger('create'); + } + + function inviteUser(dlg) { + + Dashboard.showLoadingMsg(); + + ApiClient.getJSON(ApiClient.getUrl("Channels", {})).then(function (channelsResult) { + + var shareExcludes = $(".chkShareFolder:checked", dlg).get().map(function (i) { + + return i.getAttribute('data-folderid'); + }); + + // Add/Update connect info + ApiClient.ajax({ + + type: "POST", + url: ApiClient.getUrl('Connect/Invite'), + dataType: 'json', + data: { + + ConnectUsername: $('#txtConnectUsername', dlg).val(), + EnabledLibraries: shareExcludes.join(','), + SendingUserId: Dashboard.getCurrentUserId(), + EnableLiveTv: false + } + + }).then(function (result) { + + dlg.submitted = true; + paperDialogHelper.close(dlg); + + Dashboard.hideLoadingMsg(); + + showNewUserInviteMessage(dlg, result); + + }); + }); + } + + function showNewUserInviteMessage(page, result) { + + if (!result.IsNewUserInvitation && !result.IsPending) { + + // It was immediately approved + return; + } + + var message = result.IsNewUserInvitation ? + Globalize.translate('MessageInvitationSentToNewUser', result.GuestDisplayName) : + Globalize.translate('MessageInvitationSentToUser', result.GuestDisplayName); + + Dashboard.alert({ + message: message, + title: Globalize.translate('HeaderInvitationSent') + }); + } + + return { + show: function () { + return new Promise(function (resolve, reject) { + + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'components/guestinviter/guestinviter.template.html', true); + + xhr.onload = function (e) { + + var template = this.response; + var dlg = paperDialogHelper.createDialog({ + removeOnClose: true, + size: 'small' + }); + + dlg.classList.add('ui-body-a'); + dlg.classList.add('background-theme-a'); + + dlg.classList.add('formDialog'); + + var html = ''; + + html += Globalize.translateDocument(template); + + dlg.innerHTML = html; + // needed for the collapsible + document.body.appendChild(dlg); + $(dlg).trigger('create'); + + paperDialogHelper.open(dlg); + + dlg.addEventListener('iron-overlay-closed', function () { + + if (dlg.submitted) { + resolve(); + } else { + reject(); + } + }); + + dlg.querySelector('.btnCancel').addEventListener('click', function (e) { + + paperDialogHelper.close(dlg); + }); + + dlg.querySelector('form').addEventListener('submit', function (e) { + + inviteUser(dlg); + + e.preventDefault(); + return false; + }); + + ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })).then(function (result) { + + renderLibrarySharingList(dlg, result); + }); + } + + xhr.send(); + }); + } + }; +}); \ No newline at end of file diff --git a/dashboard-ui/components/guestinviter/guestinviter.template.html b/dashboard-ui/components/guestinviter/guestinviter.template.html new file mode 100644 index 0000000000..9fa4c0200f --- /dev/null +++ b/dashboard-ui/components/guestinviter/guestinviter.template.html @@ -0,0 +1,31 @@ +
+ +
+ ${HeaderInviteUser} +
+
+ +
+ + +
+
${LabelConnectGuestUserNameHelp}
+
${ButtonLearnMoreAboutEmbyConnect}
+
+ +
+ +
+

${HeaderShareMediaFolders}

+
+
+ +
+
+
+

${MessageGuestSharingPermissionsHelp}

+
+ +
\ No newline at end of file diff --git a/dashboard-ui/components/metadataeditor/personeditor.template.html b/dashboard-ui/components/metadataeditor/personeditor.template.html index a730c529c2..c50bdcb9fc 100644 --- a/dashboard-ui/components/metadataeditor/personeditor.template.html +++ b/dashboard-ui/components/metadataeditor/personeditor.template.html @@ -29,10 +29,7 @@
${LabelPersonRoleHelp}

- -

- -

+ \ No newline at end of file diff --git a/dashboard-ui/css/librarymenu.css b/dashboard-ui/css/librarymenu.css index 1c8665fc41..031beca8e8 100644 --- a/dashboard-ui/css/librarymenu.css +++ b/dashboard-ui/css/librarymenu.css @@ -12,7 +12,7 @@ .sidebarDivider { height: 1px; - background: #ddd; + background: #eaeaea; margin: .5em 0; } diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index 2bc3af3e25..d755097e9d 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -1123,7 +1123,7 @@ paper-input + .fieldDescription { } .background-theme-a, paper-dialog.background-theme-a { - background-color: #f7f7f7; + background-color: #f4f4f4; } .ui-page-theme-a .content-secondary { diff --git a/dashboard-ui/dlnaprofile.html b/dashboard-ui/dlnaprofile.html index f9e8278b09..801a5e4945 100644 --- a/dashboard-ui/dlnaprofile.html +++ b/dashboard-ui/dlnaprofile.html @@ -406,7 +406,7 @@ - +