From ed3d3f17bf479171a1ee72b4092b88c893145294 Mon Sep 17 00:00:00 2001 From: BastiRehm Date: Sun, 1 Mar 2015 17:05:45 +1000 Subject: [PATCH] Added confirm functionality to IonPopup --- components/ionPopup/ionPopup.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/components/ionPopup/ionPopup.js b/components/ionPopup/ionPopup.js index a81ee40..0564e0b 100644 --- a/components/ionPopup/ionPopup.js +++ b/components/ionPopup/ionPopup.js @@ -38,6 +38,25 @@ IonPopup = { }, alert: function (options) { + IonPopup.show({ + title: options.title, + subTitle: options.subtitle, + template: options.template, + templateName: options.templateName, + buttons: [ + { + text: options.okText ? options.okText : 'Ok', + type: options.okType ? options.okType : 'button-positive', + onTap: function(event) { + options.onOk(event); + return true; + } + } + ] + }); + }, + + confirm: function (options) { IonPopup.show({ title: options.title, subTitle: options.subtitle, @@ -48,6 +67,15 @@ IonPopup = { text: options.okText ? options.okText : 'Ok', type: options.okType ? options.okType : 'button-positive', onTap: function() { + if (options.onOk) options.onOk(event); + return true; + } + }, + { + text: options.cancelText ? options.cancelText : 'Cancel', + type: options.cancelType ? options.cancelType : 'button-default', + onTap: function() { + if (options.onCancel) options.onCancel(event); return true; } }