mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Update corpus page
This commit is contained in:
		@@ -11,6 +11,8 @@ class CorpusFileList extends ResourceList {
 | 
			
		||||
    this.isInitialized = false;
 | 
			
		||||
    this.userId = listContainerElement.dataset.userId;
 | 
			
		||||
    this.corpusId = listContainerElement.dataset.corpusId;
 | 
			
		||||
    this.hasPermissionView =  listContainerElement.dataset?.hasPermissionView == 'true' || false;
 | 
			
		||||
    this.hasPermissionManageFiles =  listContainerElement.dataset?.hasPermissionManageFiles == 'true' || false;
 | 
			
		||||
    if (this.userId === undefined || this.corpusId === undefined) {return;}
 | 
			
		||||
    app.subscribeUser(this.userId).then((response) => {
 | 
			
		||||
      app.socket.on('PATCH', (patch) => {
 | 
			
		||||
@@ -24,19 +26,21 @@ class CorpusFileList extends ResourceList {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get item() {
 | 
			
		||||
    return `
 | 
			
		||||
      <tr class="list-item clickable hoverable">
 | 
			
		||||
        <td><span class="filename"></span></td>
 | 
			
		||||
        <td><span class="author"></span></td>
 | 
			
		||||
        <td><span class="title"></span></td>
 | 
			
		||||
        <td><span class="publishing-year"></span></td>
 | 
			
		||||
        <td class="right-align">
 | 
			
		||||
          <a class="list-action-trigger btn-floating red waves-effect waves-light" data-list-action="delete"><i class="material-icons">delete</i></a>
 | 
			
		||||
          <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light" data-list-action="download" data-service="corpus-analysis"><i class="material-icons">file_download</i></a>
 | 
			
		||||
          <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light" data-list-action="view" data-service="corpus-analysis"><i class="material-icons">send</i></a>
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    `.trim();
 | 
			
		||||
    return (values) => {
 | 
			
		||||
      return `
 | 
			
		||||
        <tr class="list-item">
 | 
			
		||||
          <td><span class="filename"></span></td>
 | 
			
		||||
          <td><span class="author"></span></td>
 | 
			
		||||
          <td><span class="title"></span></td>
 | 
			
		||||
          <td><span class="publishing-year"></span></td>
 | 
			
		||||
          <td class="right-align">
 | 
			
		||||
            <a class="list-action-trigger btn-floating red waves-effect waves-light ${this.hasPermissionManageFiles ? '' : 'hide'}" data-list-action="delete"><i class="material-icons">delete</i></a>
 | 
			
		||||
            <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light ${this.hasPermissionView ? '' : 'hide'}" data-list-action="download" data-service="corpus-analysis"><i class="material-icons">file_download</i></a>
 | 
			
		||||
            <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light ${this.hasPermissionManageFiles ? '' : 'hide'}" data-list-action="view" data-service="corpus-analysis"><i class="material-icons">send</i></a>
 | 
			
		||||
          </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
      `.trim();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get valueNames() {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,9 @@ class CorpusFollowerList extends ResourceList {
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
    app.getUser(this.userId).then((user) => {
 | 
			
		||||
      this.add(Object.values(user.corpora[this.corpusId].corpus_follower_associations));
 | 
			
		||||
      let corpusFollowerAssociations = Object.values(user.corpora[this.corpusId].corpus_follower_associations);
 | 
			
		||||
      let filteredList = corpusFollowerAssociations.filter(association => association.follower.id != currentUserId);
 | 
			
		||||
      this.add(filteredList);
 | 
			
		||||
      this.isInitialized = true;
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
class PublicCorpusFileList extends CorpusFileList {
 | 
			
		||||
  get item() {
 | 
			
		||||
    return `
 | 
			
		||||
      <tr class="list-item clickable hoverable">
 | 
			
		||||
        <td><span class="filename"></span></td>
 | 
			
		||||
        <td><span class="author"></span></td>
 | 
			
		||||
        <td><span class="title"></span></td>
 | 
			
		||||
        <td><span class="publishing-year"></span></td>
 | 
			
		||||
        <td class="right-align">
 | 
			
		||||
          <a class="list-action-trigger btn-floating service-color darken waves-effect waves-light" data-list-action="view" data-service="corpus-analysis"><i class="material-icons">send</i></a>
 | 
			
		||||
        </td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    `.trim();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user