Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
86b28795
Commit
86b28795
authored
3 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Build a reusable avatar content snippet with a preference regarding the use of personal photos
parent
b8ba0027
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!907
Resolve "Feature: Account Menu in Top Navbar"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/preferences.py
+10
-0
10 additions, 0 deletions
aleksis/core/preferences.py
aleksis/core/templates/core/partials/avatar_content.html
+29
-0
29 additions, 0 deletions
aleksis/core/templates/core/partials/avatar_content.html
with
39 additions
and
0 deletions
aleksis/core/preferences.py
+
10
−
0
View file @
86b28795
...
...
@@ -403,6 +403,16 @@ class PersonChangeNotificationContact(StringPreference):
verbose_name
=
_
(
"
Contact for notification if a person changes their data
"
)
@site_preferences_registry.register
class
PersonPreferPhoto
(
BooleanPreference
):
"""
Preference, whether personal photos should be displayed instead of avatars.
"""
section
=
account
name
=
"
person_prefer_photo
"
default
=
False
verbose_name
=
_
(
"
Prefer personal photos over avatars
"
)
@site_preferences_registry.register
class
PDFFileExpirationDuration
(
IntegerPreference
):
"""
PDF file expiration duration.
"""
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/templates/core/partials/avatar_content.html
0 → 100644
+
29
−
0
View file @
86b28795
{% load rules i18n %}
{% has_perm 'core.view_avatar_rule' request.user person_or_user as can_view_avatar %}
{% has_perm 'core.view_photo_rule' request.user person_or_user as can_view_photo %}
{% if SITE_PREFERENCES.account__person_prefer_photo and person_or_user.photo and can_view_photo %}
<div
class=
"{% firstof class "
clip-circle
"
%}"
>
<img
class=
"{% firstof img_class "
hundred-percent
"
%}"
src=
"{{ person_or_user.photo.url }}"
alt=
"{{ person_or_user.full_name }}"
{%
if
title
%}
title=
"{{ person_or_user.full_name }}"
{%
endif
%}
/>
</div>
{% elif person_or_user.identicon_url %}
{# If this is a person #}
<div
class=
"{% firstof class "
clip-circle
"
%}"
>
{% if can_view_avatar %}
<img
class=
"{% firstof img_class "
hundred-percent
"
%}"
src=
"{{ person_or_user.avatar_url }}"
alt=
"{{ person_or_user.full_name }} ({% trans "
Avatar
"
%})"
{%
if
title
%}
title=
"{{ person_or_user.full_name }} ({% trans "
Avatar
"
%})"{%
endif
%}
/>
{% else %}
<img
class=
"{% firstof img_class "
hundred-percent
"
%}"
src=
"{{ person_or_user.identicon_url }}"
alt=
"{{ person_or_user.full_name }} ({% trans "
Identicon
"
%})"
{%
if
title
%}
title=
"{{ person_or_user.full_name }} ({% trans "
Identicon
"
%})"{%
endif
%}
/>
{% endif %}
</div>
{% else %}
{# There is a user without a person #}
<div
class=
"{% firstof class "
clip-circle
"
%}
no-image
"
>
<i
class=
"material-icons"
>
person
</i>
</div>
{% endif %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment