Reworked index, navbar fixes

This commit is contained in:
Sebastian Lohff 2017-01-23 01:09:04 +01:00
parent e127f0a494
commit e43928e8f8
6 changed files with 55 additions and 42 deletions

View File

@ -29,8 +29,9 @@ def contestIndex(request):
#messages.success(request, "Great Success")
qsoform = QSOForm(request.user)
contest = Contest.objects.get(id=1)
qrgs = Frequency.objects.filter(band__contest=contest).order_by("channel")
return render(request, 'contest/index.html', {"qsoform": qsoform, "contest": contest})
return render(request, 'contest/index.html', {"qsoform": qsoform, "contest": contest, "qrgs": qrgs})
@login_required
def log(request):

View File

@ -45,7 +45,7 @@
<li{% if "log" in request.resolver_match.url_name %} class="active"{%endif%}><a href="{% url "contest:log" %}">Log</a></li>
{% endif %}
{% if user.is_staff %}
<li{% if "Ref" in request.resolver_match.url_name %} class="active"{%endif%}><a href="{% url "contest:registerRefs" %}">Register Refs!</a></li>
<li{% if "Ref" in request.resolver_match.url_name %} class="active"{%endif%}><a href="{% url "contest:registerRefs" %}">Register Users</a></li>
{% endif %}
{% else %}
<li{% if request.resolver_match.url_name == 'index' %} class="active"{%endif%}><a href="{% url "index" %}">Home</a></li>

View File

@ -0,0 +1,13 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">The Contest</h3></div>
<div class="panel-body">
<p>
Welcome to {{ contest.name }}!
<p/>
<p>We might be laid back people here at {{ contest.name }}, but we have some rules!</p>
<p>The <abbr title="Frequency">QRG</abbr>-changing is a serious thing. Also there is other stuff. But
maybe it's funnier if you find that out by yourself. And we punish you for not knowing. Such
is live.
</p>
</div>
</div>

View File

@ -2,6 +2,8 @@
{% block content %}
<h2>Welcome, {{ user }}</h2>
<div class="row">
<div class="col-sm-6">
{% if user.ref %}
{# user has a reference, we can start logging QSOs! #}
<div class="row">
@ -52,5 +54,14 @@
</div>
</div>
{% endif %}
</div>
<div class="col-sm-6">
{% include "contest/contestPanel.html" with contest=contest %}
</div>
<div class="col-sm-6">
{% include "contest/qrgPanel.html" with contest=contest qrgs=qrgs %}
</div>
</div>
{% endblock %}

View File

@ -4,48 +4,10 @@
<h2>Contest Rules && Overview!</h2>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">The Contest</h3></div>
<div class="panel-body">
<p>
Welcome to {{ contest.name }}!
<p/>
<p>We might be laid back people here at {{ contest.name }}, but we have some rules!</p>
<p>The <abbr title="Frequency">QRG</abbr>-changing is a serious thing. Also there is other stuff. But
maybe it's funnier if you find that out by yourself. And we punish you for not knowing. Such
is live.
</p>
</div>
</div>
{% include "contest/contestPanel.html" with contest=contest %}
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">QRGs</h3></div>
<div class="panel-body">
<p>The following frequencies may be used in this contest</p>
<table class="table table-inverse">
<thead class="thead-inverse">
<tr>
<th>Channel</th>
<th>Band</th>
<th>QRG</th>
<th>Note</th>
</tr>
</thead>
<tbody>
{% for qrg in qrgs %}
<tr>
<td>{{ qrg.channel }}</td>
<td>{{ qrg.band }}</td>
<td>{{ qrg.qrg }}</td>
<td>{{ qrg.note }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% include "contest/qrgPanel.html" with contest=contest qrgs=qrgs %}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,26 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">QRGs</h3></div>
<div class="panel-body">
<p>The following frequencies may be used in this contest</p>
<table class="table table-inverse">
<thead class="thead-inverse">
<tr>
<th>Channel</th>
<th>Band</th>
<th>QRG</th>
<th>Note</th>
</tr>
</thead>
<tbody>
{% for qrg in qrgs %}
<tr>
<td>{{ qrg.channel }}</td>
<td>{{ qrg.band }}</td>
<td>{{ qrg.qrg }}</td>
<td>{{ qrg.note }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>