mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Add corpus page.
This commit is contained in:
		
							
								
								
									
										90
									
								
								app/templates/main/corpora/corpus.html.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								app/templates/main/corpora/corpus.html.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
			
		||||
{% extends "base.html.j2" %}
 | 
			
		||||
 | 
			
		||||
{% block page_content %}
 | 
			
		||||
<script>
 | 
			
		||||
  var CORPUS_ID = {{ corpus_id }}
 | 
			
		||||
 | 
			
		||||
  class InformationUpdater {
 | 
			
		||||
    constructor(corpusId) {
 | 
			
		||||
      this.corpusId = corpusId;
 | 
			
		||||
      corporaSubscribers.push(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _init() {
 | 
			
		||||
      var creationDateElement, descriptionElement, titleElement;
 | 
			
		||||
 | 
			
		||||
      this.corpus = corpora[this.corpusId];
 | 
			
		||||
      creationDateElement = document.getElementById("creation-date");
 | 
			
		||||
      creationDateElement.value = this.corpus.creation_date;
 | 
			
		||||
      descriptionElement = document.getElementById("description");
 | 
			
		||||
      descriptionElement.innerHTML = this.corpus.description;
 | 
			
		||||
      titleElement = document.getElementById("title");
 | 
			
		||||
      titleElement.innerHTML = this.corpus.title;
 | 
			
		||||
 | 
			
		||||
      M.updateTextFields();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _update(patch) {
 | 
			
		||||
      var newStatusColor, operation, pathArray, status, statusColor,
 | 
			
		||||
          updatedElement;
 | 
			
		||||
 | 
			
		||||
      for (operation of patch) {
 | 
			
		||||
        /* "/corpusId/valueName" -> ["corpusId", "valueName"] */
 | 
			
		||||
        pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
        if (pathArray[0] != this.jobId) {continue;}
 | 
			
		||||
        switch(operation.op) {
 | 
			
		||||
          case "delete":
 | 
			
		||||
            location.reload();
 | 
			
		||||
            break;
 | 
			
		||||
          case "replace":
 | 
			
		||||
            switch(pathArray[1]) {
 | 
			
		||||
              case "description":
 | 
			
		||||
                updatedElement = document.getElementById("description");
 | 
			
		||||
                updatedElement.innerHTML = operation.value;
 | 
			
		||||
                break;
 | 
			
		||||
              case "title":
 | 
			
		||||
                updatedElement = document.getElementById("title");
 | 
			
		||||
                updatedElement.innerHTML = operation.value;
 | 
			
		||||
                break;
 | 
			
		||||
              default:
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
          default:
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  var informationUpdater = new InformationUpdater(CORPUS_ID);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<div class="col s12 m4">
 | 
			
		||||
  <h3 id="title"></h3>
 | 
			
		||||
  <p id="description"></p>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="col s12 m8">
 | 
			
		||||
  <div class="card">
 | 
			
		||||
    <div class="card-content">
 | 
			
		||||
      <span class="card-title">Chronometrics</span>
 | 
			
		||||
      <div class="row">
 | 
			
		||||
        <div class="col s12 m6">
 | 
			
		||||
          <div class="input-field">
 | 
			
		||||
            <input disabled value="" id="creation-date" type="text" class="validate">
 | 
			
		||||
            <label for="creation-date">Creation date</label>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <span class="card-title">Files</span>
 | 
			
		||||
      <p>
 | 
			
		||||
      {% for file in files %}
 | 
			
		||||
      <a href="{{ url_for('main.corpus_download', corpus_id=corpus_id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small">
 | 
			
		||||
        <i class="material-icons left">file_download</i>{{ file }}
 | 
			
		||||
      </a>
 | 
			
		||||
      {% endfor %}
 | 
			
		||||
      </p>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
		Reference in New Issue
	
	Block a user