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

View file

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

View file

@ -29,7 +29,7 @@
{{ field }} {{ field }}
{% endfor %} {% endfor %}
<div class="buttons"> <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="reset" />
<input type="submit" value="Save Snapshot" /> <input type="submit" value="Save Snapshot" />
</div> </div>

View file

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

View file

@ -23,6 +23,7 @@ urlpatterns = [
path("category", views.category, name="category"), path("category", views.category, name="category"),
path("category/<uuid>", views.category, name="category"), path("category/<uuid>", views.category, name="category"),
path("category/<uuid>/update", views.update_category, name="update_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", views.snapshot, name="snapshot"),
path("snapshot/<date>", views.snapshot, name="snapshot"), path("snapshot/<date>", views.snapshot, name="snapshot"),
path("snapshot/update/<uuid>", views.update_snapshot, name="update_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) 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 @login_required
def snapshot(request, date=None): def snapshot(request, date=None):
if date is None: if date is None: