You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/07/06 12:39:43 UTC

[whimsy] branch master updated: Add Personal details questions

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 77f50bd  Add Personal details questions
77f50bd is described below

commit 77f50bdab69ce65bd84ffe5506346ca25d0bc63f
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jul 6 13:39:41 2018 +0100

    Add Personal details questions
    
    TODO: validate against proper data
---
 www/project/icla/views/pages/interview.js.rb | 50 +++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 4 deletions(-)

diff --git a/www/project/icla/views/pages/interview.js.rb b/www/project/icla/views/pages/interview.js.rb
index e3c6775..0e7d863 100644
--- a/www/project/icla/views/pages/interview.js.rb
+++ b/www/project/icla/views/pages/interview.js.rb
@@ -1,12 +1,15 @@
 class Interview < Vue
   def initialize
-    @showQuestion1 = true
+    @showQuestion1 = false
     @showQuestion2 = false
     @showQuestion3 = false
 
     @disableButton1 = false
     @disableButton2 = false
     @disableButton3 = false
+
+    @disablePersonalDetails = false
+    @alert = nil    
   end
 
   def render
@@ -30,9 +33,25 @@ class Interview < Vue
       to review and submit the completed form.
     }
 
-    _p %{
-      TODO: verify email address and Public Name
-    }
+    _div.form_group do
+      _p 'Full Name:'
+      _input.form_control.fullname! value: @fullName, required: true,
+        onChange: self.setFullName, disabled: @disablePersonalDetails
+    end
+
+    _div.form_group do
+      _p 'Email Address:'
+      _input.form_control.emailAddress! value: @emailAddress, required: true,
+        onChange: self.setEmailAddress, disabled: @disablePersonalDetails
+    end
+
+    # error messages
+    if @alert
+      _div.alert.alert_danger do
+        _b 'Error: '
+        _span @alert
+      end
+    end
 
     #
     # Question 1
@@ -119,6 +138,29 @@ class Interview < Vue
     end
   end
 
+  def validatePerson
+    if @fullName and @fullName != '' and @emailAddress and @emailAddress != ''
+      if @fullName == FormData.fullname and @emailAddress == FormData.email # TODO proper validation
+        @showQuestion1 = true
+        @disablePersonalDetails = true # no further changes allowed
+        @alert = nil
+      else
+        @alert = 'Cannot validate details'
+      end
+    end
+  end
+
+  def setFullName(event)
+    @fullName = event.target.value
+    validatePerson
+  end
+
+  # enable submit button when name is present
+  def setEmailAddress(event)
+    @emailAddress = event.target.value
+    validatePerson
+  end
+
   def clickButton1()
     @disableButton1 = true 
     @showQuestion2 = true