2017-02-05 02:30:02 +00:00
|
|
|
<!DOCTYPE html5>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{% import "header.html" as header %}
|
2018-08-18 05:05:16 +00:00
|
|
|
<title>{{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">
|
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-02 03:46:31 +00:00
|
|
|
<div 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>
|
|
|
|
<div class="panel">
|
|
|
|
<h3><a href="/search?author={{user.username}}">Photos by {{user.display_name}}</a></h3>
|
|
|
|
<iframe
|
|
|
|
class="embedded_search"
|
|
|
|
src="/search_embed?author={{user.username}}&orderby=created-desc&yield_albums=no&limit=10"
|
|
|
|
onload="return common.size_iframe_to_content(this);"
|
|
|
|
>
|
|
|
|
</iframe>
|
2021-01-02 03:46:31 +00:00
|
|
|
</div>
|
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)
|
|
|
|
{
|
|
|
|
ed.show_error(response.data.error_message);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The data that comes back from the server will have been normalized.
|
|
|
|
const new_display_name = response.data.display_name;
|
|
|
|
document.title = new_display_name;
|
|
|
|
|
|
|
|
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>
|