Skip to content

Commit 118e650

Browse files
authored
Organizations: allow uploading avatar (#614)
https://github.com/user-attachments/assets/37882662-81cf-4f95-a870-6c96d9085bfc Looks like the error message from file fields is duplicated, I think we are overriding how we render fields in the new theme somewhere... Matches readthedocs/readthedocs.org#12254
1 parent 3d8e022 commit 118e650

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

readthedocsext/theme/templates/organizations/partials/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{% block organization_header_title %}
2929
<div class="eight wide computer eight wide tablet sixteen wide mobile middle aligned column">
3030
<img class="ui micro rounded right spaced inline image"
31-
src="{% gravatar_url organization.email 48 %}"
31+
src="{{ organization.get_avatar_url }}"
3232
alt="{% blocktrans trimmed with organization_name=organization.name %}{{ organization_name }} organization{% endblocktrans %}" />
3333
<a class="ui medium text" href="{{ organization.get_absolute_url }}">
3434
{{ organization.name }}

readthedocsext/theme/templates/organizations/partials/organization_list.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{% extends "includes/crud/table_list.html" %}
22

3-
{% load i18n %}
4-
{% load humanize %}
5-
{% load gravatar %}
6-
7-
{% load organizations %}
8-
{% load privacy_tags %}
3+
{% load trans blocktrans from i18n %}
4+
{% load has_sso_enabled from organizations %}
5+
{% load is_admin from privacy_tags %}
96

107
{% block top_left_menu_items %}
118
<div data-bind="using: FilterView()">
@@ -23,9 +20,11 @@
2320
{% url "organization_create" as create_url %}
2421
{% include "includes/crud/create_button.html" with url=create_url text=create_text %}
2522
{% endif %}
26-
{% endblock %}
23+
{% endblock create_button %}
2724

28-
{% block list_placeholder_icon_class %}fad fa-building icon{% endblock %}
25+
{% block list_placeholder_icon_class %}
26+
fad fa-building icon
27+
{% endblock list_placeholder_icon_class %}
2928
{% block list_placeholder_header_filtered %}
3029
{% trans "No matching organizations found" %}
3130
{% endblock list_placeholder_header_filtered %}
@@ -66,7 +65,9 @@
6665
{% endblock list_item_right_buttons %}
6766

6867
{% block list_item_image %}
69-
<img class="ui image" src="{% gravatar_url object.email 48 %}" />
68+
<img class="ui image"
69+
src="{{ object.get_avatar_url }}"
70+
alt="{% blocktrans trimmed with organization_name=object.name %}{{ organization_name }} organization{% endblocktrans %}" />
7071
{% endblock list_item_image %}
7172

7273
{% block list_item_header %}
@@ -81,8 +82,7 @@
8182
{% include "includes/components/config_label.html" with icon="fad fa-user-check" text=text popup=popup %}
8283
{% endif %}
8384
</a>
84-
<div class="sub header">
85-
</div>
85+
<div class="sub header"></div>
8686
{% endblock list_item_header %}
8787

8888
{% block list_item_meta %}
@@ -95,7 +95,8 @@
9595
{% endblocktrans %}
9696
</a>
9797
{% if not object|has_sso_enabled:"allauth" %}
98-
<a class="item" href="{% url "organization_team_list" slug=object.slug %}">
98+
<a class="item"
99+
href="{% url "organization_team_list" slug=object.slug %}">
99100
{% blocktrans trimmed with team_count=object.teams.count %}
100101
{{ team_count }} teams
101102
{% endblocktrans %}

readthedocsext/theme/templates/organizations/settings/organization_edit.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
{% endblock organization_edit_content_header %}
1616

1717
{% block organization_edit_content %}
18-
<form class="ui form" method="post" action=".">
18+
<form class="ui form"
19+
method="post"
20+
enctype="multipart/form-data"
21+
action=".">
1922
{% csrf_token %}
2023
{{ form|crispy }}
2124
<input class="ui primary button" type="submit" value="{% trans "Save" %}" />

0 commit comments

Comments
 (0)