mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	(Public-)Corpus List fix+highligting owner status
This commit is contained in:
		@@ -110,8 +110,8 @@
 | 
			
		||||
              </table>
 | 
			
		||||
              <br>
 | 
			
		||||
              <p></p>
 | 
			
		||||
              {% if not current_user.is_following_corpus(corpus) %}
 | 
			
		||||
              <a class="waves-effect waves-light btn-small">Request Corpus</a>
 | 
			
		||||
              {% if not current_user.is_following_corpus(corpus) and corpus.user.has_profile_privacy_setting('SHOW_EMAIL') %}
 | 
			
		||||
              <a class="waves-effect waves-light btn-small" href="mailto:{{ corpus.user.email }}">Request Corpus</a>
 | 
			
		||||
              {% endif %}
 | 
			
		||||
              <a class="waves-effect waves-light btn-small" href="{{ url_for('users.user', user_id=corpus.user.id) }}">View profile</a>
 | 
			
		||||
            </div>
 | 
			
		||||
@@ -153,7 +153,7 @@
 | 
			
		||||
{% block modals %}
 | 
			
		||||
{{ super() }}
 | 
			
		||||
 | 
			
		||||
{% if cfr.has_permission('MANAGE_FOLLOWERS') %}
 | 
			
		||||
{% if current_user == corpus.user or current_user.is_administrator() %}
 | 
			
		||||
<div class="modal" id="publishing-modal">
 | 
			
		||||
  <div class="modal-content">
 | 
			
		||||
    <h4>Change your Corpus publishing status</h4>
 | 
			
		||||
@@ -172,9 +172,7 @@
 | 
			
		||||
    <a class="modal-close waves-effect waves-green btn-flat">Close</a>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if current_user == corpus.user or current_user.is_administrator() %}
 | 
			
		||||
<div class="modal" id="delete-modal">
 | 
			
		||||
  <div class="modal-content">
 | 
			
		||||
    <h4>Confirm Corpus deletion</h4>
 | 
			
		||||
@@ -221,9 +219,9 @@
 | 
			
		||||
      You can set different roles via the link, you can also edit them later in the menu below. 
 | 
			
		||||
      It is recommended not to set the expiration date of the link too far.
 | 
			
		||||
    </p>
 | 
			
		||||
    <h5>Please make sure that the invited users are legally allowed to view the included corpus files.</h5>
 | 
			
		||||
    <p><b>Please make sure that the invited users are legally allowed to view the included corpus files.</b></p>
 | 
			
		||||
    <div class="row">
 | 
			
		||||
      <div class="col s12 l3">
 | 
			
		||||
      <div class="col s12 l2">
 | 
			
		||||
        <div class="input-field">
 | 
			
		||||
          <i class="material-icons prefix">badge</i>
 | 
			
		||||
          <select id="share-link-modal-corpus-follower-role-select">
 | 
			
		||||
@@ -241,12 +239,12 @@
 | 
			
		||||
          <label for="expiration-date">Expiration date</label>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col s12 l3">
 | 
			
		||||
      <div class="col s12 l2">
 | 
			
		||||
        <br class="hide-on-med-and-down">
 | 
			
		||||
        <a class="btn waves-effect waves-light" id="share-link-modal-create-button">Create<i class="material-icons right">send</i></a>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div class="col s12 l6">
 | 
			
		||||
      <div class="col s12 l5">
 | 
			
		||||
        <div class="row hide" id="share-link-modal-output-container">
 | 
			
		||||
          <div class="col s9">
 | 
			
		||||
            <div class="input-field">
 | 
			
		||||
@@ -275,13 +273,6 @@
 | 
			
		||||
let corpusDisplay = new CorpusDisplay(document.querySelector('#corpus-display'));
 | 
			
		||||
 | 
			
		||||
{% if current_user.is_following_corpus(corpus) %}
 | 
			
		||||
  {% if cfr.has_permission('MANAGE_FILES') %}
 | 
			
		||||
  let buildButton = document.querySelector('#build-button');
 | 
			
		||||
  buildButton.addEventListener('click', () => {
 | 
			
		||||
    Requests.corpora.entity.build({{ corpus.hashid|tojson }})
 | 
			
		||||
  });
 | 
			
		||||
  {% endif %}
 | 
			
		||||
 | 
			
		||||
  let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
 | 
			
		||||
  unfollowRequestElement.addEventListener('click', () => {
 | 
			
		||||
    Requests.corpora.entity.followers.entity.delete({{ corpus.hashid|tojson }}, {{ current_user.hashid|tojson }})
 | 
			
		||||
@@ -321,8 +312,8 @@ let inviteUserModalSearchElement = document.querySelector('#invite-user-modal-se
 | 
			
		||||
let inviteUserModalInviteButtonElement = document.querySelector('#invite-user-modal-invite-button');
 | 
			
		||||
let users = {
 | 
			
		||||
  {% for user in users %}
 | 
			
		||||
  {{ user.username|tojson }}: {{ url_for('users.user_avatar', user_id=user.id)|tojson }}
 | 
			
		||||
  {% if not loop.last %},{% endif %}
 | 
			
		||||
    {{ user.username|tojson }}: {{ url_for('users.user_avatar', user_id=user.id)|tojson }}
 | 
			
		||||
    {% if not loop.last %},{% endif %}
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
    <div class="col s12">
 | 
			
		||||
      <div class="card">
 | 
			
		||||
        <div class="card-content">
 | 
			
		||||
          <div class="corpus-list" data-user-id="{{ current_user.hashid }}"></div>
 | 
			
		||||
          <div class="corpus-list no-autoinit" data-user-id="{{ current_user.hashid }}"></div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="card-action right-align">
 | 
			
		||||
          <a class="btn disabled waves-effect waves-light" href="{{ url_for('corpora.import_corpus') }}">Import Corpus<i class="material-icons right">import_export</i></a>
 | 
			
		||||
@@ -135,3 +135,21 @@
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock modals %}
 | 
			
		||||
 | 
			
		||||
{% block scripts %}
 | 
			
		||||
{{ super() }}
 | 
			
		||||
<script>
 | 
			
		||||
  let corpusList = new CorpusList(document.querySelector('.corpus-list'));
 | 
			
		||||
  corpusList.add(
 | 
			
		||||
    [
 | 
			
		||||
      {% for corpus in corpora %}
 | 
			
		||||
      {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
    ]
 | 
			
		||||
  );
 | 
			
		||||
  corpusItems = document.querySelectorAll('[data-is-owner="false"]');
 | 
			
		||||
  corpusItems.forEach((item) => {
 | 
			
		||||
    item.classList.add('deep-purple', 'lighten-5');
 | 
			
		||||
  });
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock scripts %}
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@
 | 
			
		||||
  publicCorpusList.add(
 | 
			
		||||
    [
 | 
			
		||||
      {% for corpus in corpora %}
 | 
			
		||||
      {{ corpus.to_json_serializeable()|tojson }},
 | 
			
		||||
      {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
    ]
 | 
			
		||||
  );
 | 
			
		||||
 
 | 
			
		||||
@@ -122,19 +122,23 @@
 | 
			
		||||
{% block scripts %}
 | 
			
		||||
{{ super() }}
 | 
			
		||||
<script>
 | 
			
		||||
let followedCorpusList = new FollowedCorpusList(document.querySelector('.followed-corpus-list'));
 | 
			
		||||
let followedCorpusList = new PublicCorpusList(document.querySelector('.followed-corpus-list'));
 | 
			
		||||
followedCorpusList.add(
 | 
			
		||||
  [
 | 
			
		||||
    {% for corpus in user.followed_corpora %}
 | 
			
		||||
    {{ corpus.to_json_serializeable()|tojson }},
 | 
			
		||||
      {% if (corpus.is_public or corpus.user == current_user) %}
 | 
			
		||||
      {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
 | 
			
		||||
      {% endif %}
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
  ]
 | 
			
		||||
);
 | 
			
		||||
let publicCorpusList = new PublicCorpusList(document.querySelector('.public-corpus-list'));
 | 
			
		||||
publicCorpusList.add(
 | 
			
		||||
  [
 | 
			
		||||
    {% for corpus in user.corpora if corpus.is_public %}
 | 
			
		||||
    {{ corpus.to_json_serializeable()|tojson }},
 | 
			
		||||
    {% for corpus in user.corpora %}
 | 
			
		||||
      {% if corpus.is_public %}
 | 
			
		||||
      {{ corpus.to_json_serializeable(backrefs=True)|tojson }},
 | 
			
		||||
      {% endif %}
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
  ]
 | 
			
		||||
);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user