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

View File

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