Browse Source

Declutter /admin/accounts/profile/

pull/405/head
Pēteris Caune 4 years ago
parent
commit
f814035f03
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 11 additions and 19 deletions
  1. +7
    -6
      hc/accounts/admin.py
  2. +4
    -13
      static/css/admin/profiles.css

+ 7
- 6
hc/accounts/admin.py View File

@ -100,10 +100,10 @@ class ProfileAdmin(admin.ModelAdmin):
list_display = ( list_display = (
"id", "id",
"email", "email",
"checks",
"date_joined", "date_joined",
"last_active_date", "last_active_date",
"projects", "projects",
"checks",
"invited", "invited",
"sms", "sms",
"reports_allowed", "reports_allowed",
@ -130,10 +130,7 @@ class ProfileAdmin(admin.ModelAdmin):
def email(self, obj): def email(self, obj):
s = escape(obj.user.email) s = escape(obj.user.email)
if obj.plan: if obj.plan:
s = "<span title='%s'>%s</span>" % (obj.plan, s)
v = min(30, obj.num_checks) * 8
s += """<div class="nchecks"><div style="width: %dpx"></div>""" % v
s = "%s <span>%s</span>" % (s, obj.plan)
return s return s
@ -144,8 +141,12 @@ class ProfileAdmin(admin.ModelAdmin):
def projects(self, obj): def projects(self, obj):
return render_to_string("admin/profile_list_projects.html", {"profile": obj}) return render_to_string("admin/profile_list_projects.html", {"profile": obj})
@mark_safe
def checks(self, obj): def checks(self, obj):
return "%d of %d" % (obj.num_checks, obj.check_limit)
s = "%d of %d" % (obj.num_checks, obj.check_limit)
if obj.num_checks > 10:
s = "<b>%s</b>" % s
return s
def invited(self, obj): def invited(self, obj):
return "%d of %d" % (obj.num_members, obj.team_limit) return "%d of %d" % (obj.num_members, obj.team_limit)


+ 4
- 13
static/css/admin/profiles.css View File

@ -9,17 +9,8 @@
} }
td.field-email span { td.field-email span {
border-bottom: 2px solid #FFEB3B;
color: #555;
background: #EEE;
padding: 1px 4px;
border-radius: 2px;
} }
.nchecks {
margin-top: 4px;
width: 240px;
height: 7px;
background-image: url(data:image/gif;base64,R0lGODlh8AABAKECAN3d3e7u7v///////yH5BAEKAAMALAAAAADwAAEAAAImhA+Cp5v+XFsTVQav0ZHmL4FeSFLBiQZCiq6s+sKvy9Kp3cb4KRQAOw==);
}
.nchecks div {
background-image: url(data:image/gif;base64,R0lGODlhCAABAKEBAHmuyP///////////yH5BAEKAAIALAAAAAAIAAEAAAIDhA9RADs=);
height: 7px;
}

Loading…
Cancel
Save