-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vCra
committed
Mar 4, 2019
1 parent
37547f9
commit cb29eae
Showing
20 changed files
with
258 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,3 +241,4 @@ | |
|
||
MOOSHAK_ENDPOINT = "http://localhost:8081/mooshak/api" | ||
|
||
OPEN_URLS = ["/admin/login/"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ services: | |
- local_postgres_data_backups:/backups | ||
env_file: | ||
- ./.envs/.local/.postgres | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.1.7 on 2019-03-03 19:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('programdom', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='workshopsession', | ||
name='title', | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='workshopsession', | ||
name='problems', | ||
field=models.ManyToManyField(blank=True, to='programdom.Problem'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 2.1.7 on 2019-03-03 20:32 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('programdom', '0002_auto_20190303_1919'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='problem', | ||
name='skeleton', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='problem', | ||
name='title', | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 2.1.7 on 2019-03-03 21:15 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('programdom', '0003_auto_20190303_2032'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='workshopsession', | ||
name='owner', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{% extends "base.html" %} | ||
{% block breadcrumbs %} | ||
<li class="breadcrumb-item"><a href="{% url 'home' %}">Home</a></li> | ||
<li class="breadcrumb-item"><a href="{% url 'workshop_list' %}">Workshops</a></li> | ||
<li class="breadcrumb-item "><a href="{% url 'workshop_detail' object.id %}">{{ object }}</a></li> | ||
<li class="breadcrumb-item active">Present</li> | ||
{% endblock breadcrumbs %} | ||
{% block content %} | ||
<div class="row"> | ||
<div class="col"> | ||
<h3>{{ object}} <span class="badge badge-dark {% if not object.active %}d-none{% endif %}" id="badge_in_progress">In Progress</span></h3> | ||
</div> | ||
<div class="col"> | ||
<div class="btn-group float-right" role="group" aria-label="Workshop Buttons"> | ||
{% if not object.active %} | ||
<input type="hidden" id="input_toggle_value" value="true"> | ||
<button class="btn btn-success" id="btn_workshop_toggle">Begin Workshop</button> | ||
{% else %} | ||
<input type="hidden" id="input_toggle_value" value="false"> | ||
<button class="btn btn-danger" id="btn_workshop_toggle">End Workshop</button> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
</div> | ||
{% endblock %} | ||
{% block javascript %} | ||
{{ block.super }} | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"> | ||
</script> | ||
<link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet"> | ||
|
||
<script> | ||
var chatSocket = new WebSocket( | ||
'ws://' + window.location.host + | ||
'/ws/manage_workshop/'+ {{ object.id }} + '/'); | ||
|
||
chatSocket.onmessage = function(e) { | ||
var data = JSON.parse(e.data) | ||
var action = data["action"]; | ||
|
||
if (action === "workshop_toggle"){ | ||
if (data.workshop_state) { | ||
toastr.info("This workshop has now started"); | ||
$("#btn_workshop_toggle").removeClass("btn-success").addClass("btn-danger").text("End Workshop"); | ||
$("#input_toggle_value").val("false"); | ||
$("#badge_in_progress").removeClass("d-none") | ||
} else { | ||
toastr.info("This workshop has now ended"); | ||
$("#btn_workshop_toggle").removeClass("btn-danger").addClass("btn-success").text("Begin Workshop"); | ||
$("#input_toggle_value").val("true") | ||
$("#badge_in_progress").addClass("d-none") | ||
} | ||
} | ||
}; | ||
|
||
chatSocket.onclose = function(e) { | ||
console.error('Chat socket closed unexpectedly'); | ||
}; | ||
|
||
|
||
$("#btn_workshop_toggle").click(function(){ | ||
chatSocket.send(JSON.stringify({ | ||
"action": "workshop_toggle", | ||
"workshop_id": {{ object.id }}, | ||
"workshop_state": $("#input_toggle_value").val() === 'true' | ||
})) | ||
|
||
}) | ||
|
||
|
||
|
||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.