mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	update contribute share button
This commit is contained in:
		@@ -31,7 +31,7 @@ class SpaCyNLPPipelineModelList extends RessourceList {
 | 
				
			|||||||
        <td><b><span class="title"></span> <span class="version"></span></b><br><i><span class="description"></span></i></td>
 | 
					        <td><b><span class="title"></span> <span class="version"></span></b><br><i><span class="description"></span></i></td>
 | 
				
			||||||
        <td><a class="publisher-url"><span class="publisher"></span></a> (<span class="publishing-year"></span>)<br><a class="publishing-url"><span class="publishing-url-2"></span></a></td>
 | 
					        <td><a class="publisher-url"><span class="publisher"></span></a> (<span class="publishing-year"></span>)<br><a class="publishing-url"><span class="publishing-url-2"></span></a></td>
 | 
				
			||||||
        <td>
 | 
					        <td>
 | 
				
			||||||
          <div class="switch action-switch center-align" data-action="share-request" data-user-role=>
 | 
					          <div class="switch action-switch center-align" data-action="share-request">
 | 
				
			||||||
            <span class="share"></span>
 | 
					            <span class="share"></span>
 | 
				
			||||||
            <label>
 | 
					            <label>
 | 
				
			||||||
              <input type="checkbox" class="shared">
 | 
					              <input type="checkbox" class="shared">
 | 
				
			||||||
@@ -86,8 +86,8 @@ class SpaCyNLPPipelineModelList extends RessourceList {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  init(user) {
 | 
					  init(user) {
 | 
				
			||||||
    this._init(user.spacy_nlp_pipeline_models);
 | 
					    this._init(user.spacy_nlp_pipeline_models);
 | 
				
			||||||
 | 
					    if (user.role.name !== ('Administrator' || 'Contributor')) {
 | 
				
			||||||
      for (let switchElement of this.listjs.list.querySelectorAll('.shared')) {
 | 
					      for (let switchElement of this.listjs.list.querySelectorAll('.shared')) {
 | 
				
			||||||
      if (user.role.name !== 'Administrator' || user.role.name !== 'Contributor') {
 | 
					 | 
				
			||||||
        switchElement.setAttribute('disabled', '');
 | 
					        switchElement.setAttribute('disabled', '');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -101,7 +101,13 @@ class SpaCyNLPPipelineModelList extends RessourceList {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onClick(event) {
 | 
					  onClick(event) {
 | 
				
			||||||
    if (event.target.closest('.action-switch')) {return;}
 | 
					    if (event.target.closest('.action-switch')) {
 | 
				
			||||||
 | 
					      let userRole = app.data.users[this.userId].role.name;
 | 
				
			||||||
 | 
					      if (userRole !== ('Administrator' || 'Contributor')) {
 | 
				
			||||||
 | 
					        app.flash('You need the "Contributor" or "Administrator" role to perform this action.', 'error');
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    let actionButtonElement = event.target.closest('.action-button');
 | 
					    let actionButtonElement = event.target.closest('.action-button');
 | 
				
			||||||
    let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
 | 
					    let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
 | 
				
			||||||
    let spaCyNLPPipelineModelElement = event.target.closest('tr');
 | 
					    let spaCyNLPPipelineModelElement = event.target.closest('tr');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,6 +86,11 @@ class TesseractOCRPipelineModelList extends RessourceList {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  init (user) {
 | 
					  init (user) {
 | 
				
			||||||
    this._init(user.tesseract_ocr_pipeline_models);
 | 
					    this._init(user.tesseract_ocr_pipeline_models);
 | 
				
			||||||
 | 
					    if (user.role.name !== ('Administrator' || 'Contributor')) {
 | 
				
			||||||
 | 
					      for (let switchElement of this.listjs.list.querySelectorAll('.shared')) {
 | 
				
			||||||
 | 
					        switchElement.setAttribute('disabled', '');
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _init(ressources) {
 | 
					  _init(ressources) {
 | 
				
			||||||
@@ -96,7 +101,13 @@ class TesseractOCRPipelineModelList extends RessourceList {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onClick(event) {
 | 
					  onClick(event) {
 | 
				
			||||||
    if (event.target.closest('.action-switch')) {return;}
 | 
					    if (event.target.closest('.action-switch')) {
 | 
				
			||||||
 | 
					      let userRole = app.data.users[this.userId].role.name;
 | 
				
			||||||
 | 
					      if (userRole !== ('Administrator' || 'Contributor')) {
 | 
				
			||||||
 | 
					        app.flash('You need the "Contributor" or "Administrator" role to perform this action.', 'error');
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    let actionButtonElement = event.target.closest('.action-button');
 | 
					    let actionButtonElement = event.target.closest('.action-button');
 | 
				
			||||||
    let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
 | 
					    let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action;
 | 
				
			||||||
    let tesseractOCRPipelineModelElement = event.target.closest('tr');
 | 
					    let tesseractOCRPipelineModelElement = event.target.closest('tr');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user