update paper dialog helper api

This commit is contained in:
Luke Pulverenti 2015-12-08 14:27:09 -05:00
parent df4f347fb4
commit eb59fad11f
14 changed files with 67 additions and 75 deletions

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-fab'], function () { define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-fab'], function (paperDialogHelper) {
function onSubmit() { function onSubmit() {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
@ -39,7 +39,7 @@
var id = result.Id; var id = result.Id;
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
redirectToCollection(id); redirectToCollection(id);
}); });
@ -71,7 +71,7 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
Dashboard.alert(Globalize.translate('MessageItemsAdded')); Dashboard.alert(Globalize.translate('MessageItemsAdded'));
}); });
@ -192,7 +192,7 @@
items = items || []; items = items || [];
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
size: 'small' size: 'small'
}); });
@ -217,11 +217,11 @@
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'collectioneditor'); paperDialogHelper.open(dlg);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
}; };
} }

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-item', 'paper-input', 'paper-fab', 'paper-item-body'], function () { define(['components/paperdialoghelper', 'paper-item', 'paper-input', 'paper-fab', 'paper-item-body'], function (paperDialogHelper) {
var systemInfo; var systemInfo;
function getSystemInfo() { function getSystemInfo() {
@ -213,7 +213,7 @@
getSystemInfo().then(function (systemInfo) { getSystemInfo().then(function (systemInfo) {
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
theme: 'a', theme: 'a',
size: 'medium' size: 'medium'
}); });
@ -242,11 +242,11 @@
}); });
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'directorybrowser'); paperDialogHelper.open(dlg);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
currentDialog = dlg; currentDialog = dlg;
@ -264,7 +264,7 @@
self.close = function () { self.close = function () {
if (currentDialog) { if (currentDialog) {
PaperDialogHelper.close(currentDialog); paperDialogHelper.close(currentDialog);
} }
}; };

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-fab'], function () { define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) {
var currentItemId; var currentItemId;
var currentItemType; var currentItemType;
@ -131,7 +131,7 @@
hasChanges = true; hasChanges = true;
var dlg = $(page).parents('paper-dialog')[0]; var dlg = $(page).parents('paper-dialog')[0];
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
} }
@ -271,7 +271,7 @@
currentItemId = itemId; currentItemId = itemId;
currentItemType = itemType; currentItemType = itemType;
var dlg = PaperDialogHelper.createDialog(); var dlg = paperDialogHelper.createDialog();
var html = ''; var html = '';
html += '<h2 class="dialogHeader">'; html += '<h2 class="dialogHeader">';
@ -289,14 +289,14 @@
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'imagedownloader'); paperDialogHelper.open(dlg);
var editorContent = dlg.querySelector('.editorContent'); var editorContent = dlg.querySelector('.editorContent');
initEditor(editorContent); initEditor(editorContent);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
reloadBrowsableImages(editorContent); reloadBrowsableImages(editorContent);

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'css!css/metadataeditor.css', 'paper-fab'], function () { define(['components/paperdialoghelper', 'css!css/metadataeditor.css', 'paper-fab'], function (paperDialogHelper) {
var currentItem; var currentItem;
var currentDeferred; var currentDeferred;
@ -206,9 +206,9 @@
$('.btnOpenUploadMenu', page).on('click', function () { $('.btnOpenUploadMenu', page).on('click', function () {
require(['components/imageuploader/imageuploader'], function () { require(['components/imageuploader/imageuploader'], function (imageUploader) {
ImageUploader.show(currentItem.Id, { imageUploader.show(currentItem.Id, {
theme: options.theme theme: options.theme
@ -241,7 +241,7 @@
var template = this.response; var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
theme: options.theme theme: options.theme
}); });
@ -263,14 +263,14 @@
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'imageeditor'); paperDialogHelper.open(dlg);
var editorContent = dlg.querySelector('.editorContent'); var editorContent = dlg.querySelector('.editorContent');
reload(editorContent, item); reload(editorContent, item);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
}); });
} }

View File

@ -1,4 +1,4 @@
(function ($, window, document) { define(['components/paperdialoghelper', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) {
var currentItemId; var currentItemId;
var currentFile; var currentFile;
@ -133,7 +133,7 @@
var template = this.response; var template = this.response;
currentItemId = itemId; currentItemId = itemId;
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
theme: options.theme theme: options.theme
}); });
@ -153,14 +153,14 @@
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'imageuploader'); paperDialogHelper.open(dlg);
var editorContent = dlg.querySelector('.editorContent'); var editorContent = dlg.querySelector('.editorContent');
initEditor(editorContent); initEditor(editorContent);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
} }
@ -174,7 +174,7 @@
currentDeferred.resolveWith(null, [hasChanges]); currentDeferred.resolveWith(null, [hasChanges]);
} }
window.ImageUploader = { return {
show: function (itemId, options) { show: function (itemId, options) {
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
@ -182,12 +182,8 @@
currentDeferred = deferred; currentDeferred = deferred;
hasChanges = false; hasChanges = false;
require(['components/paperdialoghelper', 'paper-dialog'], function () { showEditor(itemId, options);
showEditor(itemId, options);
});
return deferred.promise(); return deferred.promise();
} }
}; };
});
})(jQuery, window, document);

View File

@ -1,4 +1,4 @@
(function ($, window, document) { define(['components/paperdialoghelper', 'paper-dialog', 'paper-fab', 'paper-input'], function (paperDialogHelper) {
var currentItem; var currentItem;
var currentDeferred; var currentDeferred;
@ -218,13 +218,13 @@
hasChanges = true; hasChanges = true;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
PaperDialogHelper.close(document.querySelector('.identifyDialog')); paperDialogHelper.close(document.querySelector('.identifyDialog'));
}, function () { }, function () {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
PaperDialogHelper.close(document.querySelector('.identifyDialog')); paperDialogHelper.close(document.querySelector('.identifyDialog'));
}); });
} }
@ -291,7 +291,7 @@
currentItem = item; currentItem = item;
var dlg = PaperDialogHelper.createDialog(); var dlg = paperDialogHelper.createDialog();
var html = ''; var html = '';
html += '<h2 class="dialogHeader">'; html += '<h2 class="dialogHeader">';
@ -309,14 +309,14 @@
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'itemidentifier'); paperDialogHelper.open(dlg);
var editorContent = dlg.querySelector('.editorContent'); var editorContent = dlg.querySelector('.editorContent');
initEditor(editorContent); initEditor(editorContent);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
dlg.classList.add('identifyDialog'); dlg.classList.add('identifyDialog');
@ -344,12 +344,8 @@
currentDeferred = deferred; currentDeferred = deferred;
hasChanges = false; hasChanges = false;
require(['components/paperdialoghelper', 'paper-input'], function () { showEditor(itemId);
showEditor(itemId);
});
return deferred.promise(); return deferred.promise();
} }
}; };
});
})(jQuery, window, document);

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function () { define(['components/paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) {
var currentDeferred; var currentDeferred;
var hasChanges; var hasChanges;
@ -27,7 +27,7 @@
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () { ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () {
hasChanges = true; hasChanges = true;
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}, function () { }, function () {
@ -192,7 +192,7 @@
xhr.onload = function (e) { xhr.onload = function (e) {
var template = this.response; var template = this.response;
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
size: 'small', size: 'small',
theme: 'a', theme: 'a',
@ -221,11 +221,11 @@
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'medialibrarycreator'); paperDialogHelper.open(dlg);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
paths = []; paths = [];

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function () { define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) {
var currentDeferred; var currentDeferred;
var hasChanges; var hasChanges;
@ -146,7 +146,7 @@
xhr.onload = function (e) { xhr.onload = function (e) {
var template = this.response; var template = this.response;
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
size: 'small', size: 'small',
theme: 'a', theme: 'a',
@ -173,11 +173,11 @@
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'medialibraryeditor'); paperDialogHelper.open(dlg);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
refreshLibraryFromServer(editorContent); refreshLibraryFromServer(editorContent);

View File

@ -165,7 +165,7 @@
} }
window.PaperDialogHelper = { window.PaperDialogHelper = {
openWithHash: openWithHash, open: openWithHash,
close: close, close: close,
createDialog: createDialog, createDialog: createDialog,
positionTo: positionTo positionTo: positionTo

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab'], function () { define(['components/paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab'], function (paperDialogHelper) {
var lastPlaylistId = ''; var lastPlaylistId = '';
@ -52,7 +52,7 @@
var id = result.Id; var id = result.Id;
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
redirectToPlaylist(id); redirectToPlaylist(id);
}); });
} }
@ -73,7 +73,7 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
Dashboard.alert(Globalize.translate('MessageAddedToPlaylistSuccess')); Dashboard.alert(Globalize.translate('MessageAddedToPlaylistSuccess'));
}); });
@ -197,7 +197,7 @@
items = items || []; items = items || [];
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
size: 'small' size: 'small'
}); });
@ -222,11 +222,11 @@
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'playlisteditor'); paperDialogHelper.open(dlg);
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
}; };
} }

View File

@ -1,4 +1,4 @@
define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function () { define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) {
var currentItem; var currentItem;
@ -339,7 +339,7 @@
var template = this.response; var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog(); var dlg = paperDialogHelper.createDialog();
var html = ''; var html = '';
html += '<h2 class="dialogHeader">'; html += '<h2 class="dialogHeader">';
@ -359,7 +359,7 @@
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
PaperDialogHelper.openWithHash(dlg, 'subtitleeditor'); paperDialogHelper.open(dlg);
var editorContent = dlg.querySelector('.editorContent'); var editorContent = dlg.querySelector('.editorContent');
reload(editorContent, item); reload(editorContent, item);
@ -371,7 +371,7 @@
$('.btnCloseDialog', dlg).on('click', function () { $('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
}); });
} }

View File

@ -2829,7 +2829,7 @@
showSortMenu: function (options) { showSortMenu: function (options) {
require(['paper-dialog', 'components/paperdialoghelper', 'paper-radio-button', 'paper-radio-group', 'scale-up-animation', 'fade-in-animation', 'fade-out-animation'], function () { require(['components/paperdialoghelper', 'paper-dialog', 'paper-radio-button', 'paper-radio-group', 'scale-up-animation', 'fade-in-animation', 'fade-out-animation'], function (paperDialogHelper) {
var dlg = document.createElement('paper-dialog'); var dlg = document.createElement('paper-dialog');
@ -2906,7 +2906,7 @@
dlg.parentNode.removeChild(dlg); dlg.parentNode.removeChild(dlg);
}); });
PaperDialogHelper.openWithHash(dlg, 'sortmenu'); paperDialogHelper.open(dlg);
$('.groupSortBy', dlg).on('iron-select', function () { $('.groupSortBy', dlg).on('iron-select', function () {

View File

@ -97,9 +97,9 @@
function showPlaybackOverlay(deferred) { function showPlaybackOverlay(deferred) {
require(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function () { require(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) {
var dlg = PaperDialogHelper.createDialog({}); var dlg = paperDialogHelper.createDialog({});
var html = ''; var html = '';
html += '<h2 class="dialogHeader">'; html += '<h2 class="dialogHeader">';
@ -138,10 +138,10 @@
deferred.resolve(); deferred.resolve();
}); });
PaperDialogHelper.openWithHash(dlg, 'premiere'); paperDialogHelper.open(dlg);
$('.btnCancelSupporterInfo').on('click', function () { $('.btnCancelSupporterInfo').on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
}); });
} }

View File

@ -212,7 +212,7 @@
function showSyncMenuInternal(options) { function showSyncMenuInternal(options) {
require(['components/paperdialoghelper', 'paper-fab'], function () { require(['components/paperdialoghelper', 'paper-fab'], function (paperDialogHelper) {
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
@ -230,7 +230,7 @@
currentDialogOptions = dialogOptions; currentDialogOptions = dialogOptions;
var dlg = PaperDialogHelper.createDialog({ var dlg = paperDialogHelper.createDialog({
size: 'small', size: 'small',
theme: 'a' theme: 'a'
}); });
@ -267,7 +267,7 @@
dlg.parentNode.removeChild(dlg); dlg.parentNode.removeChild(dlg);
}); });
PaperDialogHelper.openWithHash(dlg, 'syncjob'); paperDialogHelper.open(dlg);
$('form', dlg).on('submit', function () { $('form', dlg).on('submit', function () {
@ -276,7 +276,7 @@
}); });
$('.btnCancel').on('click', function () { $('.btnCancel').on('click', function () {
PaperDialogHelper.close(dlg); paperDialogHelper.close(dlg);
}); });
renderForm({ renderForm({