tweak ui
authorOlivier Larchevêque <olivier.larcheveque@auf.org>
Mon, 9 Jan 2012 16:05:42 +0000 (11:05 -0500)
committerOlivier Larchevêque <olivier.larcheveque@auf.org>
Mon, 9 Jan 2012 16:05:42 +0000 (11:05 -0500)
project/rh/lib.py
project/rh/templates/admin/rh/employe/change_list.html [new file with mode: 0644]
project/templates/alphafilter/alphafilter_styles.html [new file with mode: 0644]

index 7fb7a85..c955f0a 100644 (file)
@@ -362,6 +362,7 @@ class EmployeAdminForm(forms.ModelForm):
 
 class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
     alphabet_filter = 'nom'
+    DEFAULT_ALPHABET = u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
     search_fields = ('id', 'nom', 'prenom', 'nom_affichage', )
     ordering = ('nom', )
     actions = ('desactiver', )
@@ -417,7 +418,7 @@ class EmployeAdmin(AUFMetadataAdminMixin, ProtectRegionMixin, admin.ModelAdmin):
 
     def queryset(self, request):
         qs = super(EmployeAdmin, self).queryset(request) 
-        return qs.filter(actif=True).select_related(depth=1)
+        return qs.filter(actif=True).select_related(depth=1).order_by('nom')
 
     def save_formset(self, request, form, formset, change):
         instances = formset.save(commit=False)
diff --git a/project/rh/templates/admin/rh/employe/change_list.html b/project/rh/templates/admin/rh/employe/change_list.html
new file mode 100644 (file)
index 0000000..1974174
--- /dev/null
@@ -0,0 +1 @@
+{% extends "alphafilter/change_list.html" %}
diff --git a/project/templates/alphafilter/alphafilter_styles.html b/project/templates/alphafilter/alphafilter_styles.html
new file mode 100644 (file)
index 0000000..c4e1591
--- /dev/null
@@ -0,0 +1,21 @@
+<style type="text/css" media="screen">
+ul.alphabetfilter {
+       list-style: none;
+       display: inline;
+}
+ul.alphabetfilter li,
+.change-list ul.alphabetfilter li {
+       width: 0.7em;
+       display: inline;
+}
+ul.alphabetfilter li.first,
+.change-list ul.alphabetfilter li.first {
+       width: 2em;
+}
+.inactive {
+       color: #999;
+}
+.selected {
+       color: red;
+}
+</style>