mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
@@ -1,123 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
type="text/javascript"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{% url 'people:person.list' %}">People</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ object }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<h1>{{ person.name }}</h1>
|
||||
|
||||
<hr>
|
||||
|
||||
{% if person.user == request.user or request.user.is_superuser %}
|
||||
{% if person.user != request.user and request.user.is_superuser %}
|
||||
<div class="alert alert-warning">
|
||||
<strong>NB:</strong> You are able to see the details of this person because you are an admin.
|
||||
Regular users are not able to see this information for people other than themselves.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% include 'people/person/includes/answer_set.html' %}
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:person.update' pk=person.pk %}">Update</a>
|
||||
|
||||
{% if person.user == request.user %}
|
||||
<a class="btn btn-info"
|
||||
href="{% url 'password_change' %}?next={{ person.get_absolute_url }}">Change Password</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="map" style="height: 800px; width: 100%"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>People I've Answered Questions About</h2>
|
||||
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Contact Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for relationship in person.relationships_as_source.all %}
|
||||
<tr>
|
||||
<td>{{ relationship.target }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'people:person.detail' pk=relationship.target.pk %}">Profile</a>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'people:relationship.detail' pk=relationship.pk %}">Relationship Detail</a>
|
||||
{% if person.user == request.user or request.user.is_superuser %}
|
||||
<a class="btn btn-sm btn-success"
|
||||
href="{% url 'people:relationship.update' relationship_pk=relationship.pk %}">Update</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="2">No known relationships</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">New Relationship
|
||||
</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>Activities</h2>
|
||||
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for activity in person.activities.all %}
|
||||
<tr>
|
||||
<td>{{ activity }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'activities:activity.detail' pk=activity.pk %}">Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td>No records</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
{% endblock %}
|
||||
59
people/templates/people/person/detail_full.html
Normal file
59
people/templates/people/person/detail_full.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
type="text/javascript"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{% url 'people:person.list' %}">People</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ object }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<h1>{{ person.name }}</h1>
|
||||
|
||||
<hr>
|
||||
|
||||
{% if person.user != request.user and request.user.is_superuser %}
|
||||
<div class="alert alert-warning">
|
||||
<strong>NB:</strong> You are able to see the details of this person because you are an admin.
|
||||
Regular users are not able to see this information for people other than themselves.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% include 'people/person/includes/answer_set_full.html' %}
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:person.update' pk=person.pk %}">Update</a>
|
||||
|
||||
{% if person.user == request.user %}
|
||||
<a class="btn btn-info"
|
||||
href="{% url 'password_change' %}?next={{ person.get_absolute_url }}">Change Password</a>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="map" style="height: 800px; width: 100%"></div>
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'people/person/includes/relationships_full.html' %}
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'people/person/includes/activities_full.html' %}
|
||||
|
||||
<hr>
|
||||
|
||||
{% endblock %}
|
||||
35
people/templates/people/person/detail_partial.html
Normal file
35
people/templates/people/person/detail_partial.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ map_markers|json_script:'map-markers' }}
|
||||
|
||||
{% load staticfiles %}
|
||||
<script src="{% static 'js/map.js' %}"></script>
|
||||
|
||||
<script async defer src="https://maps.googleapis.com/maps/api/js?key={{ settings.GOOGLE_MAPS_API_KEY }}&callback=initMap"
|
||||
type="text/javascript"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="{% url 'people:person.list' %}">People</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ object }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<h1>{{ person.name }}</h1>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
{% include 'people/person/includes/answer_set_partial.html' %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="map" style="height: 800px; width: 100%"></div>
|
||||
|
||||
<hr>
|
||||
{% endblock %}
|
||||
26
people/templates/people/person/includes/activities_full.html
Normal file
26
people/templates/people/person/includes/activities_full.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<h2>Activities</h2>
|
||||
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for activity in person.activities.all %}
|
||||
<tr>
|
||||
<td>{{ activity }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'activities:activity.detail' pk=activity.pk %}">Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td>No records</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,32 @@
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Question</th>
|
||||
<th>Answer</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% if answer_set.country_of_residence %}
|
||||
<tr><td>Country of Residence</td><td>{{ answer_set.country_of_residence.name }}</td></tr>
|
||||
{% endif %}
|
||||
|
||||
{% if answer_set.organisation %}
|
||||
<tr><td>Organisation</td><td>{{ answer_set.organisation }}</td></tr>
|
||||
{% endif %}
|
||||
|
||||
{% for answer in answer_set.question_answers.all %}
|
||||
<tr>
|
||||
<td>{{ answer.question }}</td>
|
||||
<td>{{ answer }}</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td>No records</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Last updated: {{ answer_set.timestamp }}</p>
|
||||
@@ -0,0 +1,36 @@
|
||||
<h2>People I've Answered Questions About</h2>
|
||||
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Contact Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for relationship in person.relationships_as_source.all %}
|
||||
<tr>
|
||||
<td>{{ relationship.target }}</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'people:person.detail' pk=relationship.target.pk %}">Profile</a>
|
||||
<a class="btn btn-sm btn-info"
|
||||
href="{% url 'people:relationship.detail' pk=relationship.pk %}">Relationship Detail</a>
|
||||
<a class="btn btn-sm btn-success"
|
||||
href="{% url 'people:relationship.update' relationship_pk=relationship.pk %}">Update</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="2">No known relationships</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">New Relationship
|
||||
</a>
|
||||
@@ -37,12 +37,18 @@ class PersonListView(LoginRequiredMixin, ListView):
|
||||
template_name = 'people/person/list.html'
|
||||
|
||||
|
||||
class ProfileView(permissions.UserIsLinkedPersonMixin, DetailView):
|
||||
class ProfileView(LoginRequiredMixin, DetailView):
|
||||
"""
|
||||
View displaying the profile of a :class:`Person` - who may be a user.
|
||||
"""
|
||||
model = models.Person
|
||||
template_name = 'people/person/detail.html'
|
||||
|
||||
def get_template_names(self) -> typing.List[str]:
|
||||
"""Return template depending on level of access."""
|
||||
if (self.object.user == self.request.user): # or self.request.user.is_superuser:
|
||||
return ['people/person/detail_full.html']
|
||||
|
||||
return ['people/person/detail_partial.html']
|
||||
|
||||
def get_object(self, queryset=None) -> models.Person:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user