Commits

Anonymous committed f35776f Merge

Urf. Merging.

Comments (0)

Files changed (17)

projects/templates/form_as_table_rows.html

-{% load i18n %}
-{% load forms_template_style %}
-{% if form %}
-    {% for field in form %}
-    <tr>
-    <th>{{ field.label }}: {% if field.field.required %}<span class="required">*</span>{% endif %}</th>
-    <td>
-        <p class="fieldp">{{ field }}</p>
-        {% if field.errors %}<p class="fielderrors">{{ field.errors }}</p>{% endif %}
-    </td>
-    <td><p class="helptext">{{ field.help_text }}</p></td>
-    </tr>
-    {% endfor %}
-{% endif %}

simpleauth/urls.py

 from django.views.generic.simple import direct_to_template
 from django.contrib.auth import views as auth_views
 from django.utils.translation import ugettext as _
-from simpleauth.views import logout, account_settings
+from simpleauth.views import login, logout, account_settings
 
 urlpatterns = patterns('',
-    url(r'^signin/$',
-        auth_views.login,
-        {'template_name': 'simpleauth/signin.html',},
-        name='user_signin'),
+    url(r'^signin/$', login, name='user_signin'),
     url(r'^signout/$', logout, name='user_signout'),
     url(r'^$', account_settings, name='user_account_settings'),
 )

simpleauth/views.py

 from django.shortcuts import render_to_response
 from django.template import RequestContext
 from django.contrib.auth.decorators import login_required
-from django.contrib.auth.views import logout as auth_logout
+from django.contrib.auth.views import (logout as auth_logout,
+                                       login as auth_login)
 from simpleauth.util import clean_next
 
+
 @login_required
 def logout(request, template_name='simpleauth/logged_out.html'):
     """Logout the user from the website and redirect back."""
     auth_logout(request, next_page=next, template_name=template_name)
     return HttpResponseRedirect(next)
 
+
+def login(request, template_name='simpleauth/signin.html'):
+    """Login the user to the website and redirect back."""
+    next = clean_next(request.GET.get('next'))
+    return auth_login(request, template_name=template_name,
+                      redirect_field_name='next')
+
+
 @login_required
 def account_settings(request, template_name='simpleauth/settings.html'):
     """Account settings page."""

site_media/css/base.css

 
 div#login_index {
   color: #666;
-  margin-top: 20px;
-  margin-right: -10px;
   margin-right: -10px;
   background-color: #fff; /*#EBF2F8*/
   padding: 0.3em;
 }
 
 div#login_index p {
-  text-align: center;
   width: 100%;
   margin-bottom: 0px;
 }
 
+div#login_index p.login-tagline {
+  font-size: 95%;
+  margin: 0.5em 1em 1em 1em;
+  max-width: 20em;
+}
+
 div#login_index .lost_passwd {
   margin-top: 3px;
 }
   margin: 0;
 }
 
-div.generic_form ul.errorlist {
-  font-size: 75%;
+div.generic_form p.fielderrors {
+  font-size: 85%;
   color: #c27878;
   list-style: none;
   margin: 0.2em 0 0.3em 0.1em;
 }
 
 ul.errorlist li {
-  color: #e55;
+  color: #c27878;
 }
 
 .components .entry .description {color: #999}

site_media/css/icons.css

 .i16.submit { background-image: url('../images/icons/page_white_edit.png'); }
 .i16.tag { background-image: url('../images/icons/tag_blue.png'); }
 .i16.tip { background-image: url('../images/icons/lightbulb.png'); }
+.i16.user { background-image: url('../images/icons/user.png'); }
 .i16.view { background-image: url('../images/icons/page_magnify.png'); }

site_media/images/icons/user.png

Added
New image

templates/contact_form/contact_form.html

 {% extends "base.html" %}
 {% load i18n %}
-{% load forms_template_style %}
+{% load tx-common %}
 
 {% block title %}{{ block.super }} | {% trans "Contact us" %}{% endblock %}
 {% block breadcrumb %}{{ block.super }} &raquo; {% trans "Contact us" %}{% endblock %}

templates/projects/component_form.html

 {% extends "projects/base.html" %}
-{% load forms_template_style %}
 {% load i18n %}
+{% load tx-common %}
 
 {% block title %}
 {% if not component %}{{ block.super }} | {{ project.name }} | {% trans "Add a component" %}

templates/projects/project_form.html

 {% extends "projects/base.html" %}
-{% load forms_template_style %}
 {% load i18n %}
+{% load tx-common %}
 
 {% block title %}
   {% if not project %}{{ block.super }} | {% trans "Add a project" %}

templates/releases/release_form.html

 {% extends "releases/base.html" %}
 {% load i18n %}
-{% load forms_template_style %}
+{% load tx-common %}
 
 {% block title %}
   {% if not release %}{{ block.super }} | {% trans "Add a release" %}

templates/simpleauth/login_box.html

 {% load i18n %}
-   <fieldset>
-        <legend>{% trans "Sign in" %}</legend>
-        <div id="login-block">
-		      <p class="login-tagline">Add projects or modify existing ones. Wiki-style.</p>
-		      <form name="fauth" action="{% url user_signin %}?next={{request.path_info}}" method="post">
-		      {{ form1.next }}
-		              <div class="form-row"><label for="id_username">{% trans "Username:" %}</label> <input id="id_username" class="required login" name="username" maxlength="30" size="12" type="text"></div>
-		              <div class="form-row"><label for="id_password">{% trans "Password:" %}</label> <input id="id_password" class="required login" name="password" maxlength="128" size="12" type="password"></div>
-		      <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
-		      </form>
-        </div>
-        </fieldset>
+{% load tx-common %}
+
+<form name="fauth" action="{% url user_signin %}?next={{next}}" method="post">
+<div class="generic_form" id="login_index login-block">
+<fieldset>
+  <legend>{% trans "Sign in" %}</legend>
+  <p class="login-tagline i16 user">Login to add or modify projects, work on translations, and other stuff.</p>
+  {% if form_message %}
+    <p class="message i16 bell">{{ form_message }}</p>
+  {% endif %}
+  <table>
+    <tbody>
+      {% form_as_table_rows form %}
+    </tbody>
+  </table>
+  <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
+</div>
+</fieldset>
+</form>

templates/simpleauth/signin.html

 <br />
 	<p class="warning">{{ msg }}</p>
 {% endif %}
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form.username.errors %} 
-		<span class="error">{{ form.username.errors|join:", " }}</span>
-	{% endif %}
-	{% if form.password.errors %} 
-		<span class="error">{{ form.password.errors|join:", " }}</span>
-	{% endif %}
-</p>
+{% if form.non_field_errors %}
+<div id="form-error">
+  {{ form.non_field_errors }}
+</div>
 {% endif %}
 
 <div id="login_index">

templates/txcollections/collection_form.html

 {% extends "txcollections/base.html" %}
 {% load i18n %}
-{% load forms_template_style %}
+{% load tx-common %}
 
 {% block title %}
   {% if not collection %}{{ block.super }} | {% trans "Add a collection" %}

templates/txcollections/release_form.html

 {% extends "txcollections/base.html" %}
 {% load i18n %}
-{% load forms_template_style %}
+{% load tx-common %}
 
 {% block extra_head %}
   <script type="text/javascript" src="/admin/jsi18n/"></script>

transifex/templates/form_as_table_rows.html

+{% load i18n %}
+{% load tx-common %}
+{% if form %}
+    {% for field in form %}
+    <tr>
+    <th>{{ field.label }}: {% if field.field.required %}<span class="required">*</span>{% endif %}</th>
+    <td>
+        <p class="fieldp">{{ field }}</p>
+        {% if field.errors %}<p class="fielderrors">{% for error in field.errors %}{{ error }}{% endfor %}</p>{% endif %}
+    </td>
+    <td><p class="helptext">{{ field.help_text }}</p></td>
+    </tr>
+    {% endfor %}
+{% endif %}

transifex/templatetags/tx-common.py

     """Return the version of Transifex"""
     return transifex.version
 
+# Forms
+
+@register.inclusion_tag("form_as_table_rows.html")
+def form_as_table_rows(form):
+    """
+    Create a form using HTML table rows.
+    """
+    return {"form": form}
+
 
 # Email Munger by cootetom
 # http://www.djangosnippets.org/snippets/1284/

transifex/views.py

 from django.template import RequestContext
 from projects.models import Project
 from transifex.log import logger
+from django.contrib.auth.forms import AuthenticationForm
 
 def search(request):
     query_string = request.GET.get('q', "")
 def index(request):
     latest_projects = Project.objects.order_by('-created')[:5]
     return render_to_response("index.html",
-        {'latest_projects': latest_projects}, 
+        {'latest_projects': latest_projects,
+         'form': AuthenticationForm(),
+         'next': request.path},
           context_instance = RequestContext(request))