diff --git a/organizations/migrations/0008_auto_20190222_1120.py b/organizations/migrations/0008_auto_20190222_1120.py new file mode 100644 index 0000000000000000000000000000000000000000..afbad95fbed4dfdb1df9346da9fd0c3db7ed5b4d --- /dev/null +++ b/organizations/migrations/0008_auto_20190222_1120.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2019-02-22 10:20 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organizations', '0007_auto_20190221_0553'), + ] + + operations = [ + migrations.AlterModelOptions( + name='contact', + options={'ordering': ['user__last_name', 'user__first_name']}, + ), + ] diff --git a/organizations/models.py b/organizations/models.py index e2d94df096d961481497ac8f50f5938aab74d399..96f4ea39f23644eb70968a7b0305a4798dc92e11 100644 --- a/organizations/models.py +++ b/organizations/models.py @@ -240,6 +240,9 @@ class Contact(models.Model): activation_key = models.CharField(max_length=40, blank=True) key_expires = models.DateTimeField(default=timezone.now) + class Meta: + ordering = ['user__last_name', 'user__first_name'] + def __str__(self): return '%s %s, %s' % (self.get_title_display(), self.user.last_name, self.user.first_name) diff --git a/organizations/templates/organizations/dashboard.html b/organizations/templates/organizations/dashboard.html index 9f21e889651dc3d4b9177dc70a8b67df1b49f4ed..d6e1b853832705d3a9df917ae8b33988f5cc3163 100644 --- a/organizations/templates/organizations/dashboard.html +++ b/organizations/templates/organizations/dashboard.html @@ -36,6 +36,9 @@ $(document).ready(function($) { <li class="nav-item btn btn-outline-secondary"> <a href="#subsidies" class="nav-link" data-toggle="tab">Subsidies from your Orgs</a> </li> + <li class="nav-item btn btn-outline-secondary"> + <a href="#board" class="nav-link" data-toggle="tab">Sponsors Board</a> + </li> </ul> </div> </div> @@ -145,6 +148,53 @@ $(document).ready(function($) { </div> </div> + <div class="tab-pane" id="board" role="tabpanel"> + <div class="row"> + <div class="col-12"> + <h2 class="highlight">Sponsors Board</h2> + </div> + </div> + <div class="row"> + <div class="col-12"> + <p>The Sponsors Board is composed of all registered Organization Contacts.</p> + + <h3>Active Contacts</h3> + <table class="table"> + <thead class="thead-default"> + <tr> + <th>Name</th> + <th>Organization(s) / role(s)</th> + {% if perms.scipost.can_manage_organizations %} + <th>Account<br/>active?</th> + {% endif %} + </tr> + </thead> + <tbody> + {% for contact in contacts %} + <tr> + <td>{{ contact }}</td> + <td> + <ul class="list-group list-group-flush"> + {% for role in contact.roles.all %} + <li class="list-group-item">{{ role.organization }} / {{ role.get_kind_display }}</li> + {% empty %} + <li class="list-group-item">No Organization found</li> + {% endfor %} + </ul> + </td> + {% if perms.scipost.can_manage_organizations %} + <td>{% if contact.user.is_active %}<i class="fa fa-check-circle text-success"></i>{% else %}<i class="fa fa-times-circle text-danger"></i>{% endif %}</td> + {% endif %} + </tr> + {% empty %} + <tr><td>No contact found</td></tr> + {% endfor %} + </tbody> + </table> + </div> + </div> + </div> + </div> {% endblock content %} diff --git a/organizations/views.py b/organizations/views.py index d0e7e507d8dc169b90aaf193a97e06efaab22bbc..e2412aa6205c174e83f805b7d7be62eb25d55917 100644 --- a/organizations/views.py +++ b/organizations/views.py @@ -232,7 +232,8 @@ def dashboard(request): raise PermissionDenied context = { - 'own_roles': request.user.org_contact.roles.all() + 'own_roles': request.user.org_contact.roles.all(), + 'contacts': Contact.objects.all() } return render(request, 'organizations/dashboard.html', context)