| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- {{ define "index" }}
- <!DOCTYPE html>
- <html lang="ru">
- <head>
- <title>WarTank</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link href="/static/bootstrap5/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
- <script src="/static/bootstrap5/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.11.0/brython.min.js">
- </script>
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.11.0/brython_stdlib.js">
- </script>
- </head>
- <body onload="brython({debug:1})">
- <h1>WarTank</h1>
- <div class="container">
- <h2>Список танков</h2>
- <div class="btn-group" role="group" aria-label="Управление списком">
- <button type="button" id="bot_list_update" class="btn btn-primary">Обновить</button>
- <button type="button" id="bot_list_add" class="btn btn-primary">Добавить</button>
- </div>
- <div class="container" id="bot_list">
- </div>
- <div class="container" id="bot_list_new">
- <!-- Форма для добавления нового бота -->
- </div>
- </div>
- <script type="text/python">
- from browser import document, ajax, bind
- def bot_list_update(ev):
- def read(req):
- print(req.text)
- document["bot_list"]=req.text
- ajax.get("/bot_list/update", oncomplete=read)
- def bot_list_add(ev):
- print("bot_list_add click!")
- botListNew=document["bot_list_new"]
- botListNew.clear()
- login=document.createElement("span")
- login["class"]="badge bg-primary"
- login.text="Логин"
- botListNew.appendChild(login)
- document["bot_list_update"].bind("click", bot_list_update)
- document["bot_list_add"].bind("click", bot_list_add)
- document.attach("Hello !")
- </script>
- </body>
- </html>
- {{ end }}
|