Some setting panel refactors

This commit is contained in:
2024-03-01 20:18:06 +01:00
parent aa25a84df0
commit 3501d6885d
5 changed files with 29 additions and 8 deletions
+5
View File
@@ -23,6 +23,11 @@ class Profile(models.Model):
quota = models.FloatField(default=10.0)
quota_last_updated = models.DateTimeField(default=timezone.now, null=False)
@property
def quota_display(self):
return int(self.quota)
def update_quota(self):
elapsed = timezone.now() - self.quota_last_updated
if elapsed.seconds > 300:
Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

+14 -3
View File
@@ -203,7 +203,7 @@ iframe {
}
.clippy .body {
background: lightyellow;
background: #ffffe0;
color: black;
padding: 10px;
border-radius: 10px;
@@ -328,8 +328,19 @@ iframe {
width: 360px;
}
.progress-indicator.segmented > .progress-indicator-bar {
.field-row.settings label {
width: 200px;
}
.status-bar-field {
.field-row.settings {
margin-bottom: 8px;
}
.settings .admin-panel {
background-image: url(img/gears.png);
height: 40px;
background-repeat: no-repeat;
background-position: 50% 50%;
width: 40px;
min-width: 0;
}
+1 -1
View File
@@ -57,6 +57,6 @@ Nomineren
>
<span class="progress-indicator-bar" style="width: calc({{user.profile.quota | floatformat:0}} * 18px);" />
</div>
<p class="status-bar-field">{{user.profile.quota|floatformat:0}} nominaties over.</p>
<p class="status-bar-field">{{user.profile.quota_display}} nominaties over.</p>
</div>
{% endblock %}
+9 -4
View File
@@ -5,19 +5,19 @@ Instellingen
{% endblock %}
{% block main-content %}
<p>Hoi {{ user.first_name }}!</p>
<p>Je bent ingelogd als <strong>{{ user.email }}</strong>.</p>
{% if user.is_staff %}
<form action="{% url 'admin:index' %}">
<div class="field-row">
<div class="field-row settings">
<label>Administratieve achterkant:</label>
<input type="submit" value="Admin" />
<input type="submit" value="" class="icon admin-panel" />
</div>
</form>
{% endif %}
<form method="post">
{% csrf_token %}
{% if backgrounds %}
<div class="field-row">
<div class="field-row settings">
<label for="wallpaper">Wallpaper:</label>
<select id="background" name="background" onchange="this.form.submit()">
{% for background in backgrounds %}
@@ -32,4 +32,9 @@ Instellingen
</div>
{% endif %}
</form>
<div class="field-row settings">
<label>Nominatie quota:</label>
<span>{{user.profile.quota|floatformat:3}}</span>
</div>
</form>
{% endblock %}