Skip to content

Commit

Permalink
feat: Adding edit modal (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViBiOh authored Apr 16, 2020
1 parent f95de89 commit 4f1740c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
22 changes: 21 additions & 1 deletion templates/ketchup.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ <h2 class="header">Confirmation</h2>
</div>
{{ end }}

{{ define "edit-modal" }}
<div id="edit-modal-{{ .ID }}" class="modal">
<div class="modal-content">
<h2 class="header">{{ .Repository }}</h2>

<form method="PUT" action="/api/targets/{{ .ID }}">
<p class="padding no-margin">
<label for="edit-current-version-{{ .ID }}" class="block">Current version:</label>
<input id="edit-current-version-{{ .ID }}" type="text" value="{{ .CurrentVersion }}">
</p>

{{ template "form_buttons" "Submit" }}
</form>
</div>
</div>
{{ end }}

{{ define "targets" }}
<style>
Expand Down Expand Up @@ -67,6 +83,7 @@ <h2 class="header">Confirmation</h2>

<article>
{{ range $index, $target := . }}
{{ template "edit-modal" $target }}
{{ template "delete-modal" $target }}

<div class="padding target">
Expand All @@ -84,8 +101,11 @@ <h2 class="header">Confirmation</h2>
{{ end }}
</span>

<a href="#edit-modal-{{ .ID }}" class="button button-icon" alt="Edit">
<img class="icon" src="/svg/edit?fill=silver" alt="Edit icon">
</a>
<a href="#delete-modal-{{ .ID }}" class="button button-icon" alt="Delete">
<img class="icon" src="/svg/times?fill=silver" alt="Delete">
<img class="icon" src="/svg/times?fill=silver" alt="Delete icon">
</a>
</div>
{{ end }}
Expand Down
8 changes: 8 additions & 0 deletions templates/style.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
text-align: left;
}

.block {
display: block;
}

.center {
text-align: center;
}
Expand All @@ -61,6 +65,10 @@
padding: 0;
}

.margin {
margin: 1rem;
}

.no-margin {
margin: 0;
}
Expand Down

0 comments on commit 4f1740c

Please sign in to comment.