From 5f308d38a02ffd063647e4f55cc0c9bb0bf9e3bc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 15 Jul 2015 07:26:47 -0400 Subject: [PATCH] update metadata manager --- dashboard-ui/css/metadataeditor.css | 18 ++- dashboard-ui/edititemmetadata.html | 13 ++- dashboard-ui/scripts/edititemimages.js | 14 +-- dashboard-ui/scripts/edititemmetadata.js | 75 +++++++++++-- dashboard-ui/scripts/editorsidebar.js | 2 +- dashboard-ui/scripts/htmlmediarenderer.js | 5 +- dashboard-ui/scripts/librarymenu.js | 4 +- dashboard-ui/scripts/pluginspage.js | 54 ++++----- dashboard-ui/scripts/site.js | 35 +++--- dashboard-ui/scripts/userprofilespage.js | 105 +++++++++++------- dashboard-ui/themes/ios.css | 2 +- .../thirdparty/paper-button-style.css | 2 +- dashboard-ui/thirdparty/paper-ie10.css | 2 +- dashboard-ui/vulcanize-in.html | 1 + 14 files changed, 216 insertions(+), 116 deletions(-) diff --git a/dashboard-ui/css/metadataeditor.css b/dashboard-ui/css/metadataeditor.css index f64f11a399..108929df2e 100644 --- a/dashboard-ui/css/metadataeditor.css +++ b/dashboard-ui/css/metadataeditor.css @@ -197,20 +197,34 @@ .editorTile { display: inline-block; - margin: 1em 2em 2em 0; + margin: .5em; text-align: center; vertical-align: middle; } .imageEditorTile { width: 256px; - padding-bottom: 0; + background-color: #282828; + padding: 0; +} + +.editorTile h3 { + text-transform: uppercase; + background: #444; + padding: .5em 0; + text-align: center; + margin-top: 0; + color: #ddd; } .editorTile p { margin: .5em 0; } +.editorTileInner { + padding: 1em; +} + .editorTile .ui-field-contain { margin: 0 0 .5em; } diff --git a/dashboard-ui/edititemmetadata.html b/dashboard-ui/edititemmetadata.html index 9ced60eaea..721e9e9691 100644 --- a/dashboard-ui/edititemmetadata.html +++ b/dashboard-ui/edititemmetadata.html @@ -6,7 +6,7 @@
-
+
    @@ -28,7 +28,7 @@
    -
    +
    - ${ButtonRefresh} - ${ButtonIdentify} + ${ButtonRefresh} + ${ButtonIdentify} +
    @@ -425,7 +426,7 @@
    -
    +
    ${ButtonBrowseImages} ${ButtonUpload} @@ -737,6 +738,6 @@
    -
    +
    diff --git a/dashboard-ui/scripts/edititemimages.js b/dashboard-ui/scripts/edititemimages.js index 47a96bcb45..881b6a3035 100644 --- a/dashboard-ui/scripts/edititemimages.js +++ b/dashboard-ui/scripts/edititemimages.js @@ -265,15 +265,15 @@ html += '
    '; + if (image.ImageType !== "Backdrop" && image.ImageType !== "Screenshot") { + html += '

    ' + image.ImageType + '

    '; + } + var height = 150; html += '
    '; - html += '
    '; - - if (image.ImageType !== "Backdrop" && image.ImageType !== "Screenshot") { - html += '

    ' + image.ImageType + '

    '; - } + html += '
    '; html += '

    ' + image.Width + ' X ' + image.Height + '

    '; @@ -294,12 +294,12 @@ } } - html += ''; - if (imageProviders.length) { html += ''; } + html += ''; + html += '

    '; html += '
    '; diff --git a/dashboard-ui/scripts/edititemmetadata.js b/dashboard-ui/scripts/edititemmetadata.js index b4dc52410e..f9e4a21c51 100644 --- a/dashboard-ui/scripts/edititemmetadata.js +++ b/dashboard-ui/scripts/edititemmetadata.js @@ -1375,15 +1375,57 @@ } } + function showMoreMenu(page) { + + Dashboard.getCurrentUser().done(function (user) { + + var moreCommands = LibraryBrowser.getMoreCommands(currentItem, user); + + var menuItems = []; + + menuItems.push({ + name: Globalize.translate('ButtonAdvancedRefresh'), + id: 'refresh', + ironIcon: 'refresh' + }); + + if (moreCommands.indexOf('delete') != -1) { + menuItems.push({ + name: Globalize.translate('ButtonDelete'), + id: 'delete', + ironIcon: 'delete' + }); + } + + require(['actionsheet'], function () { + + ActionSheetElement.show({ + items: menuItems, + callback: function (id) { + + switch (id) { + + case 'refresh': + performAdvancedRefresh(page); + break; + case 'delete': + LibraryBrowser.deleteItem(currentItem.Id); + break; + default: + break; + } + } + }); + + }); + + }); + } + $(document).on('pageinitdepends', "#editItemMetadataPage", function () { var page = this; - $('.btnRefreshAdvanced', this).on('click', function () { - - performAdvancedRefresh(page); - }); - $('.btnSimpleRefresh', this).on('click', function () { performSimpleRefresh(page); @@ -1410,10 +1452,6 @@ } }); - $('#btnDelete', this).on('click', function () { - LibraryBrowser.deleteItem(currentItem.Id); - }); - $('.libraryTree', page).on('itemclicked', function (event, data) { if (data.id != currentItem.Id) { @@ -1458,14 +1496,29 @@ loadTab(page, parseInt(this.selected)); }); + page.querySelector('.btnMore iron-icon').icon = AppInfo.moreIcon; + + $('.btnMore', page).on('click', function () { + showMoreMenu(page); + }); + }).on('pageshowready', "#editItemMetadataPage", function () { var page = this; $(LibraryBrowser).on('itemdeleting', onItemDeleted); - page.querySelector('paper-tabs').selected = parseInt(getParameterByName('tab') || '0'); - page.querySelector('paper-tabs').selected = 0; + var selected = parseInt(getParameterByName('tab') || '0'); + + if (selected) { + + page.querySelector('paper-tabs').selected = 0; + + // Looks like a bug in paper-tabs. It won't set the tab if we try to do it too quickly + setTimeout(function () { + page.querySelectorAll('paper-tab')[selected].click(); + }, 700); + } }).on('pagebeforehide', "#editItemMetadataPage", function () { diff --git a/dashboard-ui/scripts/editorsidebar.js b/dashboard-ui/scripts/editorsidebar.js index 860b596e7b..cba9d6d0c9 100644 --- a/dashboard-ui/scripts/editorsidebar.js +++ b/dashboard-ui/scripts/editorsidebar.js @@ -258,7 +258,7 @@ if (elem) { // commenting out for now because it's causing the whole window to scroll in chrome - //elem.scrollIntoView(); + elem.scrollIntoView(); } } diff --git a/dashboard-ui/scripts/htmlmediarenderer.js b/dashboard-ui/scripts/htmlmediarenderer.js index 8826c579f0..42149a0bf0 100644 --- a/dashboard-ui/scripts/htmlmediarenderer.js +++ b/dashboard-ui/scripts/htmlmediarenderer.js @@ -22,8 +22,9 @@ var duration = this.duration; if (duration) { - if (time >= duration) { - MediaPlayer.nextTrack(); + if (time >= (duration - 1)) { + + onEnded(); return; } } diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index ac9ea8078b..f556d9bb0b 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -732,7 +732,7 @@ var mainDrawerButton = document.querySelector('.mainDrawerButton'); if (mainDrawerButton) { - if (page.getAttribute('data-menubutton') == 'false') { + if (page.getAttribute('data-menubutton') == 'false' && $.browser.mobile) { mainDrawerButton.classList.add('hide'); } else { mainDrawerButton.classList.remove('hide'); @@ -789,7 +789,7 @@ function updateBackButton(page) { - var canGoBack = !page.classList.contains('homePage'); + var canGoBack = !page.classList.contains('homePage') && history.length > 0; var backButton = document.querySelector('.headerBackButton'); diff --git a/dashboard-ui/scripts/pluginspage.js b/dashboard-ui/scripts/pluginspage.js index 3dbc40906f..b928ab7d65 100644 --- a/dashboard-ui/scripts/pluginspage.js +++ b/dashboard-ui/scripts/pluginspage.js @@ -167,39 +167,43 @@ var name = card.attr('data-name'); var configHref = $('.cardContent', card).attr('href'); - $('.cardMenu', page).popup("close").remove(); - - var html = '
    '; - - html += ''; - - html += '
    '; - - $(page).append(html); - - var flyout = $('.cardMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () { - - $(this).off("popupafterclose").remove(); - + menuItems.push({ + name: Globalize.translate('ButtonUninstall'), + id: 'delete', + ironIcon: 'delete' }); - $('.btnDeletePlugin', flyout).on('click', function () { + require(['actionsheet'], function () { - $('.cardMenu', page).popup('close'); + ActionSheetElement.show({ + items: menuItems, + positionTo: card, + callback: function (resultId) { + + switch (resultId) { + + case 'open': + Dashboard.navigate(configHref); + break; + case 'delete': + deletePlugin(page, id, name); + break; + default: + break; + } + } + }); - // jqm won't show a popup while another is in the act of closing - setTimeout(function () { - deletePlugin(page, id, name); - }, 300); }); } diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 61c5cb1e3f..72f1156961 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -67,7 +67,7 @@ var Dashboard = { // These are not needed. Nulling them out can help reduce dom querying when pages are loaded $.mobile.nojs = null; $.mobile.degradeInputsWithin = null; - $.mobile.keepNative = ":jqmData(role='none')"; + $.mobile.keepNative = ":jqmData(role='none'),.paper-input"; }, isConnectMode: function () { @@ -464,22 +464,22 @@ var Dashboard = { showLoadingMsg: function () { + console.log('showLoadingMsg'); + require(['paperbuttonstyle'], function () { - var elem = document.getElementById('docspinner'); + var elem = document.querySelector('.docspinner'); if (elem) { // This is just an attempt to prevent the fade-in animation from running repeating and causing flickering - if (!elem.active) { - elem.active = true; - } + elem.active = true; } else { + elem = document.createElement("paper-spinner"); - elem.id = 'docspinner'; + elem.classList.add('docspinner'); document.body.appendChild(elem); - elem.active = true; } }); @@ -487,14 +487,21 @@ var Dashboard = { hideLoadingMsg: function () { - var elem = document.getElementById('docspinner'); + console.log('hideLoadingMsg'); - if (elem) { + require(['paperbuttonstyle'], function () { + + var elem = document.querySelector('.docspinner'); + + if (elem) { - setTimeout(function () { elem.active = false; - }, 100); - } + + setTimeout(function () { + elem.active = false; + }, 100); + } + }); }, getModalLoadingMsg: function () { @@ -2023,7 +2030,7 @@ var AppInfo = {}; var drawer = document.querySelector('.mainDrawerPanel'); drawer.classList.remove('mainDrawerPanelPreInit'); drawer.forceNarrow = true; - drawer.drawerWidth = screen.availWidth >= 330 ? "310px" : "270px"; + drawer.drawerWidth = screen.availWidth >= 350 ? "310px" : screen.availWidth >= 310 ? "290px" : "270px"; if ($.browser.safari && !AppInfo.isNativeApp) { drawer.disableEdgeSwipe = true; @@ -2128,7 +2135,7 @@ $(document).on('pagecreate', ".page", function () { current = newTheme; } - if (current == 'b' && !$.browser.mobile) { + if (current != 'a' && !$.browser.mobile) { document.body.classList.add('darkScrollbars'); } else { document.body.classList.remove('darkScrollbars'); diff --git a/dashboard-ui/scripts/userprofilespage.js b/dashboard-ui/scripts/userprofilespage.js index 72b32243d4..7cd00ec05f 100644 --- a/dashboard-ui/scripts/userprofilespage.js +++ b/dashboard-ui/scripts/userprofilespage.js @@ -30,61 +30,80 @@ function deleteUser(page, id) { - $('.userMenu', page).on("popupafterclose.deleteuser", function () { + var msg = Globalize.translate('DeleteUserConfirmation'); - $(this).off('popupafterclose.deleteuser'); + Dashboard.confirm(msg, Globalize.translate('DeleteUser'), function (result) { - var msg = Globalize.translate('DeleteUserConfirmation'); + if (result) { + Dashboard.showLoadingMsg(); - Dashboard.confirm(msg, Globalize.translate('DeleteUser'), function (result) { + ApiClient.deleteUser(id).done(function () { - if (result) { - Dashboard.showLoadingMsg(); - - ApiClient.deleteUser(id).done(function () { - - loadData(page); - }); - } - }); - - }).popup('close'); + loadData(page); + }); + } + }); } function showUserMenu(elem) { - var card = $(elem).parents('.card'); - var page = $(elem).parents('.page'); - var userId = card.attr('data-userid'); + var card = $(elem).parents('.card')[0]; + var page = $(card).parents('.page')[0]; + var userId = card.getAttribute('data-userid'); - $('.userMenu', page).popup("close").remove(); - - var html = '
    '; - - html += ''; - - html += '
    '; - - page.append(html); - - var flyout = $('.userMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () { - - $(this).off("popupafterclose").remove(); + var menuItems = []; + menuItems.push({ + name: Globalize.translate('ButtonOpen'), + id: 'open', + ironIcon: 'mode-edit' }); - $('.btnDeleteUser', flyout).on('click', function () { - deleteUser(page, this.getAttribute('data-userid')); + menuItems.push({ + name: Globalize.translate('ButtonLibraryAccess'), + id: 'access', + ironIcon: 'lock' + }); + + menuItems.push({ + name: Globalize.translate('ButtonParentalControl'), + id: 'parentalcontrol', + ironIcon: 'person' + }); + + menuItems.push({ + name: Globalize.translate('ButtonDelete'), + id: 'delete', + ironIcon: 'delete' + }); + + require(['actionsheet'], function () { + + ActionSheetElement.show({ + items: menuItems, + positionTo: card, + callback: function (id) { + + switch (id) { + + case 'open': + Dashboard.navigate('useredit.html?userid=' + userId); + break; + case 'access': + Dashboard.navigate('userlibraryaccess.html?userid=' + userId); + break; + case 'parentalcontrol': + Dashboard.navigate('userparentalcontrol.html?userid=' + userId); + break; + case 'delete': + deleteUser(page, userId); + break; + default: + break; + } + } + }); + }); } diff --git a/dashboard-ui/themes/ios.css b/dashboard-ui/themes/ios.css index 7d1ba83eee..8d24167d7b 100644 --- a/dashboard-ui/themes/ios.css +++ b/dashboard-ui/themes/ios.css @@ -59,7 +59,7 @@ html, body, .ui-btn, .pageTitle { } .libraryViewNav .ui-btn-active, .libraryViewNav .iron-selected, .barsMenuButton .fa, .btnActiveCast, .libraryViewNav a:not(.ui-btn-active):hover { - color: #EA3150 !important; + color: #E91E63 !important; } .libraryViewNav { diff --git a/dashboard-ui/thirdparty/paper-button-style.css b/dashboard-ui/thirdparty/paper-button-style.css index c33bf826ec..f581af89dc 100644 --- a/dashboard-ui/thirdparty/paper-button-style.css +++ b/dashboard-ui/thirdparty/paper-button-style.css @@ -188,7 +188,7 @@ paper-button.notext { margin-right: 0; } -#docspinner { +.docspinner { display: block; margin-top: -14px; margin-left: -14px; diff --git a/dashboard-ui/thirdparty/paper-ie10.css b/dashboard-ui/thirdparty/paper-ie10.css index 792ab976a5..a733f20ae5 100644 --- a/dashboard-ui/thirdparty/paper-ie10.css +++ b/dashboard-ui/thirdparty/paper-ie10.css @@ -1,4 +1,4 @@ -#docspinner { +.docspinner { /* It often doesn't disappear so just forget it */ display: none !important; } diff --git a/dashboard-ui/vulcanize-in.html b/dashboard-ui/vulcanize-in.html index 6940ec073a..cb6a84b054 100644 --- a/dashboard-ui/vulcanize-in.html +++ b/dashboard-ui/vulcanize-in.html @@ -17,4 +17,5 @@ + \ No newline at end of file