/
_percentage_form.html.eex
37 lines (35 loc) · 1.8 KB
/
_percentage_form.html.eex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<%
action = if is_nil(@gate), do: "Add", else: "Update"
%>
<span>
<form id="fwf-new-group-form" action="<%= path(@conn, "/flags/#{url_safe(@flag.name)}/percentage") %>" method="post" class="form-inline">
<input type="hidden" name="_csrf_token" value="<%= @conn.assigns[:csrf_token] %>">
<%= if assigns[:error_message] do %>
<div class="input-group mr-2 has-danger fwf-wide-input">
<div class="input-group-addon">percentage</div>
<div class="input-group-addon"><code>0 < x < 1</code></div>
<input type="number" step="0.000000001" class="form-control form-control-danger" id="percent_value" name="percent_value" placeholder="e.g. 0.421337 for 42.1337%">
</div>
<% else %>
<div class="input-group mr-2 fwf-wide-input">
<div class="input-group-addon">%</div>
<div class="input-group-addon"><code>0 < x < 1</code></div>
<input type="number" step="0.000000001" class="form-control" id="percent_value" name="percent_value" placeholder="e.g. 0.421337 for 42.1337%">
</div>
<% end %>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="percent_type" id="radio-percent-type-time" value="time" checked>
<span class="badge badge-default">% of time</span>
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="percent_type" id="radio-percent-type-actors" value="actors">
<span class="badge badge-default">% of actors</span>
</label>
</div>
<button type="submit" class="btn btn-sm btn-primary ml-3"><%= action %></button>
<small class="form-text text-danger ml-3"><%= assigns[:error_message] %></small>
</form>
</span>