Added dynamic support for countries
This commit is contained in:
1 parent
381444a838
commit
47b9939ead
17 files changed
+296
-69
No files matched your search
@@ -4,10 +4,9 @@
|
||||
<section>
|
||||
<label for="country">Country:</label>
|
||||
<select id="country" required name="country">
|
||||
<option value="HR">Croatia</option>
|
||||
<option value="US">United states</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="GB">Great Britain</option>
|
||||
{{range $entry := .Countries}}
|
||||
<option value="{{$entry.IsoName}}">{{$entry.Name}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
<section>
|
||||
<label for="country">Country:</label>
|
||||
<select id="country" name="country">
|
||||
<option value="HR">Croatia</option>
|
||||
<option value="US">United states</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="GB">Great Britain</option>
|
||||
{{range $entry := .Countries}}
|
||||
<option value="{{$entry.IsoName}}">{{$entry.Name}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
<dialog class="card" id="delete-card">
|
||||
<h3 class="card-title">Delete country</h3>
|
||||
<p>Are you sure you want to delete "{{.Country.Name}}"?<br>All holidays for given country will be deleted!</p>
|
||||
<form method="post" action="/admin/countries/{{.Country.Id}}/delete">
|
||||
<section class="actions">
|
||||
<button type="submit">Delete</button>
|
||||
<button type="button" onclick="closeDialog('#delete-card')">Cancel</button>
|
||||
</section>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -0,0 +1,18 @@
|
||||
<dialog class="card" id="update-card">
|
||||
<h3 class="card-title">Edit country</h3>
|
||||
<form method="post" action="/admin/countries">
|
||||
<input type="hidden" name="id" value="{{.Country.Id}}">
|
||||
<section>
|
||||
<label for="name">Iso name:</label>
|
||||
<input required minlength="2" maxlength="2" id="iso_name" value="{{.Country.IsoName}}" name="iso_name" type="text">
|
||||
</section>
|
||||
<section>
|
||||
<label for="name">Name:</label>
|
||||
<input required minlength="1" maxlength="45" id="name" value="{{.Country.Name}}" name="name" type="text">
|
||||
</section>
|
||||
<section class="actions">
|
||||
<button type="submit">Update</button>
|
||||
<button type="button" onclick="closeDialog('#update-card')">Cancel</button>
|
||||
</section>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -5,10 +5,9 @@
|
||||
<section>
|
||||
<label for="country">Country:</label>
|
||||
<select id="country" required name="country">
|
||||
<option {{if eq .Holiday.Country "HR"}}selected{{end}} value="HR">Croatia</option>
|
||||
<option {{if eq .Holiday.Country "US"}}selected{{end}} value="US">United states</option>
|
||||
<option {{if eq .Holiday.Country "FR"}}selected{{end}} value="FR">France</option>
|
||||
<option {{if eq .Holiday.Country "GB"}}selected{{end}} value="GB">Great Britain</option>
|
||||
{{range $entry := .Countries}}
|
||||
<option {{if eq $.Holiday.Country $entry.IsoName}}selected{{end}} value="{{$entry.IsoName}}">{{$entry.Name}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
Reference in new issue
Block a user