Skip to content

Commit

Permalink
Hooked up article toolbox UI to API.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnyLlama committed Apr 22, 2024
1 parent 9507e47 commit 4e0d458
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions scss/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ form {
> .btn {
width: max-content;
}

&.hidden-form {
display: none;
}
}
20 changes: 16 additions & 4 deletions templates/single-text-view.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,35 @@
<h1>Verktygslåda</h1>
<div class="flex wrap gap">
{% if can_mark_as_done %}
<button class="btn" icon="done">Markera som klar</button>
<form class="hidden-form" id="mark-text-done-form" action="/api/text/set-done-status/true" method="post">
<input type="hidden" name="text-id" value="{{ text.id }}">
</form>
<button form="mark-text-done-form" type="submit" class="btn" icon="done">Markera som klar</button>
{% endif %}

{% if can_unmark_as_done %}
<button class="btn" icon="close">Markera som inte klar</button>
<form class="hidden-form" id="mark-text-not-done-form" action="/api/text/set-done-status/false" method="post">
<input type="hidden" name="text-id" value="{{ text.id }}">
</form>
<button form="mark-text-not-done-form" class="btn" icon="close">Markera som inte klar</button>
{% endif %}

{% if can_edit_text %}
<a href="/control-panel/edit/{{ text.id }}" class="btn" icon="edit_note">Redigera</a>
{% endif %}

{% if can_unpublish_text %}
<button class="btn dangerous" icon="unpublished">Avpublicera</button>
<form class="hidden-form" id="unpublish-text-form" action="/api/text/set-publish-status/false" method="post">
<input type="hidden" name="text-id" value="{{ text.id }}">
</form>
<button form="unpublish-text-form" class="btn dangerous" icon="unpublished">Avpublicera</button>
{% endif %}

{% if can_publish_text %}
<button class="btn" icon="publish">Publicera</button>
<form class="hidden-form" id="publish-text-form" action="/api/text/set-publish-status/true" method="post">
<input type="hidden" name="text-id" value="{{ text.id }}">
</form>
<button form="publish-text-form" class="btn" icon="publish">Publicera</button>
{% endif %}
</div>
</div>
Expand Down

0 comments on commit 4e0d458

Please sign in to comment.