Simplify informationupdater

This commit is contained in:
Patrick Jentsch 2019-11-05 16:22:48 +01:00
parent 4bcd97c003
commit da077cae3f
2 changed files with 12 additions and 21 deletions

View File

@ -2,16 +2,11 @@
{% block page_content %}
<script>
var corpus_user_id = {{ corpus.user_id }}
socket.emit('inspect_user', corpus_user_id);
</script>
<script>
var CORPUS_ID = {{ corpus.id }}
var foreignCorpusFlag;
{% if current_user.id == corpus.user_id %}
foreignCorpusFlag = false;
{% if corpus.creator == current_user %}
var foreignCorpusFlag = false;
{% else %}
foreignCorpusFlag = true;
var foreignCorpusFlag = true;
socket.emit('inspect_user', {{ corpus.user_id }});
{% endif %}
class InformationUpdater {
@ -44,6 +39,7 @@
if (pathArray[0] != this.corpusId) {continue;}
switch(operation.op) {
case "add":
location.reload();
break;
case "delete":
location.reload();
@ -68,13 +64,13 @@
}
}
var informationUpdater = new InformationUpdater(CORPUS_ID);
var informationUpdater = new InformationUpdater({{ corpus.id }});
</script>
<div class="col s12 m4">
<h3 id="title">{{ corpus.title }}</h3>
<p id="description">{{ corpus.description }}</p>
<a class="waves-effect waves-light btn" id="status">{{ corpus.status }}</a>
<a class="waves-effect waves-light btn" id="status"></a>
</div>
<div class="col s12 m8">

View File

@ -2,16 +2,11 @@
{% block page_content %}
<script>
var job_user_id = {{ job.user_id }}
socket.emit('inspect_user', job_user_id);
</script>
<script>
var JOB_ID = {{ job.id }}
var foreignJobFlag;
{% if current_user.id == job.user_id %}
foreignJobFlag = false;
{% if job.creator == current_user %}
var foreignJobFlag = false;
{% else %}
foreignJobFlag = true;
var foreignJobFlag = true;
socket.emit('inspect_user', {{ job.user_id }});
{% endif %}
class InformationUpdater {
@ -111,7 +106,7 @@
}
}
var informationUpdater = new InformationUpdater(JOB_ID);
var informationUpdater = new InformationUpdater({{ job.id }});
</script>
<div class="col s12 m4">