From 2d1b2e03dbdb2b3d5933fd428cfb3c944e632e6f Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 16:23:22 -0800 Subject: [PATCH 1/6] .prompt() now supports defaultText options; see https://github.com/driftyco/ionic/issues/1589 --- js/angular/service/popup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index d97b18afb64..b9fd71bd0f1 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -253,6 +253,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB * template: '', // String (optional). The html template to place in the popup body. * templateUrl: '', // String (optional). The URL of an html template to place in the popup body. * inputType: // String (default: 'text'). The type of input to use + * defaultText: // String (default: ''). The initial value placed into the input. * inputPlaceholder: // String (default: ''). A placeholder to use for the input. * cancelText: // String (default: 'Cancel'. The text of the Cancel button. * cancelType: // String (default: 'button-default'). The type of the Cancel button. @@ -464,6 +465,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB function showPrompt(opts) { var scope = $rootScope.$new(true); scope.data = {}; + scope.data.response = opts.defaultText ? opts.defaultText : ''; var text = ''; if (opts.template && /<[a-z][\s\S]*>/i.test(opts.template) === false) { text = '' + opts.template + ''; From a942153a7d28546a4314b382c98deb820e8228e3 Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 16:31:09 -0800 Subject: [PATCH 2/6] .prompt() now supports maxLength option. https://github.com/driftyco/ionic/issues/4704 --- js/angular/service/popup.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index b9fd71bd0f1..b72a6a73da2 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -251,9 +251,10 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB * cssClass: '', // String, The custom CSS class name * subTitle: '', // String (optional). The sub-title of the popup. * template: '', // String (optional). The html template to place in the popup body. - * templateUrl: '', // String (optional). The URL of an html template to place in the popup body. + * templateUrl: '', // String (optional). The URL of an html template to place in the popup body. * inputType: // String (default: 'text'). The type of input to use * defaultText: // String (default: ''). The initial value placed into the input. + * maxLength: // Integer (default: null). Specify a maxlength attribute for the input. * inputPlaceholder: // String (default: ''). A placeholder to use for the input. * cancelText: // String (default: 'Cancel'. The text of the Cancel button. * cancelType: // String (default: 'button-default'). The type of the Cancel button. @@ -472,8 +473,11 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB delete opts.template; } return showPopup(extend({ - template: text + '', + template: text + '', scope: scope, buttons: [{ text: opts.cancelText || 'Cancel', From a98d8d57c3b6c03954cc38055f5e18f139af31a4 Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 16:41:34 -0800 Subject: [PATCH 3/6] patch to fix space-infix-ops error in tests --- js/angular/service/popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index b72a6a73da2..7e1f6517cb1 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -475,7 +475,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB return showPopup(extend({ template: text + '', scope: scope, From 56e9706c2fc8af41ac8115d1a9caee410795160b Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 17:16:24 -0800 Subject: [PATCH 4/6] fix for inputPlaceholder quotes per https://github.com/driftyco/ionic/issues/4707 --- js/angular/service/popup.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 7e1f6517cb1..462c321978f 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -466,7 +466,9 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB function showPrompt(opts) { var scope = $rootScope.$new(true); scope.data = {}; - scope.data.response = opts.defaultText ? opts.defaultText : ''; + scope.data.response = opts.defaultText ? opts.defaultText : ''; + scope.data.placeholder = opts.inputPlaceholder ? opts.inputPlaceholder : ''; + scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : ''; var text = ''; if (opts.template && /<[a-z][\s\S]*>/i.test(opts.template) === false) { text = '' + opts.template + ''; @@ -475,8 +477,8 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB return showPopup(extend({ template: text + '', scope: scope, buttons: [{ From d3fad60d4aaddfe337afd8a9c337a8898181962e Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 17:20:20 -0800 Subject: [PATCH 5/6] cleanup of inputType to use consistent template substitution instead of raw string interpolation; see https://github.com/driftyco/ionic/issues/4707 --- js/angular/service/popup.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 462c321978f..25afc770b6d 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -466,6 +466,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB function showPrompt(opts) { var scope = $rootScope.$new(true); scope.data = {}; + scope.data.fieldtype = opts.inputType ? opts.inputType : 'text'; scope.data.response = opts.defaultText ? opts.defaultText : ''; scope.data.placeholder = opts.inputPlaceholder ? opts.inputPlaceholder : ''; scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : ''; @@ -476,7 +477,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB } return showPopup(extend({ template: text + '', From afd0efe0f19966364d6db6ffd04208aeb860db25 Mon Sep 17 00:00:00 2001 From: Greg Allensworth Date: Thu, 3 Dec 2015 17:23:39 -0800 Subject: [PATCH 6/6] cleanup of extra whitespace which caused no-multi-spaces errors in circleci --- js/angular/service/popup.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 25afc770b6d..1cbeb70b0b8 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -466,10 +466,10 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB function showPrompt(opts) { var scope = $rootScope.$new(true); scope.data = {}; - scope.data.fieldtype = opts.inputType ? opts.inputType : 'text'; - scope.data.response = opts.defaultText ? opts.defaultText : ''; + scope.data.fieldtype = opts.inputType ? opts.inputType : 'text'; + scope.data.response = opts.defaultText ? opts.defaultText : ''; scope.data.placeholder = opts.inputPlaceholder ? opts.inputPlaceholder : ''; - scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : ''; + scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : ''; var text = ''; if (opts.template && /<[a-z][\s\S]*>/i.test(opts.template) === false) { text = '' + opts.template + '';