diff --git a/admin/balance.template.html b/admin/balance.template.html index 94d733d0738f78a63b37d3c4cd6a8970d528cb13..81b4d4678cff3d9fe72fe6fbf2286eac80220abd 100644 --- a/admin/balance.template.html +++ b/admin/balance.template.html @@ -7,7 +7,7 @@ <div class="container"> <div class="text-center form justify-content-center"> <h2 class="my-3">{{ .From}}-tól {{ .To }}-ig</h2> - <div style="overflow-x: auto;"> + <div class="overflow-x-auto"> <table class="table" id="admin-table"> <tr> <th scope="col">Termék neve</th> @@ -18,8 +18,8 @@ {{ $prod := .Products }} {{ range $k, $v := .Counts }} {{ $p := index $prod $k }} - <tr style="text-align: center"> - <td style="text-align: left">{{ $p.Name }}</td> + <tr class="text-center"> + <td class="text-left">{{ $p.Name }}</td> <td>{{ $p.Price }} JMF</td> <td>{{$v}} db</td> <td>{{mul $v $p.Price}} JMF</td> diff --git a/admin/between.template.html b/admin/between.template.html index 29377471f66c1e05acccc1d49fc3bf1ca0718761..b5b1e41232afb487a29c69400c2402466ec7e1ea 100644 --- a/admin/between.template.html +++ b/admin/between.template.html @@ -16,11 +16,5 @@ </form> </div> -<script> - let today = new Date(); - let tomorrow = new Date(); - tomorrow.setDate(today.getDate() + 1); - document.getElementById("balanceFromDate").valueAsDate = today; - document.getElementById("balanceToDate").valueAsDate = tomorrow; -</script> +<script src="/static/js/admin-between.js"></script> {{ end }} \ No newline at end of file diff --git a/error/error.template.html b/error/error.template.html index 597e4537929ec26cfbf0f4edfa2c41082fe93c6e..cbccc405530f625d16e7c0f0ec34885b30b17505 100644 --- a/error/error.template.html +++ b/error/error.template.html @@ -3,7 +3,7 @@ {{ template "navbar" . }} <div class="history-container"> - <div class="alert alert-danger" role="alert" style="margin: 1em"> + <div class="alert alert-danger margin-1em" role="alert"> {{ .Error }} </div> </div> diff --git a/homepage/card.template.html b/homepage/card.template.html index b10219dec5a1b56bf816ead218b019a1c2a3a7ab..9d3c3d26ee5a2144b6206d81600502a2e4f98afb 100644 --- a/homepage/card.template.html +++ b/homepage/card.template.html @@ -1,6 +1,6 @@ {{ define "card" }} <div class="card bg-secondary"> - <div class="myrow" style="padding: 1em"> + <div class="myrow padding-1em"> <div class="myrow"> <img class="icon" src="{{ .Product.IconURI }}"> <div class="mycloumn leftie"> @@ -11,7 +11,7 @@ <div class="mycloumn rightie"> <div class="myrow bold">{{ .Money }} JMF</div> - <div class="myrow" style="text-align: right">{{ .Date.Format "2006 Jan 2 Mon 15:04:05" }}</div> + <div class="myrow text-right">{{ .Date.Format "2006 Jan 2 Mon 15:04:05" }}</div> </div> </div> </div> diff --git a/homepage/footer.template.html b/homepage/footer.template.html index 0be9f62a36691f5755e04e3a9f8cbfab32811608..0e3379444aa15fdfd2c1a77861bc7d8321f0b484 100644 --- a/homepage/footer.template.html +++ b/homepage/footer.template.html @@ -1,7 +1,7 @@ {{ define "footer" }} - <script src="/static/js/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> - <script src="/static/js/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> - <script src="/static/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script> + <script src="/static/js/jquery-3.5.1.slim.min.js"></script> + <script src="/static/js/popper.min.js"></script> + <script src="/static/js/bootstrap.min.js"></script> </body> </html> {{ end }} \ No newline at end of file diff --git a/homepage/header.template.html b/homepage/header.template.html index 7cee1301bbec2842c831c44e19a61c877855b0b8..1cb50c0d996d033cc791825096a0326a0e4ccc42 100644 --- a/homepage/header.template.html +++ b/homepage/header.template.html @@ -12,12 +12,12 @@ <link rel="manifest" href="/static/site.webmanifest"> - <link rel="stylesheet" href="/static/js/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> + <link rel="stylesheet" href="/static/js/bootstrap.min.css"> <link rel="stylesheet" href="/static/style.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -{{/* <meta http-equiv="Content-Security-Policy" content="default-src: 'none'; script-src 'self'">*/}} + <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:"> <title>BecskasszáSCH</title> diff --git a/homepage/navbar.template.html b/homepage/navbar.template.html index d9d1bb1b9e37df0d5486028589677e3086e4c703..0e436dfae6f7e80f1be83b97fb14dbca728ab7e3 100644 --- a/homepage/navbar.template.html +++ b/homepage/navbar.template.html @@ -29,29 +29,7 @@ {{- end }} <li class="nav-item"> <a class="nav-link" id="theme"><img src="{{ if .Dark }}/static/images/moon.png{{ else }}/static/images/sun.png{{ end }}" class="icon_small" id="icon"></a> - <script> - let theme = document.getElementById('theme'); - let icon = document.getElementById('icon'); - let body = document.body; - theme.onclick = () => { - let url = "/theme/" - if (body.classList.contains('light')) { - body.classList.remove('light'); - body.classList.add('dark'); - url += "dark" - icon.src="/static/images/moon.png" - } else { - body.classList.remove('dark'); - body.classList.add('light'); - url += "light" - icon.src="/static/images/sun.png" - //window.alert("Nesze Robotka!") - } - const req = new XMLHttpRequest(); - req.open('GET', url); - req.send(); - } - </script> + <script src="/static/js/theme.js"></script> </li> diff --git a/homepage/new.template.html b/homepage/new.template.html index 16176b26c4e652cb00362b44bbbfaa12dd330373..0cab38234b768957df7a9d76ec769dd0e61c2cd3 100644 --- a/homepage/new.template.html +++ b/homepage/new.template.html @@ -4,21 +4,21 @@ <div class="history-container"> {{ if .Error }} - <div class="alert alert-danger" role="alert" style="margin: 1em"> + <div class="alert alert-danger margin-1em" role="alert"> {{ .Error }} </div> {{ end }} {{ if .Product }} {{ if .Product.Name }} - <div class="container" style="padding: 1em"> + <div class="container padding-1em"> <form method="post"> <div class="form-group"> <label for="amount">Mennyi {{ .Product.Name }}t szeretnél venni?</label><br> - <button type="button" class="btn bg-kszk text-white" onclick="set(1)">1</button> - <button type="button" class="btn bg-kszk text-white" onclick="set(2)">2</button> - <button type="button" class="btn bg-kszk text-white" onclick="set(3)">3</button> - <button type="button" class="btn bg-kszk text-white" onclick="set(4)">4</button> - <button type="button" class="btn bg-kszk text-white" onclick="set(5)">5</button><br><br> + <button type="button" class="btn bg-kszk text-white" id="amount-1">1</button> + <button type="button" class="btn bg-kszk text-white" id="amount-2">2</button> + <button type="button" class="btn bg-kszk text-white" id="amount-3">3</button> + <button type="button" class="btn bg-kszk text-white" id="amount-4">4</button> + <button type="button" class="btn bg-kszk text-white" id="amount-5">5</button><br><br> <input name="amount" id="amount" type="number" class="form-control" value="1"> Ár: {{ .Product.Price}} JMF / db </div> @@ -30,11 +30,7 @@ </form> </div> - <script> - function set(value) { - document.getElementById("amount").value = value; - } - </script> + <script src="/static/js/new-set.js"></script> {{ end }} {{ end }} </div> diff --git a/homepage/product.template.html b/homepage/product.template.html index 9b1a457325490d6b1248071476ba6645c3a65215..ab43a833fadeb482870a27461c82e0c94ce9cbf5 100644 --- a/homepage/product.template.html +++ b/homepage/product.template.html @@ -1,7 +1,7 @@ {{ define "product" }} <a href="/new/{{ .ID }}"> <div class="card bg-secondary text-white"> - <div class="myrow" style="padding: 1em"> + <div class="myrow padding-1em"> <div class="myrow"> <img class="icon" src="{{ .IconURI }}"> <div class="mycloumn leftie"> diff --git a/static/js/admin-between.js b/static/js/admin-between.js new file mode 100644 index 0000000000000000000000000000000000000000..d2811bc572757f4680435f9e02eebc6c3fe63086 --- /dev/null +++ b/static/js/admin-between.js @@ -0,0 +1,5 @@ +let today = new Date(); +let tomorrow = new Date(); +tomorrow.setDate(today.getDate() + 1); +document.getElementById("balanceFromDate").valueAsDate = today; +document.getElementById("balanceToDate").valueAsDate = tomorrow; diff --git a/static/js/new-set.js b/static/js/new-set.js new file mode 100644 index 0000000000000000000000000000000000000000..9096e4522ffb959a5d7d295a5b5f59dede83bdd5 --- /dev/null +++ b/static/js/new-set.js @@ -0,0 +1,13 @@ +function setupButton(elem, amount) { + elem.addEventListener('click', (event) => { + document.getElementById("amount").value = amount; + event.preventDefault(); + return false; + }); +} + +setupButton(document.getElementById('amount-1'), 1); +setupButton(document.getElementById('amount-2'), 2); +setupButton(document.getElementById('amount-3'), 3); +setupButton(document.getElementById('amount-4'), 4); +setupButton(document.getElementById('amount-5'), 5); diff --git a/static/js/theme.js b/static/js/theme.js new file mode 100644 index 0000000000000000000000000000000000000000..f32d86b925069875b6ed21bbd5dff8949f400714 --- /dev/null +++ b/static/js/theme.js @@ -0,0 +1,18 @@ +let theme = document.getElementById('theme'); +let icon = document.getElementById('icon'); +let body = document.body; +theme.onclick = () => { + let url = "/theme/" + if (body.classList.contains('light')) { + body.classList.remove('light'); + body.classList.add('dark'); + url += "dark" + icon.src="/static/images/moon.png" + } else { + body.classList.remove('dark'); + body.classList.add('light'); + url += "light" + icon.src="/static/images/sun.png" + //window.alert("Nesze Robotka!") + } +} \ No newline at end of file diff --git a/static/style.css b/static/style.css index 568a6e2b4d8933f8e0d50e1804d8ef46f59097f0..f9bfff080d84c9099a058d45ae697950809eaa19 100644 --- a/static/style.css +++ b/static/style.css @@ -64,6 +64,22 @@ body { margin: auto; } +.topup-form { + margin-top: 1em; +} + +.margin-1em { + margin: 1em; +} + +.padding-1em { + padding: 1em; +} + +.overflow-x-auto { + overflow-x: auto; +} + .bg-kszk { background-color: #3051bf; } diff --git a/topup/topup.template.html b/topup/topup.template.html index 6d2218724f28882ef6e8746514391f2f51066a49..b5adb6bb4cfa34894293e936c81d6062187471e2 100644 --- a/topup/topup.template.html +++ b/topup/topup.template.html @@ -2,18 +2,6 @@ {{ template "navbar" . }} -<style> - form { - margin-top: 1em; - } - .center { - display: block; - margin-left: auto; - margin-right: auto; - width: auto; - } -</style> - <div class="history-container" id="ct-btn"> <section id="cover" class="min-vh-100"> <div id="cover-caption"> @@ -25,7 +13,7 @@ <option value="{{ .SchAcc }}">{{ .SchAcc }} - {{ .Name }}</option> {{- end }} </select> - <form action="/topup/" method="POST" id="topup" class="justify-content-center"> + <form action="/topup/" method="POST" id="topup" class="justify-content-center topup-form"> <div class="form-group"> <label for="money">Mennyit tölt fel?</label><br> <input type="number" id="money" name="money"><br>