make it pretty
This commit is contained in:
parent
96ff186913
commit
847eb691fe
8 changed files with 68 additions and 11 deletions
|
|
@ -42,6 +42,7 @@ class PasswordForm(forms.Form):
|
|||
class RFIDForm(forms.Form):
|
||||
rfid = forms.CharField(max_length=255, help_text=_('Your RFID'))
|
||||
|
||||
|
||||
class SIPPinForm(forms.Form):
|
||||
sippin = forms.CharField(max_length=255, help_text=_('Your SIP PIN'))
|
||||
|
||||
|
|
@ -49,3 +50,7 @@ class SIPPinForm(forms.Form):
|
|||
class NRF24Form(forms.Form):
|
||||
nrf24 = forms.CharField(max_length=255,
|
||||
help_text=_('Your NRF24 identification'))
|
||||
|
||||
|
||||
class CLabPinForm(forms.Form):
|
||||
c_lab_pin = GastroPinField(help_text=_('Your c-lab PIN'))
|
||||
23
account/templates/clabpin.html
Normal file
23
account/templates/clabpin.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% extends "form_base.html" %}
|
||||
{% load i18n %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block form_title %}{% trans "c-lab PIN"%}{% endblock %}
|
||||
|
||||
{% block form_description %}
|
||||
<p>{% blocktrans %}Change your c-lab PIN to access the c-lab in the basement.{% endblocktrans %}</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block form_fields %}
|
||||
{{ form.non_field_errors }}
|
||||
<form action="{% url account.views.clabpin %}" method="post" class="form-horizontal well">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button type="submit" class="btn btn-primary">{% trans "Save"%}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock form_fields %}
|
||||
|
|
@ -5,7 +5,12 @@
|
|||
{% block form_title %}{% trans "Gastro PIN"%}{% endblock %}
|
||||
|
||||
{% block form_description %}
|
||||
<p>{% blocktrans %}Change your Gastro PIN to access the vending machines.{% endblocktrans %}</p>
|
||||
|
||||
<p>{% blocktrans %}Change your Gastro PIN to access the vending machines.
|
||||
To use unlock member prices, press the <code>A</code> button then enter
|
||||
your numeric user ID{% endblocktrans %}
|
||||
<code>{{ member.uidNumber }}</code>
|
||||
{% blocktrans %}and your Gastro PIN.{% endblocktrans %}</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block form_fields %}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="well">
|
||||
<div class="span11 well">
|
||||
<h3>Login</h3>
|
||||
<form class="form form-horizontal" action="/account/login/?next={{ redirect_to }}" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
|
|
@ -21,5 +22,9 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row pull-right">
|
||||
<small class="muted">Copyright © 2013 by c-base e.V.</small>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@
|
|||
<li class="{% if request.path == rfid_url %}active{% endif %}">
|
||||
<a href="{{ rfid_url }}">{% trans "RFID" %}</a>
|
||||
</li>
|
||||
{% url account.views.clabpin as clab_url %}
|
||||
<li class="{% if request.path == clab_url %}active{% endif %}">
|
||||
<a href="{{ clab_url }}">{% trans "c-lab-PIN" %}</a>
|
||||
</li>
|
||||
{% url account.views.nrf24 as nrf24_url %}
|
||||
<li class="{% if request.path == nrf24_url %}active{% endif %}">
|
||||
<a href="{{ nrf24_url }}">{% trans "NRF24" %}</a>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ urlpatterns = patterns(
|
|||
url(r'^nrf24/$', 'account.views.nrf24', name='nrf24'),
|
||||
url(r'^password/$', 'account.views.password', name='password'),
|
||||
url(r'^sippin/$', 'account.views.sippin', name='sippin'),
|
||||
url(r'^clabpin/$', 'account.views.clabpin', name='clabpin'),
|
||||
url(r'^$', 'account.views.home', name="home"),
|
||||
url(r'^groups/(?P<group_name>[^/]+)/', 'account.views.groups_list'),
|
||||
)
|
||||
|
|
@ -13,7 +13,7 @@ from django.shortcuts import render
|
|||
from django.utils.translation import ugettext as _
|
||||
|
||||
from forms import GastroPinForm, WlanPresenceForm, LoginForm, PasswordForm, \
|
||||
RFIDForm, NRF24Form, SIPPinForm
|
||||
RFIDForm, NRF24Form, SIPPinForm, CLabPinForm
|
||||
from cbase_members import MemberValues, retrieve_member
|
||||
|
||||
|
||||
|
|
@ -113,15 +113,17 @@ def set_ldap_field(request, form_type, field_names, template_name):
|
|||
member.save()
|
||||
new_form = form_type(initial=initial)
|
||||
return render(request, template_name,
|
||||
{'message': _('Your changes have been saved. Thank you!'),
|
||||
'form': new_form})
|
||||
{'message': _('Your changes have been saved. Thank you!'),
|
||||
'form': new_form, 'member': member.to_dict()})
|
||||
else:
|
||||
return render(request, template_name, {'form:': form})
|
||||
return render(request, template_name,
|
||||
{'form:': form, 'member': member.to_dict()})
|
||||
else:
|
||||
for form_field, ldap_field in field_names:
|
||||
initial[form_field] = member.get(ldap_field)
|
||||
form = form_type(initial=initial)
|
||||
return render(request, template_name, {'form': form})
|
||||
return render(request, template_name,
|
||||
{'form': form, 'member': member.to_dict()})
|
||||
|
||||
@login_required
|
||||
def wlan_presence(request):
|
||||
|
|
@ -138,5 +140,11 @@ def nrf24(request):
|
|||
|
||||
@login_required
|
||||
def password(request):
|
||||
return set_ldap_field(request, PasswordForm, [('password1', 'password')], 'password.html')
|
||||
return set_ldap_field(request, PasswordForm, [('password1', 'password')],
|
||||
'password.html')
|
||||
|
||||
@login_required
|
||||
def clabpin(request):
|
||||
return set_ldap_field(request, CLabPinForm, [('c_lab_pin', 'c-labPIN')],
|
||||
'clabpin.html')
|
||||
|
||||
|
|
|
|||
|
|
@ -38,10 +38,12 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<!-- a class="brand" href="/">crew.c-base.org</a -->
|
||||
<span class="brand"><a href="/">{% trans "c-base Member Interface" %}</a></span>
|
||||
<div class="nav-collapse collapse">
|
||||
<p class="navbar-text pull-left">
|
||||
c-base member-interface {% if request.user.is_authenticated %}-> {{ request.user.username }}{% endif %}
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<i class="icon-user icon-white"></i> {{ request.user.username }}{% endif %}
|
||||
</p>
|
||||
|
||||
<div class="pull-right">
|
||||
|
|
@ -94,7 +96,7 @@
|
|||
{{ form|crispy }}
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
||||
<button type="submit" class="btn btn-primary">{% trans "Sign in" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -102,6 +104,10 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endblock container %}
|
||||
<hr />
|
||||
<div class="row pull-right">
|
||||
<small class="muted">Copyright © 2013 by c-base e.V.</small>
|
||||
</div>
|
||||
</div><!-- /.container -->
|
||||
{% endblock body %}
|
||||
<script src="/static/js/bootstrap.js"></script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue