[damned-lies] Add more editable details for teams



commit e98e9c98724ed982648fefd98d03f3be738b754a
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Feb 13 21:07:46 2010 +0100

    Add more editable details for teams
    
    Two more fields are editable for teams:
    * presentation is a free text field (markdown syntax) for team
    coordinators to add information about their team, displayed on
    the top of the team page.
    * use_workflow is a flag that allows teams to specify whether they
    use the Damned Lies Vertimus workflow. If False, the Actions widgets
    are not displayed on the Vertimus templates.

 README                                     |    8 ++-
 media/css/layout.css                       |    5 ++
 settings_sample.py                         |    1 +
 teams/admin.py                             |    7 ++
 teams/forms.py                             |    3 +-
 teams/migrations/0002_workflow_and_pres.py |   95 ++++++++++++++++++++++++++++
 teams/models.py                            |    2 +
 templates/teams/team_base.html             |    4 +-
 templates/teams/team_detail.html           |    2 +
 templates/teams/team_edit.html             |   21 +++++-
 templates/vertimus/vertimus_detail.html    |    2 +
 11 files changed, 141 insertions(+), 9 deletions(-)
---
diff --git a/README b/README
index f3102f9..5657e48 100644
--- a/README
+++ b/README
@@ -29,14 +29,16 @@ Requirements
 
     See http://south.aeracode.org/wiki/Download for installation instructions
 
-5 - [Optional] Django Debug Toolbar
+5 - Markdown (python-markdown) for Team presentation markup rendering
+
+6 - [Optional] Django Debug Toolbar
     git clone git://github.com/dcramer/django-debug-toolbar.git
     Define USE_DEBUG_TOOLBAR to True in settings.py to use it.
 
-6 - [Optional] python-openid and django-openid (see OpenID support
+7 - [Optional] python-openid and django-openid (see OpenID support
     below).
 
-7 - [Optional] python-pyicu for correct sorting in various languages
+8 - [Optional] python-pyicu for correct sorting in various languages
 
 Installation
 ============
diff --git a/media/css/layout.css b/media/css/layout.css
index b2e7c82..495cbfb 100644
--- a/media/css/layout.css
+++ b/media/css/layout.css
@@ -423,3 +423,8 @@ div#content {
 ul.foot li {
    list-style-image: url(../img/foot-16.png);
 }
+
+ul.smallspacing {
+   margin-top: 0.2em;
+   margin-bottom: 0.2em;
+}
diff --git a/settings_sample.py b/settings_sample.py
index 3d37156..5e59fd3 100644
--- a/settings_sample.py
+++ b/settings_sample.py
@@ -123,6 +123,7 @@ INSTALLED_APPS = (
     'django.contrib.sites',
     'django.contrib.admin',
     'django.contrib.humanize',
+    'django.contrib.markup',
 #    'django_openid',
     'south',
     'common',
diff --git a/teams/admin.py b/teams/admin.py
index c5be032..f7d1d21 100644
--- a/teams/admin.py
+++ b/teams/admin.py
@@ -1,8 +1,15 @@
 from django.contrib import admin
 from teams.models import Team, Role
+from languages.models import Language
+
+class LanguageInline(admin.TabularInline):
+    model = Language
+    # Languages are not supposed to be created in this form
+    extra = 0
 
 class TeamAdmin(admin.ModelAdmin):
     search_fields = ('name',)
+    inlines = [ LanguageInline ]
 
     def formfield_for_dbfield(self, db_field, **kwargs):
         # Reduced text area for aliases
diff --git a/teams/forms.py b/teams/forms.py
index d0092f5..3b2926b 100644
--- a/teams/forms.py
+++ b/teams/forms.py
@@ -4,12 +4,13 @@ from teams.models import Team, ROLE_CHOICES
 class EditTeamDetailsForm(forms.ModelForm):
     class Meta:
         model = Team
-        fields = ('webpage_url', 'mailing_list', 'mailing_list_subscribe')
+        fields = ('webpage_url', 'mailing_list', 'mailing_list_subscribe', 'use_workflow', 'presentation')
 
     def __init__(self, *args, **kwargs):
         super(EditTeamDetailsForm, self).__init__(*args, **kwargs)
         for f in ('webpage_url', 'mailing_list', 'mailing_list_subscribe'):
             self.fields[f].widget.attrs['size'] = 60
+        self.fields['presentation'].widget.attrs["cols"] = 60
 
 class EditMemberRoleForm(forms.Form):
 
diff --git a/teams/migrations/0002_workflow_and_pres.py b/teams/migrations/0002_workflow_and_pres.py
new file mode 100644
index 0000000..0b7c4e7
--- /dev/null
+++ b/teams/migrations/0002_workflow_and_pres.py
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+
+from south.db import db
+from django.db import models
+from teams.models import *
+
+class Migration:
+    
+    def forwards(self, orm):
+        
+        # Adding field 'Team.presentation'
+        db.add_column('team', 'presentation', orm['teams.team:presentation'])
+        
+        # Adding field 'Team.use_workflow'
+        db.add_column('team', 'use_workflow', orm['teams.team:use_workflow'])
+        
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting field 'Team.presentation'
+        db.delete_column('team', 'presentation')
+        
+        # Deleting field 'Team.use_workflow'
+        db.delete_column('team', 'use_workflow')
+        
+    
+    
+    models = {
+        'auth.group': {
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'unique_together': "(('content_type', 'codename'),)"},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'unique_together': "(('app_label', 'model'),)", 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'people.person': {
+            'Meta': {'db_table': "'person'"},
+            'activation_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
+            'bugzilla_account': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+            'image': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'irc_nick': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '20', 'null': 'True', 'blank': 'True'}),
+            'svn_account': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '20', 'null': 'True', 'blank': 'True'}),
+            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
+            'webpage_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+        },
+        'teams.role': {
+            'Meta': {'unique_together': "(('team', 'person'),)", 'db_table': "'role'"},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['people.Person']"}),
+            'role': ('django.db.models.fields.CharField', [], {'default': "'translator'", 'max_length': '15'}),
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"})
+        },
+        'teams.team': {
+            'Meta': {'db_table': "'team'"},
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'mailing_list': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+            'mailing_list_subscribe': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'members': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['people.Person']"}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'presentation': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'use_workflow': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'webpage_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+        }
+    }
+    
+    complete_apps = ['teams']
diff --git a/teams/models.py b/teams/models.py
index 1b9e43d..a055866 100644
--- a/teams/models.py
+++ b/teams/models.py
@@ -85,6 +85,8 @@ class Team(models.Model):
 
     name = models.CharField(max_length=80)
     description = models.TextField()
+    use_workflow = models.BooleanField(default=True)
+    presentation = models.TextField(blank=True, verbose_name=_("Presentation"))
     members = models.ManyToManyField(Person, through='Role', related_name='teams')
     webpage_url = models.URLField(null=True, blank=True, verbose_name=_("Web page"))
     mailing_list = models.EmailField(null=True, blank=True, verbose_name=_("Mailing list"))
diff --git a/templates/teams/team_base.html b/templates/teams/team_base.html
index 6384b8d..c6412b0 100644
--- a/templates/teams/team_base.html
+++ b/templates/teams/team_base.html
@@ -16,14 +16,14 @@
   {% endif %}
 
   <br/><strong>{% trans "Bugzilla:" %}</strong>
-  <ul>
+  <ul class="smallspacing">
     <li><a href="{{ language.bugs_url_enter|safe }}">{% trans "Report Bug in Translation" %}</a></li>
     <li><a href="{{ language.bugs_url_show|safe }}">{% trans "Show Existing Bugs" %}</a></li>
   </ul>
 
   {% if team.mailing_list %}
   <br/><strong>{% trans "Mailing List:" %}</strong>
-  <ul>
+  <ul class="smallspacing">
     <li><a href="mailto:{{ team.mailing_list }}">{% trans "Send e-mail to the list" %}</a></li>
     {% if team.mailing_list_subscribe %}
     <li><a href="{{ team.mailing_list_subscribe }}">{% trans "Subscribe" %}</a></li>
diff --git a/templates/teams/team_detail.html b/templates/teams/team_detail.html
index ec35962..2430a3b 100644
--- a/templates/teams/team_detail.html
+++ b/templates/teams/team_detail.html
@@ -1,6 +1,7 @@
 {% extends "base.html" %}
 {% load i18n %}
 {% load stats_extras %}
+{% load markup %}
 {% block extrahead %}
 <link rel="alternate" type="application/rss+xml"
       title="{% blocktrans with team.get_description as lang %}Last actions made by the {{ lang }} team of the GNOME Translation Project{% endblocktrans %}"
@@ -37,6 +38,7 @@ $(document).ready(function() {
 
 {% if not team.fake %}
   <h1>{% blocktrans with team.get_description as lang %}{{ lang }} Translation Team{% endblocktrans %}</h1>
+  {% if team.presentation %}<p>{{ team.presentation|markdown }}</p>{% endif %}
 
   {% with team.get_languages.0 as language %}
   {% include "teams/team_base.html" %}
diff --git a/templates/teams/team_edit.html b/templates/teams/team_edit.html
index 0436082..bd15208 100644
--- a/templates/teams/team_edit.html
+++ b/templates/teams/team_edit.html
@@ -2,14 +2,29 @@
 {% load i18n %}
 {% block title %}{{ team.get_description }}{% endblock %}
 
+{% block extrahead %}
+<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.growfield2.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+    $("#id_presentation").growfield();
+});
+</script>
+{% endblock %}
+
 {% block content %}
 <div class="mainpage">
-<h1>{{ team.get_description }}</h1>
+<h1>{% blocktrans with team.get_description as lang %}{{ lang }} Translation Team{% endblocktrans %}</h1>
 
 <form action="#" method="POST">
 <table>
-{{ form.as_table }}
-<tr><td colspan="2" align="right"><input type="submit" value="{% trans 'Save' %}"/></td></tr>
+  <tr><th>{{ form.webpage_url.label }}:</th><td>{{ form.webpage_url }}</td></tr>
+  <tr><th>{{ form.mailing_list.label }}:</th><td>{{ form.mailing_list }}</td></tr>
+  <tr><th>{{ form.mailing_list_subscribe.label }}:</th><td>{{ form.mailing_list_subscribe }}</td></tr>
+  <tr><th></th><td>{{ form.use_workflow }} <label for="id_use_workflow">{% trans "This team is using the Vertimus translation workflow" %}</label>
+  <tr><th valign="top"><span class="help">&nbsp;</span><br />{{ form.presentation.label }}:</th>
+      <td><span class="help">{% trans "This content may use <a href='http://en.wikipedia.org/wiki/Markdown'>Markdown</a> syntax</a>" %}<br />
+          {{ form.presentation }}</td></tr>
+  <tr><td colspan="2" align="right"><input type="submit" value="{% trans 'Save' %}"/></td></tr>
 </table>
 </form>
 
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 3493607..7f7ebfc 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -99,6 +99,7 @@ $(document).ready(function() {
 </div>
 {% endif %}
 
+{% if language.team.use_workflow %}
 <div id="vertimus_actions_title">
   <h2>
     {% ifequal level 0 %}
@@ -186,5 +187,6 @@ $(document).ready(function() {
   {% blocktrans with language.team.get_description as team_name %}You need to be authenticated and to be member of the {{ team_name }} team.{% endblocktrans %}
   {% endif %}
 {% endifequal %}
+{% endif %}
 
 {% endblock %}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]