global.p3x.onenote.ng.factory('p3xOnenotePrompt', ($mdDialog) => { return new function () { this.setProxy = () => { const confirm = $mdDialog.prompt() .title(p3x.onenote.lang.label.setProxy) .textContent(p3x.onenote.lang.dialog.setProxy.info) .placeholder(p3x.onenote.lang.dialog.setProxy.placeholder) .ariaLabel(p3x.onenote.lang.dialog.setProxy.placeholder) .initialValue(global.p3x.onenote.data.proxy) //.targetEvent(ev) //.required(true) .cancel(p3x.onenote.lang.button.cancel) .ok(p3x.onenote.lang.button.save) return $mdDialog.show(confirm) } this.goToUrl = () => { const confirm = $mdDialog.prompt() .title(p3x.onenote.lang.label.openUrl) .textContent(p3x.onenote.lang.dialog.openUrl.info) .placeholder(p3x.onenote.lang.dialog.openUrl.placeholder) .ariaLabel(p3x.onenote.lang.dialog.openUrl.placeholder) //.initialValue(global.p3x.onenote.data.proxy) //.targetEvent(ev) //.required(true) .cancel(p3x.onenote.lang.button.cancel) .ok(p3x.onenote.lang.button.go) return $mdDialog.show(confirm) } this.configureLanguge = (opts) => { return $mdDialog.show({ template: `

${p3x.onenote.lang.menu.language.dialog.label}

${p3x.onenote.lang.menu.language.dialog.personal} ${p3x.onenote.lang.menu.language.dialog.corporate} ${p3x.onenote.lang.button.cancel}
`, controller: function ($mdDialog, $scope) { $scope.exit = (answer) => { $mdDialog.hide(answer); } $scope.cancel = $mdDialog.cancel } }); } this.redirect = (opts) => { return $mdDialog.show({ template: `

${p3x.onenote.lang.label.promptRedirectUrlTitle}

${p3x.onenote.lang.dialog.redirect.url({url: opts.url})}
${p3x.onenote.lang.button.cancel} ${p3x.onenote.lang.dialog.redirect.urlExternal} ${p3x.onenote.lang.dialog.redirect.urlInternal}
`, controller: function ($mdDialog, $scope) { $scope.exit = (answer) => { $mdDialog.hide(answer); } $scope.cancel = $mdDialog.cancel } }); } this.bookmarks = (opts) => { let deleteButton = '' let title if (opts.edit === true) { deleteButton = ` ${p3x.onenote.lang.button.delete} ` title = p3x.onenote.lang.bookmarks.edit } else { title = p3x.onenote.lang.bookmarks.add } return $mdDialog.show({ template: `

${title}

${p3x.onenote.lang.validation.required}
${p3x.onenote.lang.validation.required}
${p3x.onenote.lang.validation.url}
${p3x.onenote.lang.button.cancel} ${deleteButton} ${p3x.onenote.lang.button.save}
`, controller: function ($mdDialog, $scope) { $scope.model = { title: undefined, url: undefined, } if (opts.model) { $scope.model = opts.model } $scope.submit = () => { if ($scope.urlForm.$valid) { $mdDialog.hide({ opts: opts, model: $scope.model, }); } } $scope.delete = () => { $mdDialog.hide({ delete: true, opts: opts, model: $scope.model, }); } $scope.exit = (answer) => { $mdDialog.hide(answer); } $scope.cancel = $mdDialog.cancel } }); } } })