Commits

Matthew Marshall committed 38eb122

Added log out and password change views, and tweaked css and main form.

  • Participants
  • Parent commits 3bed589

Comments (0)

Files changed (8)

File htdocs/static/style.css

-body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; }
+body { font-family: sans-serif;  }
 a { color:#0000cc; }
 a:hover, a:visited, a:active { color:#880000; }
 div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; }
 	background-color: #aaffaa;
 	border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
 }
+
+
+/* MESSAGES & ERRORS */
+ul.messagelist { padding:0 0 5px 0; margin:0; }
+ul.messagelist li { font-size:12px; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border-bottom:1px solid #ddd; color:#666; background:#ffc url(../img/admin/icon_success.gif) 5px .3em no-repeat; }
+.errornote { font-size:12px !important; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border:1px solid red; color:red;background:#ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat; }
+ul.errorlist { margin:0 !important; padding:0 !important; }
+.errorlist li { font-size:12px !important; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border:1px solid red; color:white; background:red url(../img/admin/icon_alert.gif) 5px .3em no-repeat; }
+td ul.errorlist { margin:0 !important; padding:0 !important; }
+td ul.errorlist li { margin:0 !important; }
+.error { background:#ffc; }
+.error input, .error select { border:1px solid red; }
+div.system-message { background: #ffc; margin: 10px; padding: 6px 8px; font-size: .8em; }
+div.system-message p.system-message-title { padding:4px 5px 4px 25px; margin:0; color:red; background:#ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat; }
+.description { font-size:12px; padding:5px 0 0 12px; }
+
+/* ALIGNED FIELDSETS */
+.aligned label { display:block; padding:0 1em 3px 0; float:left; width:13em; }
+.aligned label.inline { display:inline; float:none; }
+.colMS .aligned .vLargeTextField, .colMS .aligned .vXMLLargeTextField { width:350px; }
+form .aligned p, form .aligned ul { margin-left:12em; padding-left:30px; }
+form .aligned table p { margin-left:0; padding-left:0; }
+form .aligned p.help { padding-left:38px; }
+.aligned .vCheckboxLabel { float:none !important; display:inline; padding-left:4px; }
+.colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField { width:610px; }
+.checkbox-row p.help { margin-left:0; padding-left:0 !important; }
+
+/* WIDE FIELDSETS */
+.wide label { width:15em !important; }
+form .wide p { margin-left:15em; }
+form .wide p.help { padding-left:38px; }
+.colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField { width:450px; }
+
+
+/* FORM LABELS */
+form h4 { margin:0 !important; padding:0 !important; border:none !important; }
+label { font-weight:normal !important; color:#666; font-size:12px; }
+label.inline { margin-left:20px; }
+.required label, label.required { font-weight:bold !important; color:#333 !important; }
+
+div.form-row {clear:both; margin:12px;}
+div.form-row p {margin:0;}
+
+fieldset {border:0px;}

File repos/forms.py

     password1 = forms.CharField(widget=forms.PasswordInput(attrs=required_dict),
                                 label=u'Password')
     password2 = forms.CharField(widget=forms.PasswordInput(attrs=required_dict),
-                                label=u'Password (again, to catch typos)')
+                                label=u'Password (again)')
     tos = forms.BooleanField(widget=forms.CheckboxInput(attrs=required_dict),
                         label=u'I have read and agree to the Terms of Service')
 

File templates/base.html

 </head>
 <body>
 
+<div id="header">
+<h1><a href="http://freehg.org">FreeHG.org</a></h1>
+
+{% if user.is_authenticated %}
+    You are logged in as <a href="/u/{{user.username}}">{{user.username}}</a>. (<a href="/logout/">Logout</a>)
+{% else %}
+    Not logged in.
+{% endif %}
+
+</div>
+
     {% if messages %}
-    <ul id="usermessages">
+    <ul class="messagelist" id="usermessages">
         {% for message in messages %}
         <li>{{ message }}</li>
         {% endfor %}
     </ul>
     {% endif %}
-    
+
 {% block content %}
 
 {% endblock %}
 
 </body>
-</html>
+</html>

File templates/frontpage.html

 
 {% block content %}
 
+<div id="frontform" style="margin:0 auto;width:780px;">
 <form action='.' method='POST'>
-<div>
-    <table>
-    {{ repo_form }}
-    </table>
-</div>
+<fieldset>
+{% for field in repo_form %}
+        <div class="form-row {%if field.field.required %}required{%endif%} {%if field.errors%}errors{%endif%}">
+            {% if field.errors %}{{field.errors}}{% endif %}
+            <p class=" aligned">{{field.label_tag}}{{field}}</p>
+        </div>
+{% endfor %}
+</fieldset>
+
 {% if user.is_authenticated %}
     <input type='submit' name='createrepo' value='Create repository for {{user.username}}' />
 {% else %}
     <div style="width:49%;float:left;">
     <fieldset>
-    <table>{{ login_form }}</table>
+    {% for field in login_form %}
+        <div class="form-row {%if field.field.required %}required{%endif%} {%if field.errors%}errors{%endif%}">
+            {% if field.errors %}{{field.errors}}{% endif %}
+            <p class=" aligned">{{field.label_tag}}{{field}}</p>
+        </div>
+    {% endfor %}
     <input type='submit' name='login' value='Login' />
     </fieldset>
     </div>
 
     <div style="width:49%;float:right;">
     <fieldset>
-    <table>
-    {{ new_account_form }}
-    </table>
+    {% for field in new_account_form %}
+        {% ifnotequal field.name "tos" %}
+            <div class="form-row {%if field.field.required %}required{%endif%} {%if field.errors%}errors{%endif%}">
+                {% if field.errors %}{{field.errors}}{% endif %}
+                <p class="aligned">{{field.label_tag}}{{field}}</p>
+            </div>
+        {% endifnotequal %}
+    {% endfor %}
+    <div class="form-row required">
+        {% if new_account_form.tos.errors %}{{new_account_form.tos.errors}}{% endif %}
+        <p>{{new_account_form.tos}}{{new_account_form.tos.label_tag}}</p>
+    </div>
     <input type='submit' name='newaccount'  value='Create new account' />
     </fieldset>
     </div>
 {% endif %}
 </form>
+</div>
 
 {% endblock %}

File templates/registration/logged_out.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %}Logged out{% endblock %}
+
+{% block content %}
+
+<p>You have been logged out. Thanks for using FreeHG.org :)</p>
+
+<p><a href="../">{% trans 'Back to the homepage.' %}</a></p>
+
+{% endblock %}

File templates/registration/password_change_done.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans 'Password change successful' %}{% endblock %}
+
+{% block content %}
+
+<h1>{% trans 'Password change successful' %}</h1>
+
+<p>{% trans 'Your password was changed.' %}</p>
+
+{% endblock %}

File templates/registration/password_change_form.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans 'Password change' %}{% endblock %}
+
+{% block content %}
+
+<h1>{% trans 'Password change' %}</h1>
+
+<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
+
+<form action="" method="post">
+
+{% if form.old_password.errors %}{{ form.old_password.html_error_list }}{% endif %}
+<p class="aligned wide"><label for="id_old_password">{% trans 'Old password:' %}</label>{{ form.old_password }}</p>
+{% if form.new_password1.errors %}{{ form.new_password1.html_error_list }}{% endif %}
+<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p>
+{% if form.new_password2.errors %}{{ form.new_password2.html_error_list }}{% endif %}
+<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p>
+
+<p><input type="submit" value="{% trans 'Change my password' %}" /></p>
+</form>
+
+{% endblock %}
     # Example:
     #(r'^freehg/', include('freehg.foo.urls')),
     (r'^$', 'freehg.repos.views.frontpage'),
+    (r'^logout/$', 'django.contrib.auth.views.logout'),
+    (r'^change_password/$', 'django.contrib.auth.views.password_change'),
+    (r'^change_password/done/$',
+            'django.contrib.auth.views.password_change_done'),
 
     # Uncomment this for admin:
     (r'^admin/', include('django.contrib.admin.urls')),