Skip to content

Commit

Permalink
Add avatar templates, changing default from django-avatar to geonode-…
Browse files Browse the repository at this point in the history
…base (#12842)
  • Loading branch information
cmotadev authored Jan 27, 2025
1 parent 0258939 commit 58b43b0
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
27 changes: 27 additions & 0 deletions geonode/people/templates/people/avatar/add.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends "geonode_base.html" %}
{% load i18n avatar_tags bootstrap_tags %}

{% block body_outer %}
<div class="page-header">
<h2>{% trans "Add Avatar" %}</h2>
</div>
<div class="row">
<div class="col-md-12">
<h3>{% trans "Your current avatar: " %}</h3>
{% avatar user %}
{% if not avatars %}
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% endif %}
<hr />
<h3>{% trans "Add new avatar" %}</h3>
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
{{ upload_avatar_form|as_bootstrap_inline }}
<p>
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans "Upload New Image" %}" />
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
</p>
</form>
</div>
</div>
{% endblock %}
42 changes: 42 additions & 0 deletions geonode/people/templates/people/avatar/change.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% extends "geonode_base.html" %}
{% load i18n avatar_tags bootstrap_tags %}

{% block body_outer %}

<div class="page-header">
<h2>{% trans "Change Avatar" %}</h2>
</div>
<div class="row">
<div class="col-md-12">
<h3>{% trans "Your current avatar: " %}</h3>
{% avatar user %}
{% if not avatars %}
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% else %}
<hr />
<h3>{% trans "Select default avatar"%}</h3>
<form method="POST" action="{% url 'avatar:change' %}">
<ul>
{{ primary_avatar_form|as_bootstrap_inline }}
</ul>
<p>
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans 'Choose new Default' %}" />
<a href="{% url 'avatar:delete' %}" class="btn btn-danger"> {% trans "Delete avatar" %}</a>
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
</p>
</form>
{% endif %}
<hr />
<h3>{% trans "Add new avatar" %}</h3>
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar:add' %}">
{{ upload_avatar_form|as_bootstrap_inline }}
<p>
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans 'Upload New Image' %}" />
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
</p>
</form>
</div>
</div>
{% endblock %}
26 changes: 26 additions & 0 deletions geonode/people/templates/people/avatar/confirm_delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends "geonode_base.html" %}
{% load i18n bootstrap_tags %}

{% block body_outer %}
<div class="page-header">
<h2>{% trans "Delete Avatar" %}</h2>
</div>
<div class="row">
<div class="col-md-12">
{% if not avatars %}
{% url 'avatar_change' as avatar_change_url %}
<p>{% blocktrans %}You have no avatars to delete. Please <a href="{{ avatar_change_url }}">upload one</a> now.{% endblocktrans %}</p>
{% else %}
<p>{% trans "Please select the avatars that you would like to delete." %}</p>
<form method="POST" action="{% url 'avatar:delete' %}">
{{ delete_avatar_form|as_bootstrap_inline }}
<p>
{% csrf_token %}
<input type="submit" class="btn btn-primary" value="{% trans 'Delete These' %}" />
<a href="{% url 'profile_edit' user.username %}" class="btn btn-link"> {% trans "Go back to Edit Your Profile" %}</a>
</p>
</form>
{% endif %}
</div>
</div>
{% endblock %}
5 changes: 5 additions & 0 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,3 +2331,8 @@ def get_geonode_catalogue_service():
]
INSTALLED_APPS += ("geonode.assets",)
GEONODE_APPS += ("geonode.assets",)

# Django-Avatar - Change default templates to Geonode based
AVATAR_ADD_TEMPLATE = "people/avatar/add.html"
AVATAR_CHANGE_TEMPLATE = "people/avatar/change.html"
AVATAR_DELETE_TEMPLATE = "people/avatar/confirm_delete.html"

0 comments on commit 58b43b0

Please sign in to comment.