Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
71d22e36
Commit
71d22e36
authored
Nov 20, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add picture view to users
parent
22ab21e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
0 deletions
+45
-0
core/templates/core/user_pictures.jinja
core/templates/core/user_pictures.jinja
+21
-0
core/urls.py
core/urls.py
+1
-0
core/views/user.py
core/views/user.py
+14
-0
sas/templates/sas/album.jinja
sas/templates/sas/album.jinja
+9
-0
No files found.
core/templates/core/user_pictures.jinja
0 → 100644
View file @
71d22e36
{%
extends
"core/base.jinja"
%}
{%
from
"core/macros.jinja"
import
user_link_with_pict
,
delete_godfather
%}
{%
block
title
%}
{%
trans
user_name
=
profile.get_display_name
()
%}{{
user_name
}}
's pictures
{%
endtrans
%}
{%
endblock
%}
{%
block
content
%}
{%
for
r
in
user.pictures.exclude
(
picture
=
None
)
.
values
(
'user__pictures__picture__parent'
)
.
distinct
()
%}
{%
set
album
=
user.pictures.
filter
(
picture__parent
=
r
[
'user__pictures__picture__parent'
])
.
first
()
.
picture.parent
%}
<h4>
{{
album.name
}}
</h4>
{%
for
r
in
user.pictures.exclude
(
picture
=
None
)
.
filter
(
picture__parent
=
album
)
%}
<div
style=
"display: inline-block; border: solid 1px black; width: 9%; margin: 0.1%"
>
<a
href=
"
{{
url
(
"sas:picture"
,
picture_id
=
r.picture.id
)
}}
#pict"
>
<img
src=
"
{{
r.picture.as_picture.get_download_url
()
}}
"
alt=
"
{{
r.picture.get_display_name
()
}}
"
style=
"max-width: 100%"
/>
</a>
</div>
{%
endfor
%}
{%
endfor
%}
{%
endblock
%}
core/urls.py
View file @
71d22e36
...
...
@@ -32,6 +32,7 @@ urlpatterns = [
url
(
r
'^user/$'
,
UserListView
.
as_view
(),
name
=
'user_list'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/mini$'
,
UserMiniView
.
as_view
(),
name
=
'user_profile_mini'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/$'
,
UserView
.
as_view
(),
name
=
'user_profile'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/pictures$'
,
UserPicturesView
.
as_view
(),
name
=
'user_pictures'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/godfathers$'
,
UserGodfathersView
.
as_view
(),
name
=
'user_godfathers'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/godfathers/(?P<godfather_id>[0-9]+)/(?P<is_father>(True)|(False))/delete$'
,
DeleteUserGodfathers
,
name
=
'user_godfathers_delete'
),
url
(
r
'^user/(?P<user_id>[0-9]+)/edit$'
,
UserUpdateProfileView
.
as_view
(),
name
=
'user_edit'
),
...
...
core/views/user.py
View file @
71d22e36
...
...
@@ -134,6 +134,11 @@ class UserTabsMixin(TabedViewMixin):
'slug'
:
'godfathers'
,
'name'
:
_
(
"Godfathers"
),
})
tab_list
.
append
({
'url'
:
reverse
(
'core:user_pictures'
,
kwargs
=
{
'user_id'
:
self
.
object
.
id
}),
'slug'
:
'pictures'
,
'name'
:
_
(
"Pictures"
),
})
if
self
.
request
.
user
==
self
.
object
:
tab_list
.
append
({
'url'
:
reverse
(
'core:user_tools'
),
...
...
@@ -201,6 +206,15 @@ def DeleteUserGodfathers(request, user_id, godfather_id, is_father):
raise
PermissionDenied
return
redirect
(
'core:user_godfathers'
,
user_id
=
user_id
)
class
UserPicturesView
(
UserTabsMixin
,
CanViewMixin
,
DetailView
):
"""
Display a user's pictures
"""
model
=
User
pk_url_kwarg
=
"user_id"
context_object_name
=
"profile"
template_name
=
"core/user_pictures.jinja"
current_tab
=
'pictures'
class
UserGodfathersView
(
UserTabsMixin
,
CanViewMixin
,
DetailView
):
"""
...
...
sas/templates/sas/album.jinja
View file @
71d22e36
...
...
@@ -4,7 +4,16 @@
{%
trans
%}
SAS
{%
endtrans
%}
{%
endblock
%}
{%
macro
print_path
(
file
)
%}
{%
if
file
%}
{{
print_path
(
file.parent
)
}}
<a
href=
"
{{
url
(
'sas:album'
,
album_id
=
file.id
)
}}
"
>
{{
file.get_display_name
()
}}
</a>
>
{%
endif
%}
{%
endmacro
%}
{%
block
content
%}
{{
print_path
(
album.parent
)
}}
{{
album.get_display_name
()
}}
<h3>
{{
album.get_display_name
()
}}
</h3>
<div>
{%
for
a
in
album.children.
filter
(
is_folder
=
True
,
is_moderated
=
True
)
.
all
()
%}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment