diff --git a/breccia_mapper/templates/index.html b/breccia_mapper/templates/index.html index 8f6c0c4..2044dde 100644 --- a/breccia_mapper/templates/index.html +++ b/breccia_mapper/templates/index.html @@ -63,7 +63,7 @@ {% endblock %} {% block content %} -
+

About {{ settings.PROJECT_LONG_NAME }}

diff --git a/people/templates/people/person/detail.html b/people/templates/people/person/detail.html deleted file mode 100644 index a9ee268..0000000 --- a/people/templates/people/person/detail.html +++ /dev/null @@ -1,123 +0,0 @@ -{% extends 'base.html' %} - -{% block extra_head %} - {{ map_markers|json_script:'map-markers' }} - - {% load staticfiles %} - - - -{% endblock %} - -{% block content %} - - -

{{ person.name }}

- -
- - {% if person.user == request.user or request.user.is_superuser %} - {% if person.user != request.user and request.user.is_superuser %} -
- NB: 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. -
- {% endif %} - - - {% include 'people/person/includes/answer_set.html' %} - - Update - - {% if person.user == request.user %} - Change Password - {% endif %} - {% endif %} - -
- -
- -
- -

People I've Answered Questions About

- - - - - - - - - - - {% for relationship in person.relationships_as_source.all %} - - - - - - {% empty %} - - - - - {% endfor %} - -
Contact Name
{{ relationship.target }} - Profile - Relationship Detail - {% if person.user == request.user or request.user.is_superuser %} - Update - {% endif %} -
No known relationships
- - New Relationship - - -
- -

Activities

- - - - - - - - - - {% for activity in person.activities.all %} - - - - - - {% empty %} - - - - {% endfor %} - -
Name
{{ activity }} - Details -
No records
-{% endblock %} - -{% block extra_script %} -{% endblock %} diff --git a/people/templates/people/person/detail_full.html b/people/templates/people/person/detail_full.html new file mode 100644 index 0000000..6d288a8 --- /dev/null +++ b/people/templates/people/person/detail_full.html @@ -0,0 +1,59 @@ +{% extends 'base.html' %} + +{% block extra_head %} + {{ map_markers|json_script:'map-markers' }} + + {% load staticfiles %} + + + +{% endblock %} + +{% block content %} + + +

{{ person.name }}

+ +
+ + {% if person.user != request.user and request.user.is_superuser %} +
+ NB: 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. +
+ {% endif %} + + + {% include 'people/person/includes/answer_set_full.html' %} + + Update + + {% if person.user == request.user %} + Change Password + {% endif %} + +
+ +
+ +
+ + {% include 'people/person/includes/relationships_full.html' %} + +
+ + {% include 'people/person/includes/activities_full.html' %} + +
+ +{% endblock %} diff --git a/people/templates/people/person/detail_partial.html b/people/templates/people/person/detail_partial.html new file mode 100644 index 0000000..f2f05fa --- /dev/null +++ b/people/templates/people/person/detail_partial.html @@ -0,0 +1,35 @@ +{% extends 'base.html' %} + +{% block extra_head %} + {{ map_markers|json_script:'map-markers' }} + + {% load staticfiles %} + + + +{% endblock %} + +{% block content %} + + +

{{ person.name }}

+ +
+ + + {% include 'people/person/includes/answer_set_partial.html' %} + +
+ +
+ +
+{% endblock %} diff --git a/people/templates/people/person/includes/activities_full.html b/people/templates/people/person/includes/activities_full.html new file mode 100644 index 0000000..0f2b811 --- /dev/null +++ b/people/templates/people/person/includes/activities_full.html @@ -0,0 +1,26 @@ +

Activities

+ + + + + + + + + + {% for activity in person.activities.all %} + + + + + + {% empty %} + + + + {% endfor %} + +
Name
{{ activity }} + Details +
No records
diff --git a/people/templates/people/person/includes/answer_set.html b/people/templates/people/person/includes/answer_set_full.html similarity index 100% rename from people/templates/people/person/includes/answer_set.html rename to people/templates/people/person/includes/answer_set_full.html diff --git a/people/templates/people/person/includes/answer_set_partial.html b/people/templates/people/person/includes/answer_set_partial.html new file mode 100644 index 0000000..ccd6dd8 --- /dev/null +++ b/people/templates/people/person/includes/answer_set_partial.html @@ -0,0 +1,32 @@ + + + + + + + + + + {% if answer_set.country_of_residence %} + + {% endif %} + + {% if answer_set.organisation %} + + {% endif %} + + {% for answer in answer_set.question_answers.all %} + + + + + + {% empty %} + + + + {% endfor %} + +
QuestionAnswer
Country of Residence{{ answer_set.country_of_residence.name }}
Organisation{{ answer_set.organisation }}
{{ answer.question }}{{ answer }}
No records
+ +

Last updated: {{ answer_set.timestamp }}

diff --git a/people/templates/people/person/includes/relationships_full.html b/people/templates/people/person/includes/relationships_full.html new file mode 100644 index 0000000..6f5350d --- /dev/null +++ b/people/templates/people/person/includes/relationships_full.html @@ -0,0 +1,36 @@ +

People I've Answered Questions About

+ + + + + + + + + + + {% for relationship in person.relationships_as_source.all %} + + + + + + {% empty %} + + + + + {% endfor %} + +
Contact Name
{{ relationship.target }} + Profile + Relationship Detail + Update +
No known relationships
+ +New Relationship + diff --git a/people/views/person.py b/people/views/person.py index 73f2e3b..86f394f 100644 --- a/people/views/person.py +++ b/people/views/person.py @@ -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: """