2017-02-05 02:30:02 +00:00
|
|
|
<!DOCTYPE html5>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{% import "header.html" as header %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{% import "cards.html" as cards %}
|
2021-01-08 04:18:07 +00:00
|
|
|
<title class="dynamic_user_display_name">{{user.display_name}}</title>
|
2017-02-05 02:30:02 +00:00
|
|
|
<meta charset="UTF-8">
|
2017-07-21 06:10:48 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
2018-02-24 20:51:36 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/common.css">
|
2020-09-03 18:50:16 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/etiquette.css">
|
2021-01-09 19:27:29 +00:00
|
|
|
<link rel="stylesheet" href="/static/css/cards.css">
|
2019-08-14 20:43:35 +00:00
|
|
|
{% if theme %}<link rel="stylesheet" href="/static/css/theme_{{theme}}.css">{% endif %}
|
2018-08-18 05:23:40 +00:00
|
|
|
<script src="/static/js/common.js"></script>
|
2018-09-23 23:53:49 +00:00
|
|
|
<script src="/static/js/api.js"></script>
|
2021-01-02 03:46:31 +00:00
|
|
|
<script src="/static/js/editor.js"></script>
|
|
|
|
<script src="/static/js/spinner.js"></script>
|
2017-02-05 02:30:02 +00:00
|
|
|
|
|
|
|
<style>
|
2021-01-02 21:49:43 +00:00
|
|
|
h2, h3
|
|
|
|
{
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
2017-02-05 02:30:02 +00:00
|
|
|
#content_body
|
|
|
|
{
|
2021-01-02 21:49:43 +00:00
|
|
|
grid-row-gap: 8px;
|
|
|
|
grid-auto-rows: max-content;
|
2017-02-05 02:30:02 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
{{header.make_header(session=session)}}
|
|
|
|
<div id="content_body">
|
2021-01-09 19:27:29 +00:00
|
|
|
<div id="hierarchy_self" class="panel">
|
2021-01-02 21:49:43 +00:00
|
|
|
<h2 id="display_name">{{user.display_name}}</h2>
|
|
|
|
<p>ID: <a href="/userid/{{user.id}}">{{user.id}}</a></p>
|
|
|
|
<p>User since <span title="{{user.created|int|timestamp_to_8601}}">{{user.created|timestamp_to_naturaldate}}.</span></p>
|
|
|
|
</div>
|
2021-01-09 19:27:29 +00:00
|
|
|
|
|
|
|
{% set photos = user.get_photos(direction='desc')|islice(0, 15)|list %}
|
|
|
|
{% if photos %}
|
|
|
|
<div id="hierarchy_photos" class="panel">
|
2021-01-08 04:18:07 +00:00
|
|
|
<h3><a href="/search?author={{user.username}}">Photos by <span class="dynamic_user_display_name">{{user.display_name}}</span></a></h3>
|
2021-01-09 19:27:29 +00:00
|
|
|
{% for photo in photos %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_photo_card(photo)}}
|
2021-01-09 19:27:29 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% set tags = user.get_tags(direction='desc')|islice(0, 100)|list %}
|
|
|
|
{% if tags %}
|
|
|
|
<div id="hierarchy_tags" class="panel">
|
|
|
|
<h3>Tags by <span class="dynamic_user_display_name">{{user.display_name}}</span></h3>
|
|
|
|
{% for tag in tags %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_tag_card(tag, with_alt_description=True)}}
|
2021-01-09 19:27:29 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% set albums = user.get_albums()|islice(0, 20)|list %}
|
|
|
|
{% if albums %}
|
|
|
|
<div id="hierarchy_albums" class="panel">
|
|
|
|
<h3>Albums by <span class="dynamic_user_display_name">{{user.display_name}}</span></h3>
|
|
|
|
{% for album in albums %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_album_card(album)}}
|
2021-01-09 19:27:29 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% set bookmarks = user.get_bookmarks()|islice(0, 50)|list %}
|
|
|
|
{% if bookmarks %}
|
|
|
|
<div id="hierarchy_bookmarks" class="panel">
|
|
|
|
<h3>Bookmarks by <span class="dynamic_user_display_name">{{user.display_name}}</span></h3>
|
|
|
|
{% for bookmark in bookmarks %}
|
2021-01-20 00:33:34 +00:00
|
|
|
{{cards.create_bookmark_card(bookmark)}}
|
2021-01-09 19:27:29 +00:00
|
|
|
{% endfor %}
|
2021-01-02 03:46:31 +00:00
|
|
|
</div>
|
2021-01-09 19:27:29 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2017-02-05 02:30:02 +00:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2021-01-02 03:46:31 +00:00
|
|
|
{% if user.id == session.user.id %}
|
|
|
|
const USERNAME = "{{user.username}}";
|
|
|
|
|
|
|
|
profile_ed_on_open = undefined;
|
|
|
|
|
|
|
|
function profile_ed_on_save(ed)
|
|
|
|
{
|
|
|
|
function callback(response)
|
|
|
|
{
|
|
|
|
ed.hide_spinner();
|
|
|
|
|
|
|
|
if (! response.meta.json_ok)
|
|
|
|
{
|
|
|
|
alert(JSON.stringify(response));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ("error_type" in response.data)
|
|
|
|
{
|
2021-01-09 23:42:51 +00:00
|
|
|
ed.show_error(`${response.data.error_type} ${response.data.error_message}`);
|
2021-01-02 03:46:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The data that comes back from the server will have been normalized.
|
|
|
|
const new_display_name = response.data.display_name;
|
2021-01-08 04:18:07 +00:00
|
|
|
common.update_dynamic_elements("dynamic_user_display_name", new_display_name);
|
2021-01-02 03:46:31 +00:00
|
|
|
|
|
|
|
ed.elements["display_name"].edit.value = new_display_name;
|
|
|
|
|
|
|
|
ed.save();
|
|
|
|
}
|
|
|
|
|
|
|
|
ed.show_spinner();
|
|
|
|
api.users.edit(USERNAME, ed.elements["display_name"].edit.value, callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
profile_ed_on_cancel = undefined;
|
|
|
|
|
|
|
|
const profile_ed_elements = [
|
|
|
|
{
|
|
|
|
"id": "display_name",
|
|
|
|
"element": document.getElementById("display_name"),
|
|
|
|
"placeholder": "Display name",
|
|
|
|
"empty_text": USERNAME,
|
|
|
|
"autofocus": true,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const profile_ed = new editor.Editor(
|
|
|
|
profile_ed_elements,
|
|
|
|
profile_ed_on_open,
|
|
|
|
profile_ed_on_save,
|
|
|
|
profile_ed_on_cancel,
|
|
|
|
);
|
|
|
|
{% endif %}
|
2017-02-05 02:30:02 +00:00
|
|
|
</script>
|
|
|
|
</html>
|