Merge pull request #1596 from shackbarth/22996-signature-capture
authorLinda Nichols <lynnaloo@gmail.com>
Mon, 23 Jun 2014 17:16:48 +0000 (13:16 -0400)
committerLinda Nichols <lynnaloo@gmail.com>
Mon, 23 Jun 2014 17:16:48 +0000 (13:16 -0400)
issue #22996: support for signature capture

lib/backbone-x/source/model_mixin.js
lib/enyo-x/source/views/module_container.js
lib/enyo-x/source/widgets/address.js
lib/enyo-x/source/widgets/file_input.js

index 8b54e4b..42ff347 100644 (file)
     QUESTION:  3,
 
     /**
-      Constant for `notify` message type question.
+      Constant for `notify` message type question with cancel option.
 
       @static
       @constant
     */
     YES_NO_CANCEL:  4,
 
+    /**
+      Constant for `notify` message type ok/cancel.
+
+      @static
+      @constant
+      @type Number
+      @default 5
+    */
+    OK_CANCEL:  5,
+
     _status: {
       CLEAN:            0x0001, // 1
       DIRTY:            0x0002, // 2
index 78b91e1..dff7f03 100644 (file)
@@ -241,6 +241,7 @@ trailing:true, white:true*/
       typeToButtonMap[String(XM.Model.WARNING)] = ["notifyOk"];
       typeToButtonMap[String(XM.Model.CRITICAL)] = ["notifyOk"];
       typeToButtonMap[String(XM.Model.QUESTION)] = ["notifyYes", "notifyNo"];
+      typeToButtonMap[String(XM.Model.OK_CANCEL)] = ["notifyOk", "notifyCancel"];
       typeToButtonMap[String(XM.Model.YES_NO_CANCEL)] = ["notifyYes", "notifyNo", "notifyCancel"];
 
       this.$.notifyMessage.setContent(inEvent.message);
@@ -280,7 +281,7 @@ trailing:true, white:true*/
       // delete out any previously added customComponents/customComponentControls
       if (this.$.notifyPopup.$.customComponent) {
         this.$.notifyPopup.removeComponent(this.$.notifyPopup.$.customComponent);
-        
+
         customComponentControls = _.filter(that.$.notifyPopup.controls, function (control) {
           return control.name === "customComponent";
         });
@@ -369,6 +370,7 @@ trailing:true, white:true*/
     notifyTap: function (inSender, inEvent) {
       var notifyParameter,
         callbackObj = {},
+        that = this,
         optionsObj = this._notifyOptions || {};
 
       this._notifyDone = true;
@@ -384,13 +386,20 @@ trailing:true, white:true*/
           notifyParameter = false;
           break;
         case 'notifyCancel':
-          notifyParameter = undefined;
+          notifyParameter = null;
           break;
         }
         // the callback might make its own popup, which we do not want to hide.
         this.$.notifyPopup.hide();
         callbackObj.answer = notifyParameter;
         if (this.$.notifyPopup.$.customComponent) {
+          if (this.$.notifyPopup.$.customComponent.getValueAsync) {
+            this.$.notifyPopup.$.customComponent.getValueAsync(function (result) {
+              callbackObj.componentValue = result;
+              that._notifyCallback(callbackObj, optionsObj);
+            });
+            return;
+          }
           callbackObj.componentValue = this.$.notifyPopup.$.customComponent.getValue();
         }
         this._notifyCallback(callbackObj, optionsObj);
index 223543e..ff93d20 100644 (file)
@@ -310,7 +310,7 @@ regexp:true, undef:true, trailing:true, white:true, strict:false */
                     model.save(null, options);
 
                   } else {
-                    // answer === undefined means that the user wants to cancel this action
+                    // answer === null means that the user wants to cancel this action
                     // fetching is a good way to throw out the changes
                     model.fetch({success: function () {
                       // tell the view to re-render
index 4d400b6..a67f0e2 100644 (file)
@@ -61,6 +61,10 @@ regexp:true, undef:true, trailing:true, white:true */
         filename = inEvent.value,
         reader;
 
+      if (!file) {
+        return;
+      }
+
       if (filename.indexOf("C:\\fakepath\\") === 0) {
         // some browsers obnoxiously give you a fake path, but the only thing
         // we want is the filename really.