Disable start button if the process is in progress.
This commit is contained in:
parent
45b6408b6b
commit
2cb9946faf
3 changed files with 12 additions and 2 deletions
|
@ -35,6 +35,10 @@ p {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button[disabled=disabled] {
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
#hintbutton {
|
#hintbutton {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
|
|
@ -9,7 +9,7 @@ defmodule UiWeb.MorseLive do
|
||||||
|
|
||||||
def mount(_session, socket) do
|
def mount(_session, socket) do
|
||||||
UiWeb.Endpoint.subscribe(@topic)
|
UiWeb.Endpoint.subscribe(@topic)
|
||||||
{:ok, assign(socket, progress: Morse.Server.progress())}
|
{:ok, assign(socket, default_assigns())}
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event("start_morse", _value, socket) do
|
def handle_event("start_morse", _value, socket) do
|
||||||
|
@ -20,4 +20,10 @@ defmodule UiWeb.MorseLive do
|
||||||
def handle_info(progress, socket) do
|
def handle_info(progress, socket) do
|
||||||
{:noreply, assign(socket, progress: progress)}
|
{:noreply, assign(socket, progress: progress)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp default_assigns do
|
||||||
|
[
|
||||||
|
progress: Morse.Server.progress(),
|
||||||
|
]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<h2>nl:<br>Druk op de Start knop hieronder om <span style="color:red">UVW</span><span style="color:blue">XYZ</span> te vinden. Je kunt dan de geocache vinden op N 52° 40.<span style="color:red">UVW</span>' E 004° 53.<span style="color:blue">XYZ</span>'</h2>
|
<h2>nl:<br>Druk op de Start knop hieronder om <span style="color:red">UVW</span><span style="color:blue">XYZ</span> te vinden. Je kunt dan de geocache vinden op N 52° 40.<span style="color:red">UVW</span>' E 004° 53.<span style="color:blue">XYZ</span>'</h2>
|
||||||
|
|
||||||
<div id="buttonwrap">
|
<div id="buttonwrap">
|
||||||
<button phx-click="start_morse" class="button">Start</button>
|
<button phx-click="start_morse" class="button" <%= if @progress != 100, do: ~s(disabled=disabled) %>>Start</button>
|
||||||
<div id="response-block">
|
<div id="response-block">
|
||||||
<h2>Response status:</h2>
|
<h2>Response status:</h2>
|
||||||
<p id="response"></p>
|
<p id="response"></p>
|
||||||
|
|
Loading…
Reference in a new issue