mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Merge branch 'public-corpus' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into public-corpus
This commit is contained in:
		@@ -33,7 +33,7 @@
 | 
			
		||||
<ul class="dropdown-content" id="nav-more-dropdown">
 | 
			
		||||
  {# <li><a href="{{ url_for('main.user_manual') }}"><i class="material-icons left">help</i>Manual</a></li> #}
 | 
			
		||||
  {% if current_user.is_authenticated %}
 | 
			
		||||
  <li><a href="{{ url_for('users.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">settings</i>User settings</a></li>
 | 
			
		||||
  <li><a href="{{ url_for('settings.edit_profile', user_id=current_user.id) }}"><i class="material-icons left">settings</i>User settings</a></li>
 | 
			
		||||
  <li class="divider" tabindex="-1"></li>
 | 
			
		||||
  <li><a href="{{ url_for('auth.logout') }}">Log out</a></li>
 | 
			
		||||
  {% else %}
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@
 | 
			
		||||
  'js/Requests/corpora/files.js',
 | 
			
		||||
  'js/Requests/corpora/followers.js',
 | 
			
		||||
  'js/Requests/jobs/jobs.js',
 | 
			
		||||
  'js/Requests/users/users.js'
 | 
			
		||||
  'js/Requests/settings/settings.js'
 | 
			
		||||
%}
 | 
			
		||||
<script src="{{ ASSET_URL }}"></script>
 | 
			
		||||
{%- endassets %}
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,8 @@
 | 
			
		||||
      sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. 
 | 
			
		||||
      Stet clita kasd gubergren, no sea tak</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="col s8" style="margin-top: 22.8px;">
 | 
			
		||||
    <div class="col s8">
 | 
			
		||||
      <br>
 | 
			
		||||
      <ul class="collapsible">
 | 
			
		||||
        <li>
 | 
			
		||||
          <div class="collapsible-header" style="justify-content: space-between;">
 | 
			
		||||
@@ -38,7 +39,7 @@
 | 
			
		||||
            </form>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
        {# <li>
 | 
			
		||||
          <div class="collapsible-header" style="justify-content: space-between;"><span>Privacy Settings</span><i class="material-icons caret right">keyboard_arrow_right</i></div>
 | 
			
		||||
          <div class="collapsible-body">
 | 
			
		||||
            <form method="POST">
 | 
			
		||||
@@ -59,21 +60,48 @@
 | 
			
		||||
              </div>
 | 
			
		||||
            </form>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
        </li> #}
 | 
			
		||||
        <li>
 | 
			
		||||
          <div class="collapsible-header" style="justify-content: space-between;"><span>Public Profile</span><i class="material-icons caret right">keyboard_arrow_right</i></div>
 | 
			
		||||
          <div class="collapsible-body">
 | 
			
		||||
            <form method="POST" enctype="multipart/form-data">
 | 
			
		||||
              {{ edit_public_profile_information_form.hidden_tag() }}
 | 
			
		||||
              <div class="switch">
 | 
			
		||||
                <label>
 | 
			
		||||
                  private
 | 
			
		||||
                  <input {% if user.is_public %}checked{% endif %} id="profile-is-public-switch" type="checkbox">
 | 
			
		||||
                  <span class="lever"></span>
 | 
			
		||||
                  public
 | 
			
		||||
                </label>
 | 
			
		||||
              </div>
 | 
			
		||||
              <p></p>
 | 
			
		||||
              <br>
 | 
			
		||||
              <div class="divider"></div>
 | 
			
		||||
              <p>Show:</p>
 | 
			
		||||
              <div class="row">
 | 
			
		||||
                <div class="col s12 m2">
 | 
			
		||||
                  <img src="{{ url_for('.profile_avatar', user_id=user.id) }}" alt="user-image" class="circle responsive-img" id="avatar">
 | 
			
		||||
                <div class="col s3">
 | 
			
		||||
                  <p>
 | 
			
		||||
                    <label>
 | 
			
		||||
                      {{ edit_public_profile_information_form.show_email() }}
 | 
			
		||||
                      <span>{{ edit_public_profile_information_form.show_email.label.text }}</span>
 | 
			
		||||
                    </label>
 | 
			
		||||
                  </p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col s12 m6">
 | 
			
		||||
                  {{ wtf.render_field(edit_public_profile_information_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload') }}
 | 
			
		||||
                </div>                    
 | 
			
		||||
                <div class="col s12 m1">
 | 
			
		||||
                  <a class="btn-floating red waves-effect waves-light modal-trigger" style="margin-top:15px;" href="#delete-avatar-modal"><i class="material-icons">delete</i></a>
 | 
			
		||||
                <div class="col s3">
 | 
			
		||||
                  <p>
 | 
			
		||||
                    <label>
 | 
			
		||||
                      {{ edit_public_profile_information_form.show_last_seen() }}
 | 
			
		||||
                      <span>{{ edit_public_profile_information_form.show_last_seen.label.text }}</span>
 | 
			
		||||
                    </label>
 | 
			
		||||
                  </p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col s4">
 | 
			
		||||
                  <p>
 | 
			
		||||
                    <label>
 | 
			
		||||
                      {{ edit_public_profile_information_form.show_member_since() }}
 | 
			
		||||
                      <span>{{ edit_public_profile_information_form.show_member_since.label.text }}</span>
 | 
			
		||||
                    </label>
 | 
			
		||||
                  </p>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
              <p></p>
 | 
			
		||||
@@ -83,9 +111,23 @@
 | 
			
		||||
              {{ wtf.render_field(edit_public_profile_information_form.website, material_icon='laptop') }}
 | 
			
		||||
              {{ wtf.render_field(edit_public_profile_information_form.organization, material_icon='business') }}
 | 
			
		||||
              {{ wtf.render_field(edit_public_profile_information_form.location, material_icon='location_on') }}
 | 
			
		||||
              <p></p>
 | 
			
		||||
              <div class="row">
 | 
			
		||||
                <div class="col s12 m2">
 | 
			
		||||
                  <img src="{{ url_for('users.profile_avatar', user_id=user.id) }}" alt="user-image" class="circle responsive-img" id="avatar">
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col s12 m6">
 | 
			
		||||
                  {{ wtf.render_field(edit_public_profile_information_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload') }}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col s12 m1">
 | 
			
		||||
                  <a class="btn-floating red waves-effect waves-light modal-trigger" style="margin-top:15px;" href="#delete-avatar-modal"><i class="material-icons">delete</i></a>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
              <br>
 | 
			
		||||
              <p></p>
 | 
			
		||||
              <div class="right-align">
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.submit, material_icon='send') }}
 | 
			
		||||
              </div>
 | 
			
		||||
              </div>              
 | 
			
		||||
            </form>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
@@ -100,7 +142,8 @@
 | 
			
		||||
      sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. 
 | 
			
		||||
      Stet clita kasd gubergren, no sea tak</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="col s8" style="margin-top: 22.8px;">
 | 
			
		||||
    <div class="col s8">
 | 
			
		||||
      <br>
 | 
			
		||||
      <ul class="collapsible">
 | 
			
		||||
        <li>
 | 
			
		||||
          <div class="collapsible-header" style="justify-content: space-between;">
 | 
			
		||||
@@ -182,36 +225,17 @@
 | 
			
		||||
{% block scripts %}
 | 
			
		||||
{{ super() }}
 | 
			
		||||
<script>
 | 
			
		||||
let publicProfile = document.querySelector('#public-profile');
 | 
			
		||||
let disableButtons = document.querySelectorAll('[data-action="disable"]');
 | 
			
		||||
let deleteButton = document.querySelector('#delete-avatar');
 | 
			
		||||
let avatar = document.querySelector('#avatar');
 | 
			
		||||
let avatarUpload = document.querySelector('#avatar-upload');
 | 
			
		||||
 | 
			
		||||
for (let disableButton of disableButtons) {
 | 
			
		||||
  disableButton.disabled = !publicProfile.checked;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
publicProfile.addEventListener('change', () => {
 | 
			
		||||
  if (publicProfile.checked) {
 | 
			
		||||
    for (let disableButton of disableButtons) {
 | 
			
		||||
      disableButton.disabled = false;
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    for (let disableButton of disableButtons) {
 | 
			
		||||
      disableButton.checked = false;
 | 
			
		||||
      disableButton.disabled = true;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
avatarUpload.addEventListener('change', function() {
 | 
			
		||||
  let file = this.files[0];
 | 
			
		||||
  avatar.src = URL.createObjectURL(file);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
deleteButton.addEventListener('click', () => {
 | 
			
		||||
  Requests.users.entity.deleteAvatar(currentUserId)
 | 
			
		||||
  Requests.settings.entity.deleteAvatar(currentUserId)
 | 
			
		||||
    .then(
 | 
			
		||||
      (response) => {
 | 
			
		||||
        avatar.src = "{{ url_for('static', filename='images/user_avatar.png') }}";
 | 
			
		||||
@@ -220,7 +244,7 @@ deleteButton.addEventListener('click', () => {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
document.querySelector('#delete-user-button').addEventListener('click', (event) => {
 | 
			
		||||
  Requests.users.entity.delete(currentUserId)
 | 
			
		||||
  Requests.settings.entity.delete(currentUserId)
 | 
			
		||||
    .then((response) => {window.location.href = '/';});
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -239,5 +263,16 @@ document.querySelectorAll('.collapsible').forEach((collapsible) => {
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// #region Public Switch
 | 
			
		||||
let profileIsPublicSwitchElement = document.querySelector('#profile-is-public-switch');
 | 
			
		||||
profileIsPublicSwitchElement.addEventListener('change', (event) => {
 | 
			
		||||
  let newIsPublic = profileIsPublicSwitchElement.checked;
 | 
			
		||||
  Requests.settings.entity.isPublic.update(currentUserId, newIsPublic)
 | 
			
		||||
    .catch((response) => {
 | 
			
		||||
      profileIsPublicSwitchElement.checked = !newIsPublic;
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
// #endregion Public Switch
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock scripts %}
 | 
			
		||||
@@ -1,236 +0,0 @@
 | 
			
		||||
{% extends "base.html.j2" %}
 | 
			
		||||
{% import "materialize/wtf.html.j2" as wtf %}
 | 
			
		||||
 | 
			
		||||
{% block page_content %}
 | 
			
		||||
<div class="container">
 | 
			
		||||
  <div class="row">
 | 
			
		||||
    <div class="col s12">
 | 
			
		||||
      <h1 id="title">{{ title }}</h1>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="row"> 
 | 
			
		||||
    <div class="col s12 m9 l10">
 | 
			
		||||
      
 | 
			
		||||
      <div id="user-settings" class="card section scrollspy">
 | 
			
		||||
        <form method="POST" enctype="multipart/form-data">
 | 
			
		||||
          <div class="card-content">
 | 
			
		||||
            <span class="card-title">User Settings</span>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
              <div class="col s6">
 | 
			
		||||
                {{ edit_profile_settings_form.hidden_tag() }}
 | 
			
		||||
                {{ wtf.render_field(edit_profile_settings_form.username, material_icon='person') }}
 | 
			
		||||
                {{ wtf.render_field(edit_profile_settings_form.email, material_icon='email') }}
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="card-action">
 | 
			
		||||
            <div class="right-align">
 | 
			
		||||
              {{ wtf.render_field(edit_profile_settings_form.submit, material_icon='send') }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </form>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <form method="POST">
 | 
			
		||||
        {{ edit_privacy_settings_form.hidden_tag() }}
 | 
			
		||||
        <div id="privacy-settings" class="card section scrollspy">
 | 
			
		||||
          <div class="card-content">
 | 
			
		||||
            <span class="card-title">Privacy settings</span>
 | 
			
		||||
            <br>
 | 
			
		||||
            {{ wtf.render_field(edit_privacy_settings_form.is_public, id='public-profile') }}
 | 
			
		||||
            <br>
 | 
			
		||||
            <hr>
 | 
			
		||||
            <br>
 | 
			
		||||
            {{ wtf.render_field(edit_privacy_settings_form.show_email, data_action='disable', disabled=true) }}
 | 
			
		||||
            <br>
 | 
			
		||||
            {{ wtf.render_field(edit_privacy_settings_form.show_last_seen, data_action='disable', disabled=true) }}
 | 
			
		||||
            <br>
 | 
			
		||||
            {{ wtf.render_field(edit_privacy_settings_form.show_member_since, data_action='disable', disabled=true) }}
 | 
			
		||||
            <br>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="card-action">
 | 
			
		||||
            <div class="right-align">
 | 
			
		||||
              {{ wtf.render_field(edit_privacy_settings_form.submit, material_icon='send') }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </form>
 | 
			
		||||
 | 
			
		||||
      <div id="public-profile-settings" class="card section scrollspy">
 | 
			
		||||
        <form method="POST" enctype="multipart/form-data">
 | 
			
		||||
          <div class="card-content">
 | 
			
		||||
            {{ edit_public_profile_information_form.hidden_tag() }}
 | 
			
		||||
            <div class="row">
 | 
			
		||||
              <div class="col s12">
 | 
			
		||||
                <span class="card-title">Public Profile</span>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row">
 | 
			
		||||
              <div class="col s5">
 | 
			
		||||
                <div class="row">
 | 
			
		||||
                  <div class="col s2"></div>
 | 
			
		||||
                  <div class="col s8">
 | 
			
		||||
                    <img src="{{ url_for('.profile_avatar', user_id=user.id) }}" alt="user-image" class="circle responsive-img" id="avatar">
 | 
			
		||||
                  </div>
 | 
			
		||||
                  <div class="col s2"></div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row">
 | 
			
		||||
                  <div class="col s2">
 | 
			
		||||
                    <div class="center-align">
 | 
			
		||||
                      <a class="btn-floating red waves-effect waves-light modal-trigger" style="margin-top:15px;" href="#delete-avatar-modal"><i class="material-icons">delete</i></a>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
                  <div class="col s10">
 | 
			
		||||
                    {{ wtf.render_field(edit_public_profile_information_form.avatar, accept='image/jpeg, image/png, image/gif', placeholder='Choose an image file', id='avatar-upload') }}
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
              <div class="col s7">
 | 
			
		||||
                <p></p>
 | 
			
		||||
                <br>
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.full_name, material_icon='badge') }}
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.about_me, material_icon='description') }}
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.website, material_icon='laptop') }}
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.organization, material_icon='business') }}
 | 
			
		||||
                {{ wtf.render_field(edit_public_profile_information_form.location, material_icon='location_on') }}
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="card-action">
 | 
			
		||||
            <div class="right-align">
 | 
			
		||||
              {{ wtf.render_field(edit_public_profile_information_form.submit, material_icon='send') }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </form>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <form method="POST">
 | 
			
		||||
        {{ edit_notification_settings_form.hidden_tag() }}
 | 
			
		||||
        <div id="notification-settings" class="card section scrollspy">
 | 
			
		||||
          <div class="card-content">
 | 
			
		||||
            <span class="card-title">Notification settings</span>
 | 
			
		||||
            {{ wtf.render_field(edit_notification_settings_form.job_status_mail_notification_level, material_icon='notifications') }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="card-action">
 | 
			
		||||
            <div class="right-align">
 | 
			
		||||
              {{ wtf.render_field(edit_notification_settings_form.submit, material_icon='send') }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </form>
 | 
			
		||||
 | 
			
		||||
      <form method="POST">
 | 
			
		||||
        {{ change_password_form.hidden_tag() }}
 | 
			
		||||
        <div id="change-password" class="card section scrollspy">
 | 
			
		||||
          <div class="card-content">
 | 
			
		||||
            <span class="card-title">Change Password</span>
 | 
			
		||||
            {{ wtf.render_field(change_password_form.password, material_icon='vpn_key') }}
 | 
			
		||||
            {{ wtf.render_field(change_password_form.new_password, material_icon='vpn_key') }}
 | 
			
		||||
            {{ wtf.render_field(change_password_form.new_password_2, material_icon='vpn_key') }}
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="card-action">
 | 
			
		||||
            <div class="right-align">
 | 
			
		||||
              {{ wtf.render_field(change_password_form.submit, material_icon='send') }}
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </form>
 | 
			
		||||
 | 
			
		||||
      <div id="delete-account" class="card section scrollspy">
 | 
			
		||||
        <div class="card-content">
 | 
			
		||||
          <span class="card-title">Delete account</span>
 | 
			
		||||
          <p>Deleting an account has the following effects:</p>
 | 
			
		||||
          <ul>
 | 
			
		||||
            <li>All data associated with your corpora and jobs will be permanently deleted.</li>
 | 
			
		||||
            <li>All settings will be permanently deleted.</li>
 | 
			
		||||
          </ul>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="card-action right-align">
 | 
			
		||||
          <a class="btn red waves-effect waves-light modal-trigger" href="#delete-user"><i class="material-icons left">delete</i>Delete</a>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="col hide-on-small-only m3 l2">
 | 
			
		||||
      <ul class="section table-of-contents" style="position: fixed !important;">
 | 
			
		||||
        <li><a href="#user-settings">User Settings</a></li>
 | 
			
		||||
        <li><a href="#privacy-settings">Privacy Settings</a></li>
 | 
			
		||||
        <li><a href="#public-profile-settings">Public Profile Settings</a></li>
 | 
			
		||||
        <li><a href="#notification-settings">Notification Settings</a></li>
 | 
			
		||||
        <li><a href="#change-password">Change Password</a></li>
 | 
			
		||||
        <li><a href="#delete-account">Delete Account</a></li>
 | 
			
		||||
      </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock page_content %}
 | 
			
		||||
 | 
			
		||||
{% block modals %}
 | 
			
		||||
<div class="modal" id="delete-avatar-modal">
 | 
			
		||||
  <div class="modal-content">
 | 
			
		||||
    <h4>Confirm Avatar deletion</h4>
 | 
			
		||||
    <p>Do you really want to delete your Avatar?</p>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
    <a class="btn modal-close waves-effect waves-light">Cancel</a>
 | 
			
		||||
    <a class="btn modal-close red waves-effect waves-light" id="delete-avatar">Delete</a>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="modal" id="delete-user">
 | 
			
		||||
  <div class="modal-content">
 | 
			
		||||
    <h4>Confirm User deletion</h4>
 | 
			
		||||
    <p>Do you really want to delete the User <b>{{ current_user.username }}</b>? All files will be permanently deleted!</p>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="modal-footer">
 | 
			
		||||
    <a class="btn modal-close waves-effect waves-light">Cancel</a>
 | 
			
		||||
    <a class="btn modal-close red waves-effect waves-light" id="delete-user-button">Delete</a>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock modals %}
 | 
			
		||||
 | 
			
		||||
{% block scripts %}
 | 
			
		||||
{{ super() }}
 | 
			
		||||
<script>
 | 
			
		||||
let publicProfile = document.querySelector('#public-profile');
 | 
			
		||||
let disableButtons = document.querySelectorAll('[data-action="disable"]');
 | 
			
		||||
let deleteButton = document.querySelector('#delete-avatar');
 | 
			
		||||
let avatar = document.querySelector('#avatar');
 | 
			
		||||
let avatarUpload = document.querySelector('#avatar-upload');
 | 
			
		||||
 | 
			
		||||
for (let disableButton of disableButtons) {
 | 
			
		||||
  disableButton.disabled = !publicProfile.checked;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
publicProfile.addEventListener('change', () => {
 | 
			
		||||
  if (publicProfile.checked) {
 | 
			
		||||
    for (let disableButton of disableButtons) {
 | 
			
		||||
      disableButton.disabled = false;
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    for (let disableButton of disableButtons) {
 | 
			
		||||
      disableButton.checked = false;
 | 
			
		||||
      disableButton.disabled = true;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
avatarUpload.addEventListener('change', function() {
 | 
			
		||||
  let file = this.files[0];
 | 
			
		||||
  avatar.src = URL.createObjectURL(file);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
deleteButton.addEventListener('click', () => {
 | 
			
		||||
  Requests.users.entity.deleteAvatar(currentUserId)
 | 
			
		||||
    .then(
 | 
			
		||||
      (response) => {
 | 
			
		||||
        avatar.src = "{{ url_for('static', filename='images/user_avatar.png') }}";
 | 
			
		||||
      }
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
document.querySelector('#delete-user-button').addEventListener('click', (event) => {
 | 
			
		||||
  Requests.users.entity.delete(currentUserId)
 | 
			
		||||
    .then((response) => {window.location.href = '/';});
 | 
			
		||||
});
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock scripts %}
 | 
			
		||||
@@ -81,7 +81,7 @@
 | 
			
		||||
                <p></p>
 | 
			
		||||
                <br>
 | 
			
		||||
                {% if current_user.is_authenticated and current_user.hashid == user.id %}
 | 
			
		||||
                <a class="waves-effect waves-light btn-small" href="{{ url_for('.edit_profile', user_id=current_user.id) }}">Edit profile</a>
 | 
			
		||||
                <a class="waves-effect waves-light btn-small" href="{{ url_for('settings.edit_profile', user_id=current_user.id) }}">Edit profile</a>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user