2018-03-23 00:01:42 +00:00
|
|
|
{% extends '@mio/settings/master.twig' %}
|
|
|
|
|
|
|
|
{% block settings_content %}
|
2018-04-16 00:33:54 +00:00
|
|
|
<div class="settings__avatar">
|
|
|
|
<div class="settings__avatar__sections">
|
|
|
|
<div class="settings__avatar__requirements">
|
|
|
|
<ul class="settings__avatar__requirements__list">
|
2018-03-26 00:13:26 +00:00
|
|
|
<li>Your avatar may not be larger than <strong>{{ avatar_max_width }}x{{ avatar_max_height }}</strong>.</li>
|
|
|
|
<li>The avatar will be centre cropped to be <strong>200x200</strong>.</li>
|
|
|
|
<li>Your avatar may not exceed the <strong>{{ avatar_max_filesize|byte_symbol(true) }}</strong> filesize limit.</li>
|
|
|
|
<li>Animated gif images are allowed.</li>
|
|
|
|
<li>Keep things sane and suitable for all ages.</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2018-04-16 00:33:54 +00:00
|
|
|
<div class="settings__avatar__forms">
|
|
|
|
<form class="settings__avatar__form" method="post" action="?m=avatar" enctype="multipart/form-data">
|
2018-03-26 00:13:26 +00:00
|
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="{{ avatar_max_filesize }}">
|
2018-04-16 00:33:54 +00:00
|
|
|
<label class="input__upload__label">
|
|
|
|
<input accept="image/png,image/jpeg,image/gif" type="file" name="avatar" class="input__upload" id="avatar-selection">
|
2018-03-26 00:13:26 +00:00
|
|
|
Pick file...
|
|
|
|
</label>
|
2018-04-16 00:33:54 +00:00
|
|
|
<button class="input__button" name="upload" value="{{ csrf_token() }}">Upload</button>
|
2018-03-26 00:13:26 +00:00
|
|
|
</form>
|
2018-04-17 21:50:21 +00:00
|
|
|
|
2018-04-16 00:33:54 +00:00
|
|
|
<form class="settings__avatar__form" method="post" action="?m=avatar">
|
2018-04-17 21:50:21 +00:00
|
|
|
<button class="input__button{% if not user_has_avatar %} input__button--disabled{% endif %}" name="delete" value="{{ csrf_token() }}"{% if not user_has_avatar %} disabled{% endif %}>Delete</button>
|
2018-03-24 04:31:42 +00:00
|
|
|
</form>
|
2018-03-26 00:13:26 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-04-16 00:33:54 +00:00
|
|
|
<div class="settings__avatar__preview__container">
|
|
|
|
<div class="avatar settings__avatar__preview" id="avatar-preview" style="background-image:url('/profile.php?u={{ settings_user.user_id }}&m=avatar')"></div>
|
2018-03-24 04:31:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-26 00:13:26 +00:00
|
|
|
<script>
|
|
|
|
function updateAvatarPreview(url, element) {
|
|
|
|
url = url || "/profile.php?u={{ settings_user.user_id }}&m=avatar";
|
|
|
|
element = element || document.getElementById('avatar-preview');
|
|
|
|
element.style.backgroundImage = 'url(\'' + url + '\')';
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById('avatar-selection').addEventListener('change', function (ev) {
|
|
|
|
updateAvatarPreview(URL.createObjectURL(ev.target.files[0]));
|
|
|
|
});
|
|
|
|
</script>
|
2018-03-23 00:01:42 +00:00
|
|
|
{% endblock %}
|