Commit ee3f6cf1 authored by jocelyn's avatar jocelyn

UI tweaks for mail-list management

1. Hide noisy redundant titles on top of each inline (admin-wide change)
2. Hide confusing « add » and « edit » buttons in mail-list subscribers add
  form
3. Allow to add several subscriptions at once
4. Use different labels depending on which side we are using admin
  inlines (list or member ?)
5. Member view: display currently subscriptions before add form
parent 3d9ac92a
/* Remove the titles from inlines elements
Generaly, this is redundant, with fields content */
form .inline-group .inline-related td.original p, /* TabularInline */
form .inline-group .inline-related h3 { /* TabularStacked */
display: none;
}
.inline-group .tabular tr.has_original td {
padding-top: 5px;
}
/* Remove « Add » and « Edit » icons near member search in mailling list members management
*/
.inline-related.dynamic-maillinglistsubscription_set .related-widget-wrapper-link.change-related ,
.inline-related.dynamic-maillinglistsubscription_set .related-widget-wrapper-link.add-related {
display: none;
}
......@@ -5,6 +5,7 @@
{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{% static 'hijack/hijack-styles.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/admin-local.css' %}" />
<script src="{% static "js/vendor/jquery.js" %}" type="text/javascript"></script>
<link rel="stylesheet" href="{% static "css/font-awesome.min.css"%}" />
{% include 'autocomplete_light/static.html' %}
......
......@@ -14,11 +14,10 @@ import coin.members.admin
class AddMaillingListSubscriptionInline(admin.StackedInline):
model = MaillingListSubscription
extra = 1
max_num = 1
extra = 0
fields = ('member', 'maillinglist')
verbose_name_plural = "Ajouter un abonnement à la liste mail"
verbose_name = "Ajouter un abonnement"
verbose_name_plural = "Ajouter un abonnement à une liste mail"
verbose_name = "abonnement"
form = autocomplete_light.modelform_factory(MaillingListSubscription, fields='__all__')
......@@ -30,6 +29,11 @@ class AddMaillingListSubscriptionInline(admin.StackedInline):
return False
class AddSubscriberInline(AddMaillingListSubscriptionInline):
verbose_name_plural = "Ajouter des abonné·e·s"
verbose_name = "abonné·e"
class MaillingListSubscriptionInline(admin.TabularInline):
model = MaillingListSubscription
......@@ -39,6 +43,11 @@ class MaillingListSubscriptionInline(admin.TabularInline):
return False
class SubscribersInline(MaillingListSubscriptionInline):
verbose_name_plural = "Abonné·e·s"
verbose_name = "abonné·e"
class MaillingListAdmin(admin.ModelAdmin):
list_display = ('email', 'verbose_name')
actions = ['sync_to_server']
......@@ -60,7 +69,7 @@ class MaillingListAdmin(admin.ModelAdmin):
sync_to_server.short_description = (
'Synchroniser les listes sélectionnées vers le serveur')
inlines = [AddMaillingListSubscriptionInline, MaillingListSubscriptionInline,]
inlines = [AddSubscriberInline, SubscribersInline]
def change_view(self, request, object_id, *args, **kwargs):
try:
......@@ -83,7 +92,10 @@ admin.site.register(MaillingList, MaillingListAdmin)
class MemberAdmin(coin.members.admin.MemberAdmin):
inlines = coin.members.admin.MemberAdmin.inlines + [AddMaillingListSubscriptionInline, MaillingListSubscriptionInline]
inlines = coin.members.admin.MemberAdmin.inlines + [
MaillingListSubscriptionInline,
AddMaillingListSubscriptionInline,
]
def change_view(self, request, *args, **kwargs):
try:
......
......@@ -21,7 +21,7 @@ class MaillingListSubscription(models.Model):
class Meta:
verbose_name = 'abonnement à une liste mail'
verbose_name_plural = 'abonnements à des listes mail'
verbose_name_plural = 'abonnements aux listes mail'
unique_together = ('member', 'maillinglist')
def __str__(self):
......@@ -32,7 +32,7 @@ class MaillingList(models.Model):
'identifiant technique', max_length=50,
help_text=(
"c'est l'identifiant qui servira à "
"communiquer avec le système de mailling-list"
"communiquer avec le serveur de liste mail "
"(typiquement, la partie avant le \"@\" dans l'adress )"
)
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment