Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding edit modal #13

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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