Update form theme

This commit is contained in:
Edgar P. Burkhart 2022-05-22 18:07:04 +02:00
parent 30ccc7b6eb
commit c5ac2d83c7
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
6 changed files with 34 additions and 11 deletions

View file

@ -3,17 +3,27 @@ form {
grid-template-columns: auto 1fr;
grid-gap: var(--gap);
margin: var(--gap) 0;
line-height: 2rem;
}
form input,
form select,
form textarea {
padding: 0 var(--gap);
}
form > label,
form > input[type="text"],
form > input[type="number"],
form > select,
form > textarea {
form > select {
font-size: inherit;
line-height: inherit;
font-family: inherit;
}
form > textarea {
font-size: inherit;
font-family: inherit;
}
form > input[type="text"],
form > input[type="number"],
form > textarea {
@ -25,22 +35,26 @@ form > .buttons {
grid-column: 1 / -1;
text-align: right;
}
form > .buttons input {
padding: .5em 1em;
margin-left: 1em;
form > .buttons input,
form select,
form input[type="file"] {
font-size: inherit;
line-height: inherit;
font-family: inherit;
border: 0;
background: var(--bg);
background: var(--bg-01);
cursor: pointer;
border-radius: 2px;
}
form > .buttons input {
margin-left: var(--gap);
}
form > .buttons input:hover {
text-decoration: underline;
}
form > .buttons input[type="submit"] {
background: var(--green);
color: var(--text-inv);
}
form > .buttons input[type="reset"] {
color: var(--red);

View file

@ -19,6 +19,7 @@
{{ field }}
{% endfor %}
<div class="buttons">
<a href="{% url 'del_category' category.id %}"><input type="button" value="Delete" class="btn del" /></a>
<input type="reset" />
<input type="submit" value="Save Category" />
</div>

View file

@ -29,7 +29,7 @@
{{ field }}
{% endfor %}
<div class="buttons">
<a href="{% url 'del_snapshot' snapshot.date %}"><input type="button" value="Delete" /></a>
<a href="{% url 'del_snapshot' snapshot.date %}"><input type="button" value="Delete" class="del" /></a>
<input type="reset" />
<input type="submit" value="Save Snapshot" />
</div>

View file

@ -18,9 +18,9 @@
{{ field }}
{% endfor %}
<div class="buttons">
<a href="{% url 'del_transaction' transaction.id %}"><input type="button" value="Delete" class="del" /></a>
<input type="reset" />
<input type="submit" value="Save Transaction" />
<a href="{% url 'del_transaction' transaction.id %}"><input type="button" value="Delete" class="btn del" /></a>
<input class="btn" type="reset" />
<input class="btn" type="submit" value="Save Transaction" />
</div>
</form>
{% endspaceless %}
@ -46,6 +46,6 @@
<label for="{{ field.id_for_label }}">{{field.label }}</label>
{{ field }}
{% endfor %}
<div class="buttons"><input type="submit" value="Add Invoice" /></div>
<div class="buttons"><input class="btn" type="submit" value="Add Invoice" /></div>
</form>
{% endblock %}

View file

@ -23,6 +23,7 @@ urlpatterns = [
path("category", views.category, name="category"),
path("category/<uuid>", views.category, name="category"),
path("category/<uuid>/update", views.update_category, name="update_category"),
path("category/<uuid>/del", views.del_category, name="del_category"),
path("snapshot", views.snapshot, name="snapshot"),
path("snapshot/<date>", views.snapshot, name="snapshot"),
path("snapshot/update/<uuid>", views.update_snapshot, name="update_snapshot"),

View file

@ -133,6 +133,13 @@ def update_category(request, uuid):
return redirect(category, uuid=uuid)
@login_required
def del_category(request, uuid):
_category = get_object_or_404(Category, id=uuid)
_category.delete()
return redirect(index)
@login_required
def snapshot(request, date=None):
if date is None: