Compare commits

...

2 Commits
0.0.4 ... 0.0.6

Author SHA1 Message Date
ducoterra
6be7034f9b disable button while submitting 2020-04-24 21:05:19 -04:00
ducoterra
1adaf20f61 major style overhaul 2020-04-24 21:00:29 -04:00
4 changed files with 51 additions and 28 deletions

0
ui/static/ui/button.css Normal file
View File

View File

@@ -19,6 +19,7 @@ var button = document.getElementById("BUTTON");
var count = document.getElementById("COUNT");
button.addEventListener("click", event => {
button.disabled = true;
fetch('/button', {
method: 'POST',
headers: {
@@ -31,6 +32,8 @@ button.addEventListener("click", event => {
})
.then((data) => {
count.innerText = data.pressed;
}).finally(() => {
button.disabled = false;
});
});

24
ui/templates/ui/base.html Normal file
View File

@@ -0,0 +1,24 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Button</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
{% block css %}
{% endblock %}
</head>
<body>
{% csrf_token %}
{% block body %}
{% endblock %}
{% block js %}
{% endblock %}
</body>

View File

@@ -1,25 +1,24 @@
{% extends 'ui/base.html' %}
{% load static %}
<!DOCTYPE html>
<html>
{% block css %}
<link rel="stylesheet" href="{% static 'ui/button.css' %}">
{% endblock %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Bulma!</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.2/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</head>
{% block js %}
<script src="{% static 'ui/button.js' %}"></script>
{% endblock %}
<body>
{% csrf_token %}
{% block body %}
<section class="section">
<div class="container">
<div>
<h1 class="title">
The Button
</h1>
<button class="button" id="BUTTON">Press</button>
<button class="button is-primary" id="BUTTON">Press</button>
</div>
<div><br></div>
<div>
@@ -27,7 +26,4 @@
</div>
</div>
</section>
<script src="{% static 'ui/button.js' %}"></script>
</body>
</html>
{% endblock %}