define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./../icons/nav.html', 'css!./../prompt/style.css', 'paper-button', 'paper-icon-button-light', 'paper-input'], function (dialogHelper, layoutManager, dialogText) { function getIcon(icon, cssClass, canFocus, autoFocus) { var tabIndex = canFocus ? '' : ' tabindex="-1"'; autoFocus = autoFocus ? ' autofocus' : ''; return ''; } return function (options) { if (typeof options === 'string') { options = { title: '', text: options }; } var dialogOptions = { removeOnClose: true }; var backButton = false; var raisedButtons = false; var isFullscreen = false; if (layoutManager.tv) { dialogOptions.size = 'fullscreen'; backButton = true; raisedButtons = true; isFullscreen = true; } else { dialogOptions.modal = false; dialogOptions.entryAnimationDuration = 160; dialogOptions.exitAnimationDuration = 200; } var dlg = dialogHelper.createDialog(dialogOptions); dlg.classList.add('promptDialog'); var html = ''; html += '
'; if (backButton) { html += getIcon('dialog:arrow-back', 'btnPromptExit', false); } if (options.title) { html += '

'; html += options.title; html += '

'; } else if (!isFullscreen) { // Add a little space so it's not hugging the border html += '
'; } var text = options.html || options.text; if (text) { if (options.title) { html += '

'; } else { html += '

'; } html += text; html += '

'; } var buttonText = options.type == 'error' ? 'Ok' : 'GotIt'; if (raisedButtons) { html += '' + dialogText.get(buttonText) + ''; } else { html += '
'; html += '' + dialogText.get(buttonText) + ''; html += '
'; } html += '
'; dlg.innerHTML = html; document.body.appendChild(dlg); dlg.querySelector('.btnSubmit').addEventListener('click', function (e) { dialogHelper.close(dlg); }); return dialogHelper.open(dlg); }; });