gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-backoffice] branch master updated (554e0a2 -> 40d179


From: gnunet
Subject: [GNUnet-SVN] [taler-backoffice] branch master updated (554e0a2 -> 40d1791)
Date: Mon, 30 Jul 2018 15:19:58 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository backoffice.

    from 554e0a2  Transparent background for the instances list.
     new a32de02  Validate inputs via JS.
     new 40d1791  Enable/disable cherry pick submit button..

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 js/backoffice.js                                   | 73 ++++++++++++++++++++--
 talerbackoffice/backoffice/static/backoffice.css   |  2 +-
 .../backoffice/templates/backoffice.html           | 11 +++-
 3 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/js/backoffice.js b/js/backoffice.js
index 646c33b..13539b4 100644
--- a/js/backoffice.js
+++ b/js/backoffice.js
@@ -480,7 +480,8 @@ function toggle_loader(){
  * whether the user selected "order" ("transfer") on the
  * dedicated form.
  */
-function track_cherry_pick(form){
+function track_cherry_pick(){
+  var form = document.getElementById("choices");
   var types = xpath_get("address@hidden'radio']", form);
   for(var i in [0, 1]){
     if (!types.snapshotItem(i).checked)
@@ -506,10 +507,10 @@ function track_cherry_pick(form){
 function cherry_pick_form_order(form){
   var input_order = xpath_get("address@hidden'order']", form)
     .snapshotItem(0);
-  input_order.style.visibility = "";
+  input_order.style.display = "";
   var input_transfer = xpath_get("address@hidden'transfer']", form);
   for(var i in [0, 1])
-    input_transfer.snapshotItem(i).style.visibility = "hidden";
+    input_transfer.snapshotItem(i).style.display = "none";
 }
 
 /**
@@ -518,10 +519,10 @@ function cherry_pick_form_order(form){
 function cherry_pick_form_transfer(form){
   var input_order = xpath_get("address@hidden'order']", form)
   .snapshotItem(0);
-  input_order.style.visibility = "hidden";
+  input_order.style.display = "none";
   var input_transfer = xpath_get("address@hidden'transfer']", form);
   for(var i in [0, 1])
-    input_transfer.snapshotItem(i).style.visibility = "";
+    input_transfer.snapshotItem(i).style.display = "";
 }
 
 /**
@@ -647,3 +648,65 @@ if (typeof(module) != "undefined"){
   module.exports.track_order = track_order;
   clear_results = ()=>true;
 }
+
+var VALID_TT_INPUTS = 0;
+
+function validate_exchange_url(text_input)
+{
+  var submit_button = document.getElementById
+    ("submit-cherry-pick");
+
+  if (text_input.value.match
+    (/^https:\/\/[a-zA-Z]+\.[a-zA-Z]+\//))
+  {
+    console.log("Good value", text_input.value);
+    VALID_TT_INPUTS |= 2;
+  }
+  else
+  {
+    console.log("Bad value", text_input.value);
+    VALID_TT_INPUTS &= ~2;
+  }
+
+  if (3 == VALID_TT_INPUTS)
+    submit_button.disabled = false;
+  else submit_button.disabled = true;
+}
+
+function validate_wtid(text_input)
+{
+  var submit_button = document.getElementById
+    ("submit-cherry-pick");
+  
+  if (text_input.value.match(/^[A-Za-z0-9]+$/))
+  {
+    console.log("Good value", text_input.value);
+    VALID_TT_INPUTS |= 1;
+  }
+  else
+  {
+    console.log("Bad value", text_input.value);
+    VALID_TT_INPUTS &= ~1;
+  }
+
+  if (3 == VALID_TT_INPUTS)
+    submit_button.disabled = false;
+  else submit_button.disabled = true;
+}
+
+function validate_order_id(text_input)
+{
+  var submit_button = document.getElementById
+    ("submit-cherry-pick");
+  
+  if (text_input.value.match(/^[A-Za-z0-9]+$/))
+  {
+    console.log("Good value", text_input.value);
+    submit_button.disabled = false;
+  }
+  else
+  {
+    console.log("Bad value", text_input.value);
+    submit_button.disabled = true;
+  }
+}
diff --git a/talerbackoffice/backoffice/static/backoffice.css 
b/talerbackoffice/backoffice/static/backoffice.css
index dea999e..3ec6ef0 100644
--- a/talerbackoffice/backoffice/static/backoffice.css
+++ b/talerbackoffice/backoffice/static/backoffice.css
@@ -1,4 +1,4 @@
-#instances {
+#instance {
   border: 1px solid #ccc;
   background: transparent;
 }
diff --git a/talerbackoffice/backoffice/templates/backoffice.html 
b/talerbackoffice/backoffice/templates/backoffice.html
index 3ca3bbf..3e1ef91 100644
--- a/talerbackoffice/backoffice/templates/backoffice.html
+++ b/talerbackoffice/backoffice/templates/backoffice.html
@@ -12,7 +12,7 @@
   <br />
   <div>
     <span style="margin-right: 10px;">Current instance:</span>
-    <select id="instances" onchange="change_instance();">
+    <select id="instance" onchange="change_instance();">
       {% for instance in instances %}
         <option value="{{ instance }}">{{ instance }}</option>  
       {% endfor %}
@@ -33,21 +33,26 @@
              onclick="cherry_pick_form_transfer(this.parentNode)">Track wire 
transfer</input><br>
       <input type="text"
              placeholder="Order ID"
+             onkeyup="validate_order_id(this);"
              class="order"></input><br>
       <input type="text"
              placeholder="WTID"
+             onkeyup="validate_wtid(this);"
              class="transfer"
              style="display: none;"></input><br>
       <input type="text"
              placeholder="Exchange URI"
+             onkeyup="validate_exchange_url(this);"
              class="transfer"
              style="display: none;"></input><br>
     </div>
-    <div id="submit">
+    <div>
       <form action="">
         <input type="button"
+               id="submit-cherry-pick"
+               disabled
                value="submit"
-               onclick='track_cherry_pick(this.parentNode)'>
+               onclick='track_cherry_pick()'>
         </input>
       </form>
     </div>

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]