Commit 58e77fd6 authored by Aedin Hunter A. Clay's avatar Aedin Hunter A. Clay

in preparation for view_board, removed components in edit_board that displayed...

in preparation for view_board, removed components in edit_board that displayed quests and moved them to board.html, which will be extended by both view and edit board.
parent 22d2d95d
...@@ -14,4 +14,7 @@ class QuestForm(forms.ModelForm): ...@@ -14,4 +14,7 @@ class QuestForm(forms.ModelForm):
'student1' : forms.HiddenInput(), 'student1' : forms.HiddenInput(),
'student2' : forms.HiddenInput(), 'student2' : forms.HiddenInput(),
'student3' : forms.HiddenInput(), 'student3' : forms.HiddenInput(),
} }
\ No newline at end of file
class AddStudentName(forms.Form):
name = forms.CharField(max_length = 60)
\ No newline at end of file
...@@ -15,19 +15,6 @@ class Quest(models.Model): ...@@ -15,19 +15,6 @@ class Quest(models.Model):
student2 = models.CharField(max_length = 60, default = '', blank = True) student2 = models.CharField(max_length = 60, default = '', blank = True)
student3 = models.CharField(max_length = 60, default = '', blank = True) student3 = models.CharField(max_length = 60, default = '', blank = True)
def is_for_everyone(self):
if self.students is not None:
return self.students.for_everyone
else:
return False
def is_students_full(self):
return self.student1 != '' and self.student2 != '' and self.student3 != ''
def is_students_empty(self):
return self.student1 == '' and self.student2 == '' and self.student3 == ''
def is_editable(self):
return self.for_everyone or self.is_students_empty()
{% extends 'base.html' %}
{% load static %}
{% block title%}{{questboard.name}}{% endblock %}
{% block styles %}
<link rel = "stylesheet" href = "{% static 'board/board.css' %}">
{% endblock %}
{% block header %}{{questboard.name}}{% endblock %}
{% block content %}
Required Stars: {{questboard.required_stars}}<br/>
{{questboard.description}}<br/>
{% if quests %}
Quests in the Questboard:
<div id = "quest_display">
{% for quest in quests %}
<div class = "questbox">
<p class = "questbox_name">{{ quest.name }}</p>
<p class = "questbox_description">{{ quest.description }}</p>
<p class = "questbox_stars">Stars : {{quest.stars}}</p>
<div class = "questbox_students">
<!-- If the quest has three students -->
{% if quest.for_everyone is True %}
<b> for everyone </b>
{% else %}
<ol>
<li>{{quest.student1}}</li>
<li>{{quest.student2}}</li>
<li>{{quest.student3}}</li>
</ol>
{% endif %}
</div>
<span class = "questbox_actions">
{% block questbox_actions %}{% endblock %}
</span>
</div>
{% endfor %}
</div>
{% endif %}
{% block extra_content %}{% endblock %}
{% block extra_scripts %}{% endblock %}
{% endblock %}
{% extends 'base.html' %} {% extends 'board/board.html' %}
{% load static %} {% load static %}
{% block title%}{{questboard.name}}{% endblock %} {% block extra_content %}
{% block styles %}
<link rel = "stylesheet" href = "{% static 'board/board.css' %}">
{% endblock %}
{% block header %}{{questboard.name}}{% endblock %}
{% block content %}
Required Stars: {{questboard.required_stars}}<br/>
{{questboard.description}}<br/>
{% if quests %}
Quests in the Questboard:
<ul>
{% for quest in quests %}
<li>{{quest.name}}</li>
{% endfor %}
<ul>
{% endif %}
<button onclick="showAddQuest()">Add Quest</button> <button onclick="showAddQuest()">Add Quest</button>
<dialog id="add_quest"> <dialog id="add_quest">
...@@ -33,11 +12,10 @@ Required Stars: {{questboard.required_stars}}<br/> ...@@ -33,11 +12,10 @@ Required Stars: {{questboard.required_stars}}<br/>
</form> </form>
<button onclick = "closeAllDialogBoxes()">Cancel</button> <button onclick = "closeAllDialogBoxes()">Cancel</button>
</dialog> </dialog>
{% endblock %} {% endblock %}
{% block scripts %}
{% block extra_scripts %}
<script> <script>
AddQuest = document.getElementById('add_quest'); AddQuest = document.getElementById('add_quest');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment