Some setting panel refactors
This commit is contained in:
@@ -23,6 +23,11 @@ class Profile(models.Model):
|
|||||||
|
|
||||||
quota = models.FloatField(default=10.0)
|
quota = models.FloatField(default=10.0)
|
||||||
quota_last_updated = models.DateTimeField(default=timezone.now, null=False)
|
quota_last_updated = models.DateTimeField(default=timezone.now, null=False)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def quota_display(self):
|
||||||
|
return int(self.quota)
|
||||||
|
|
||||||
def update_quota(self):
|
def update_quota(self):
|
||||||
elapsed = timezone.now() - self.quota_last_updated
|
elapsed = timezone.now() - self.quota_last_updated
|
||||||
if elapsed.seconds > 300:
|
if elapsed.seconds > 300:
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 498 B |
@@ -203,7 +203,7 @@ iframe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.clippy .body {
|
.clippy .body {
|
||||||
background: lightyellow;
|
background: #ffffe0;
|
||||||
color: black;
|
color: black;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
@@ -328,8 +328,19 @@ iframe {
|
|||||||
width: 360px;
|
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;
|
||||||
}
|
}
|
||||||
@@ -57,6 +57,6 @@ Nomineren
|
|||||||
>
|
>
|
||||||
<span class="progress-indicator-bar" style="width: calc({{user.profile.quota | floatformat:0}} * 18px);" />
|
<span class="progress-indicator-bar" style="width: calc({{user.profile.quota | floatformat:0}} * 18px);" />
|
||||||
</div>
|
</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>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -5,19 +5,19 @@ Instellingen
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main-content %}
|
{% block main-content %}
|
||||||
<p>Hoi {{ user.first_name }}!</p>
|
<p>Je bent ingelogd als <strong>{{ user.email }}</strong>.</p>
|
||||||
{% if user.is_staff %}
|
{% if user.is_staff %}
|
||||||
<form action="{% url 'admin:index' %}">
|
<form action="{% url 'admin:index' %}">
|
||||||
<div class="field-row">
|
<div class="field-row settings">
|
||||||
<label>Administratieve achterkant:</label>
|
<label>Administratieve achterkant:</label>
|
||||||
<input type="submit" value="Admin" />
|
<input type="submit" value="" class="icon admin-panel" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if backgrounds %}
|
{% if backgrounds %}
|
||||||
<div class="field-row">
|
<div class="field-row settings">
|
||||||
<label for="wallpaper">Wallpaper:</label>
|
<label for="wallpaper">Wallpaper:</label>
|
||||||
<select id="background" name="background" onchange="this.form.submit()">
|
<select id="background" name="background" onchange="this.form.submit()">
|
||||||
{% for background in backgrounds %}
|
{% for background in backgrounds %}
|
||||||
@@ -32,4 +32,9 @@ Instellingen
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
<div class="field-row settings">
|
||||||
|
<label>Nominatie quota:</label>
|
||||||
|
<span>{{user.profile.quota|floatformat:3}}</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user