Procházet zdrojové kódy

Currency code no longer required
Amount can be less than 1.

Lee Morgan před 4 roky
rodič
revize
661baecb65
2 změnil soubory, kde provedl 5 přidání a 6 odebrání
  1. 2 2
      views/currency/new.html
  2. 3 4
      views/main/index.html

+ 2 - 2
views/currency/new.html

@@ -30,11 +30,11 @@
             </label>
 
             <label>Currency Code
-                <input name="currencyCode" type="Text" required>
+                <input name="currencyCode" type="Text">
             </label>
 
             <label>Value
-                <input name="value" type="number" required>
+                <input name="value" type="number" step="0.01" min="0" required>
             </label>
 
             <label>Paper

+ 3 - 4
views/main/index.html

@@ -431,9 +431,10 @@
                         let currency = template.cloneNode(true);
                         let frontImage = currency.querySelector(".frontImage");
                         let backImage = currency.querySelector(".backImage");
+                        let code = currencies[i].currencyCode;
 
                         currency.querySelector(".location").innerText = `${currencies[i].location.toUpperCase()} (${currencies[i].name})`;
-                        currency.querySelector(".info").innerText = `${currencies[i].value} ${currencies[i].currencyCode}`;
+                        currency.querySelector(".info").innerText = `${currencies[i].value} ${code ? code : ""}`;
                         frontImage.src = currencies[i].frontImage;
                         frontImage.onload = ()=>{imageSize(frontImage)};
                         frontImage.onclick = ()=>{displayImage(frontImage.cloneNode(true))};
@@ -472,9 +473,7 @@
                         }
                     }
                 })
-                .catch((err)=>{
-                    console.log(err);
-                });
+                .catch((err)=>{});
         </script>
     </body>
 </html>