community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1864049 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/primer.js wizard.js
Date Wed, 31 Jul 2019 12:27:53 GMT
Author: humbedooh
Date: Wed Jul 31 12:27:53 2019
New Revision: 1864049

URL: http://svn.apache.org/viewvc?rev=1864049&view=rev
Log:
fix report compilation, bork if sections haven't been filled out

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js?rev=1864049&r1=1864048&r2=1864049&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js Wed Jul 31 12:27:53 2019
@@ -39,9 +39,20 @@ function build_steps(s, start) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
-    if (!start && text && text.value.length > 0 && current_step
< 4) {
+    if (!start && text && text.value.length > 0 && current_step
< 5) {
         report[current_step] = text.value;
     }
+    
+    // Check that ALL fields are filled before preview
+    if (s == 5) {
+        for (var i = 1; i < 5; i++) {
+            let step = step_json[i];
+            if (report[i] == null || report[i].length == 0) {
+                alert("Please fill out the \"%s\" section before you preview the report!".format(step.description));
+                return
+            }
+        }
+    }
     text.innerText = '';
     current_step = s;
     
@@ -104,7 +115,7 @@ function build_steps(s, start) {
 
 function compile_report() {
     let rep = "## Board Report for %s ##\n".format(pdata.pdata[project].name);
-    for (var i = 0; i < 4; i++) {
+    for (var i = 1; i < 5; i++) {
         let step = step_json[i];
         rep += "\n## %s:\n".format(step.description);
         if (report[i] !== null) {

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864049&r1=1864048&r2=1864049&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Jul 31 12:27:53 2019
@@ -1146,9 +1146,20 @@ function build_steps(s, start) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
-    if (!start && text && text.value.length > 0 && current_step
< 4) {
+    if (!start && text && text.value.length > 0 && current_step
< 5) {
         report[current_step] = text.value;
     }
+    
+    // Check that ALL fields are filled before preview
+    if (s == 5) {
+        for (var i = 1; i < 5; i++) {
+            let step = step_json[i];
+            if (report[i] == null || report[i].length == 0) {
+                alert("Please fill out the \"%s\" section before you preview the report!".format(step.description));
+                return
+            }
+        }
+    }
     text.innerText = '';
     current_step = s;
     
@@ -1211,7 +1222,7 @@ function build_steps(s, start) {
 
 function compile_report() {
     let rep = "## Board Report for %s ##\n".format(pdata.pdata[project].name);
-    for (var i = 0; i < 4; i++) {
+    for (var i = 1; i < 5; i++) {
         let step = step_json[i];
         rep += "\n## %s:\n".format(step.description);
         if (report[i] !== null) {



Mime
View raw message