User menu, various fixes

This commit is contained in:
nikolark committed 2014-02-02 19:02:16 +01:00
1 parent b7b0238871
commit 00959c73b1
26 files changed
+1619 -226

No files matched your search

+3 -2
View File
@@ -22,7 +22,7 @@
{%block content%}
{%endblock%}
<div id="footer" class="row">
<div class="col-xs-12">
<div class="col-md-12 text-right">
{%block footer %}
<br />
<img src="{{ STATIC_URL }}img/edb_brick.png" alt="EDB" />
@@ -32,7 +32,8 @@
</div>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/collapse.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap/collapse.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap/dropdown.js"></script>
{%block tailinc %}
{%endblock%}
</body>
+66 -67
View File
@@ -14,77 +14,76 @@
</div>
</section>
{% endif %}
<section id="orders" class="row">
<div class="col-xs-12">
{% if not limit %}
<h2 title="Alle registrerte ordre">Alle ordre</h2><br />
<a href="{% url log %}">Vis kun siste</a>
{% else %}
<h2 title="Ordre fra de siste 2 dagene eller de 5 siste ordrene.">Siste ordre</h2><br />
<a href="{% url log-all %}">Vis alle</a>
{%endif %}
<table class="table table-striped">
<thead>
<tr>
<th>Når</th>
<th>Hvem</th>
<th>Hva</th>
<th>Sum</th>
<!--<th>Handling</th>-->
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td>{{ order.created }}</td>
<td>{% if order.customer.get_profile.image %}<img src="{{ order.customer.get_profile.image }}" class="customer" title="{{ order.customer.first_name }} {{ order.customer.last_name|slice:":1"}}" />{% else %}{{ order.customer.first_name }} {{ order.customer.last_name|slice:":1"}}{% endif %}</td>
<td>{% for line in order.orderline_set.all %}
<span class="amount">{{ line.amount}}</span> <a href="#" class="product" title="{{ line.unit_price}} per">{{ line.product }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
<td>{{ order.order_sum }}</td>
<!--<td><{% include "modal-delete-order.html" with order=order %}<a class="btn btn-danger" data-toggle="modal" href="#modal-order-{{order.id}}"><i class="icon-trash icon-white"></i> Slett</a></td>-->
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-md-6">
<section id="orders">
{% if not limit %}
<h2 title="Alle registrerte ordre">Alle ordre</h2><br />
<a href="{% url log %}">Vis kun siste</a>
{% else %}
<h2 title="Ordre fra de siste 2 dagene eller de 5 siste ordrene.">Siste ordre</h2><br />
<a href="{% url log-all %}">Vis alle</a>
{%endif %}
<table class="table table-striped">
<thead>
<tr>
<th>Når</th>
<th>Hvem</th>
<th>Hva</th>
<th>Sum</th>
<!--<th>Handling</th>-->
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td>{{ order.created }}</td>
<td>{% if order.customer.get_profile.image %}<img src="{{ order.customer.get_profile.image }}" class="customer" title="{{ order.customer.first_name }} {{ order.customer.last_name|slice:":1"}}" />{% else %}{{ order.customer.first_name }} {{ order.customer.last_name|slice:":1"}}{% endif %}</td>
<td>{% for line in order.orderline_set.all %}
<span class="amount">{{ line.amount}}</span> <a href="#" class="product" title="{{ line.unit_price}} per">{{ line.product }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
<td>{{ order.order_sum }}</td>
<!--<td><{% include "modal-delete-order.html" with order=order %}<a class="btn btn-danger" data-toggle="modal" href="#modal-order-{{order.id}}"><i class="icon-trash icon-white"></i> Slett</a></td>-->
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</section>
<section id="transactions" class="row">
<div class="col-xs-12">
{% if not limit %}
<h2 title="Alle registrerte transaksjoner">Alle transaksjoner</h2>
<br /><a href="{% url log %}#transactions">Vis kun siste</a>
{% else %}
<h2 title="Transaksjoner fra de siste 2 dagene eller de 5 siste transaksjonene.">Siste transaksjoner</h2><br />
<a href="{% url log-all %}#transactions">Vis alle</a>
{%endif %}
<table class="table table-striped">
<thead>
<tr>
<th>Når</th>
<th>Hvem</th>
<th>Innskudd</th>
<!--<th>Handling</th>-->
</tr>
</thead>
<tbody>
{% for t in transactions %}
<tr>
<td>{{ t.created }}</td>
<td>{% if t.user.get_profile.image %}<img src="{{ t.user.get_profile.image }}" class="customer" title="{{ t.user.first_name }} {{ t.user.last_name|slice:":1"}}" />{% else %}{{ t.user.first_name }} {{ t.user.last_name|slice:":1"}}{% endif %}</td>
<td>{{ t.amount }}</td>
<!--<td>{% include "modal-delete-transaction.html" with t=t %}<a class="btn btn-danger" data-toggle="modal" href="#modal-trans-{{t.id}}"><i class="icon-trash icon-white"></i> Slett</a></td>-->
</tr>
{% endfor %}
</tbody>
</table>
  <a href="{% url register %}" class="btn">« Gå tilbake</a>
<div class="col-md-6">
<section id="transactions">
{% if not limit %}
<h2 title="Alle registrerte transaksjoner">Alle transaksjoner</h2>
<br /><a href="{% url log %}#transactions">Vis kun siste</a>
{% else %}
<h2 title="Transaksjoner fra de siste 2 dagene eller de 5 siste transaksjonene.">Siste transaksjoner</h2><br />
<a href="{% url log-all %}#transactions">Vis alle</a>
{%endif %}
<table class="table table-striped">
<thead>
<tr>
<th>Når</th>
<th>Hvem</th>
<th>Innskudd</th>
<!--<th>Handling</th>-->
</tr>
</thead>
<tbody>
{% for t in transactions %}
<tr>
<td>{{ t.created }}</td>
<td>{% if t.user.get_profile.image %}<img src="{{ t.user.get_profile.image }}" class="customer" title="{{ t.user.first_name }} {{ t.user.last_name|slice:":1"}}" />{% else %}{{ t.user.first_name }} {{ t.user.last_name|slice:":1"}}{% endif %}</td>
<td>{{ t.amount }}</td>
<!--<td>{% include "modal-delete-transaction.html" with t=t %}<a class="btn btn-danger" data-toggle="modal" href="#modal-trans-{{t.id}}"><i class="icon-trash icon-white"></i> Slett</a></td>-->
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</section>
</div>
</section>
{% endblock %}
{% block tailinc %}
<script src="{{ STATIC_URL }}js/bootstrap-tooltip.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-modal.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap-transition.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap/tooltip.js"></script>
<script src="{{ STATIC_URL }}js/log.js"></script>
{% endblock %}
+16 -6
View File
@@ -1,5 +1,4 @@
<nav class="navbar navbar-inverse" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
@@ -15,11 +14,22 @@
<ul class="nav navbar-nav">
<li class="{% if active = "register" %}active{% endif %}"><a href="/register"><i class="glyphicon glyphicon-home white"></i> Kjøp drikke</a></li>
<li class="{% if active = "deposit" %}active{% endif %}"><a href="/deposit">Sett inn penger</a></li>
<li class="{% if active = "log" %}active{% endif %}"><a href="/log"> Vis logg</a></li>
<li class="{% if active = "stats" %}active{% endif %}"><a href="/stats"> Vis statistikk</a></li>
{% if request.user.is_superuser %}
<li class="{% if active = "create_user" %}active{% endif %}"><a href="{% url create-user %}">Ny bruker</a></li>
<li><a href="/admin">Administrasjon</a></li>
<li class="{% if active = "log" %}active{% endif %}"><a href="/log"><i class="glyphicon glyphicon-list-alt"></i> Logg</a></li>
<li class="{% if active = "stats" %}active{% endif %}"><a href="/stats"><i class="glyphicon glyphicon-stats"></i> Statistikk</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{% if not user.is_authenticated %}
<li><a href="{% url login %}">Logg inn</a></li>
{% else %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Innstillinger <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="{% if active = "create_user" %}active{% endif %}"><a href="{% url create-user %}"><i class="glyphicon glyphicon-plus"></i> Ny bruker</a></li>
{% if request.user.is_superuser %}<li><a href="/admin"><i class="glyphicon glyphicon-cog"></i> Administrasjon</a></li>{% endif %}
<li class="divider"></li>
<li><a href="{% url logout %}"><i class="glyphicon glyphicon-log-out"></i> Logg ut</a></li>
</ul>
</li>
{% endif %}
</ul>
</div><!-- /.navbar-collapse -->
+1 -1
View File
@@ -100,6 +100,6 @@
{% endblock %}
{% block tailinc %}
<!--<script src="{{ STATIC_URL }}js/bootstrap-typeahead.js"></script>-->
<script src="{{ STATIC_URL }}js/tooltip.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap/tooltip.js"></script>
<script src="{{ STATIC_URL }}js/register.js"></script>
{% endblock %}
+28 -26
View File
@@ -8,33 +8,35 @@
{% endblock %}
{% block content %}
<section class="row">
<div class="col-md-4">
{% for message in messages %}
<div {% if message.tags %} class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}<a class="close" data-dismiss="alert">×</a></div>
{% endfor %}
</div>
</section>
<section class="row">
<div class="col-md-5">
<h1>Legg til ny bruker</h1>
{% if form.errors %}
<p>{{ form.errors }}.</p>
{% endif %}
{% if perms.auth.can_add_user %}
<section class="row">
<div class="col-md-4">
{% for message in messages %}
<div {% if message.tags %} class="alert alert-{{ message.tags }}"{% endif %}>{{ message }}<a class="close" data-dismiss="alert">×</a></div>
{% endfor %}
</div>
</section>
<section class="row">
<div class="col-md-5">
<h1>Legg til ny bruker</h1>
{% if form.errors %}
<p>{{ form.errors }}.</p>
{% endif %}
<form method="post" role="form">
{% csrf_token %}
<form method="post" role="form">
{% csrf_token %}
<div class="form-group">
<label for="id_first_name">{{ form.first_name.label }}</label>{{ form.first_name|add_class:"form-control"}}
<label for="id_last_name">{{ form.last_name.label }}</label>{{ form.last_name|add_class:"form-control"}}
<label for="id_email">{{ form.email.label }}</label>{{ form.email|add_class:"form-control"}}
<label for="id_facebook_username">{{ form.facebook_username.label }}</label>{{ form.facebook_username|add_class:"form-control"|attr:"placeholder: F.eks simbras"}}
<div class="form-group">
<label for="id_first_name">{{ form.first_name.label }}</label>{{ form.first_name|add_class:"form-control"}}{{ form.first_name.error }}
<label for="id_last_name">{{ form.last_name.label }}</label>{{ form.last_name|add_class:"form-control"}}{{ form.last_name.error }}
<label for="id_email">{{ form.email.label }}</label>{{ form.email|add_class:"form-control"}}{{ form.email.error }}
<label for="id_facebook_username">{{ form.facebook_username.label }}</label>{{ form.facebook_username|add_class:"form-control"|attr:"placeholder: F.eks simbras"}}{{form.facebook_username.error}}
</div>
<input type="submit" value="Legg til" class="btn btn-primary btn-lg" />
<a href="{% url register %}" class="btn btn-default" />Tilbake</a>
</form>
</div>
</section>
</div>
<input type="submit" value="Legg til" class="btn btn-primary btn-lg" />
<a href="{% url register %}" class="btn btn-default" />Tilbake</a>
</form>
</div>
</section>
{% endif %}
{% endblock %}
+1
View File
@@ -6,3 +6,4 @@
{% include "registration/login_form.html" %}
{% endblock %}
{% block footer %}{% endblock %}
+15 -19
View File
@@ -1,20 +1,16 @@
{% if form.errors %}
<p>Brukernavn og passord stemmer ikke overens. Prøv igjen.</p>
{% endif %}
{% load widget_tweaks %}
<div class="form-login">
{% if form.errors %}
<p class="alert alert-danger">Brukernavn og passord stemmer ikke overens. Prøv igjen.</p>
{% endif %}
<form method="post" action="{% url django.contrib.auth.views.login %}" class="bp">
{% csrf_token %}
<table>
<tr>
<th><label for="id_username">Brukernavn:</label></th>
<td>{{ form.username }}</td>
</tr>
<tr>
<th><label for="id_password">Passord: </label></th>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="Logg inn" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<form method="post" action="{% url django.contrib.auth.views.login %}" class="">
{% csrf_token %}
<label for="id_username">Brukernavn:</label>
{{ form.username|add_class:"form-control" }}
<label for="id_password">Passord: </label>
{{ form.password|add_class:"form-control" }}<br/>
<input type="submit" value="Logg inn" class="btn btn-primary btn-lg"/>
<input type="hidden" name="next" value="{{ next }}" />
</form>
</div>
+10 -2
View File
@@ -3,6 +3,14 @@
{% block title %}Logg inn{% endblock %}
{% block content %}
Du er logget ut. Vil du <a href="{% url main.views.home %}">logge inn igjen</a>.
<div class="row">
<div class="col-md-6">
{% if user.is_authenticated %}
<p class="alert alert-success">Du er logget ut.</p>
<p>Vil du <a href="{% url home %}">logge inn igjen?</a></p>
{% else %}
<p>Du er allerede logget ut.</p>
{% endif %}
</div>
</div>
{% endblock %}
+1 -1
View File
@@ -41,7 +41,7 @@
</section>
{% endblock %}
{% block tailinc %}
<script src="{{ STATIC_URL }}js/tooltip.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap/tooltip.js"></script>
<script src="{{ STATIC_URL }}js/highcharts.js"></script>
<script src="{{ STATIC_URL }}js/underscore-min.js"></script>
<script src="{{ STATIC_URL }}js/stats.js"></script>