Skip to content

Commit 58b43b0

Browse files
authored
Add avatar templates, changing default from django-avatar to geonode-base (#12842)
1 parent 0258939 commit 58b43b0

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% extends "geonode_base.html" %}
2+
{% load i18n avatar_tags bootstrap_tags %}
3+
4+
{% block body_outer %}
5+
<div class="page-header">
6+
<h2>{% trans "Add Avatar" %}</h2>
7+
</div>
8+
<div class="row">
9+
<div class="col-md-12">
10+
<h3>{% trans "Your current avatar: " %}</h3>
11+
{% avatar user %}
12+
{% if not avatars %}
13+
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
14+
{% endif %}
15+
<hr />
16+
<h3>{% trans "Add new avatar" %}</h3>
17+
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
18+
{{ upload_avatar_form|as_bootstrap_inline }}
19+
<p>
20+
{% csrf_token %}
21+
<input type="submit" class="btn btn-primary" value="{% trans "Upload New Image" %}" />
22+
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
23+
</p>
24+
</form>
25+
</div>
26+
</div>
27+
{% endblock %}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% extends "geonode_base.html" %}
2+
{% load i18n avatar_tags bootstrap_tags %}
3+
4+
{% block body_outer %}
5+
6+
<div class="page-header">
7+
<h2>{% trans "Change Avatar" %}</h2>
8+
</div>
9+
<div class="row">
10+
<div class="col-md-12">
11+
<h3>{% trans "Your current avatar: " %}</h3>
12+
{% avatar user %}
13+
{% if not avatars %}
14+
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
15+
{% else %}
16+
<hr />
17+
<h3>{% trans "Select default avatar"%}</h3>
18+
<form method="POST" action="{% url 'avatar:change' %}">
19+
<ul>
20+
{{ primary_avatar_form|as_bootstrap_inline }}
21+
</ul>
22+
<p>
23+
{% csrf_token %}
24+
<input type="submit" class="btn btn-primary" value="{% trans 'Choose new Default' %}" />
25+
<a href="{% url 'avatar:delete' %}" class="btn btn-danger"> {% trans "Delete avatar" %}</a>
26+
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
27+
</p>
28+
</form>
29+
{% endif %}
30+
<hr />
31+
<h3>{% trans "Add new avatar" %}</h3>
32+
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
33+
{{ upload_avatar_form|as_bootstrap_inline }}
34+
<p>
35+
{% csrf_token %}
36+
<input type="submit" class="btn btn-primary" value="{% trans 'Upload New Image' %}" />
37+
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
38+
</p>
39+
</form>
40+
</div>
41+
</div>
42+
{% endblock %}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{% extends "geonode_base.html" %}
2+
{% load i18n bootstrap_tags %}
3+
4+
{% block body_outer %}
5+
<div class="page-header">
6+
<h2>{% trans "Delete Avatar" %}</h2>
7+
</div>
8+
<div class="row">
9+
<div class="col-md-12">
10+
{% if not avatars %}
11+
{% url 'avatar_change' as avatar_change_url %}
12+
<p>{% blocktrans %}You have no avatars to delete. Please <a href="{{ avatar_change_url }}">upload one</a> now.{% endblocktrans %}</p>
13+
{% else %}
14+
<p>{% trans "Please select the avatars that you would like to delete." %}</p>
15+
<form method="POST" action="{% url 'avatar:delete' %}">
16+
{{ delete_avatar_form|as_bootstrap_inline }}
17+
<p>
18+
{% csrf_token %}
19+
<input type="submit" class="btn btn-primary" value="{% trans 'Delete These' %}" />
20+
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
21+
</p>
22+
</form>
23+
{% endif %}
24+
</div>
25+
</div>
26+
{% endblock %}

geonode/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,8 @@ def get_geonode_catalogue_service():
23312331
]
23322332
INSTALLED_APPS += ("geonode.assets",)
23332333
GEONODE_APPS += ("geonode.assets",)
2334+
2335+
# Django-Avatar - Change default templates to Geonode based
2336+
AVATAR_ADD_TEMPLATE = "people/avatar/add.html"
2337+
AVATAR_CHANGE_TEMPLATE = "people/avatar/change.html"
2338+
AVATAR_DELETE_TEMPLATE = "people/avatar/confirm_delete.html"

0 commit comments

Comments
 (0)