diff --git a/organizations/templates/organizations/dashboard.html b/organizations/templates/organizations/dashboard.html index 6329939393153cfecf00fb6b34a6ee30984f5ae1..3b9e319fab8a3b9f0269852d953541814b2f8d38 100644 --- a/organizations/templates/organizations/dashboard.html +++ b/organizations/templates/organizations/dashboard.html @@ -17,9 +17,13 @@ $(document).ready(function($) { {% block content %} <div class="row"> - <div class="col-12"> - <h1 class="highlight">Welcome to your Organizations dashboard, {{ request.user.org_contact.get_title_display }} {{ request.user.last_name }}</h1> - </div> + <div class="col-12"> + {% if request.user.org_contact %} + <h1 class="highlight">Welcome to your Organizations dashboard, {{ request.user.org_contact.get_title_display }} {{ request.user.last_name }}</h1> + {% elif perms.scipost.can_manage_organizations %} + <h1 class="highlight">Organizations dashboard</h1> + {% endif %} + </div> </div> <div class="row"> @@ -27,6 +31,7 @@ $(document).ready(function($) { <div class="tab-nav-container"> <div class="tab-nav-inner"> <ul class="nav btn-group personal-page-nav" role="tablist"> + {% if request.user.org_contact %} <li class="nav-item btn btn-outline-secondary"> <a href="#account" class="nav-link" data-toggle="tab">Account</a> </li> @@ -36,6 +41,7 @@ $(document).ready(function($) { <li class="nav-item btn btn-outline-secondary"> <a href="#subsidies" class="nav-link" data-toggle="tab">Subsidies<br/>from your Orgs</a> </li> + {% endif %} <li class="nav-item btn btn-outline-secondary"> <a href="#board" class="nav-link" data-toggle="tab">Sponsors<br/>Board</a> </li> @@ -67,7 +73,7 @@ $(document).ready(function($) { </div> </div> - <div class="tab-pane active" id="own_roles" role="tabpanel"> + <div class="tab-pane{% if request.user.org_contact %} active{% endif %}" id="own_roles" role="tabpanel"> <div class="row"> <div class="col-12"> <h2 class="highlight">Your Organizations-related roles</h2> @@ -176,7 +182,7 @@ $(document).ready(function($) { <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> + <li class="list-group-item"><a href="{{ role.organization.get_absolute_url }}" target="_blank">{{ role.organization }}</a> / {{ role.get_kind_display }}</li> {% empty %} <li class="list-group-item">No Organization found</li> {% endfor %} diff --git a/organizations/templates/organizations/organization_list.html b/organizations/templates/organizations/organization_list.html index 25dd34e50a5ceb4a4317c099be6f9699cc647ba3..f3184b454a175a10a37c2d817c567315c3463503 100644 --- a/organizations/templates/organizations/organization_list.html +++ b/organizations/templates/organizations/organization_list.html @@ -32,6 +32,7 @@ $(document).ready(function($) { {% if perms.scipost.can_manage_organizations %} <h3>Management actions:</h3> <ul> + <li><a href="{% url 'organizations:dashboard' %}">Go to the dashboard</a></li> <li><a href="{% url 'organizations:organization_create' %}">Create a new Organization instance</a></li> <li><a href="{% url 'funders:funders_dashboard' %}">Link Funders to Organizations</a> ({{ nr_funders_wo_organization }} found in need of linking)</li> <li><a href="{% url 'partners:prospartner_link_organization' %}">Link ProspectivePartners to Organizations</a> ({{ nr_prospartners_wo_organization }} found in need of linking)</li> diff --git a/organizations/views.py b/organizations/views.py index 01b3942c577517e2f36f6aa870a12dd7ebb703b7..458079ae7d607b63b6d5a43aab8705e65a920577 100644 --- a/organizations/views.py +++ b/organizations/views.py @@ -236,12 +236,11 @@ def dashboard(request): if not (request.user.has_perm('scipost.can_manage_organizations') or has_contact(request.user)): raise PermissionDenied - context = { - 'own_roles': request.user.org_contact.roles.all(), 'contacts': Contact.objects.all() } - + if has_contact(request.user): + context['own_roles'] = request.user.org_contact.roles.all() return render(request, 'organizations/dashboard.html', context)