Skip to content
Snippets Groups Projects
Commit 36173705 authored by Odin Johan Vatne's avatar Odin Johan Vatne
Browse files

Add comment section for students

parent da44dbce
Branches
No related tags found
No related merge requests found
#student-priority-list {
padding-inline-start: 1em;
}
#student-applications-list {
padding-inline-start: 0;
}
#student-applications-list li {
margin-left: 2em;
}
.application-status { .application-status {
text-align: center; text-align: center;
background: rgba(207, 255, 180, 0.6); background: rgba(207, 255, 180, 0.6);
...@@ -45,6 +57,25 @@ ...@@ -45,6 +57,25 @@
font-size: small; font-size: small;
} }
.application>div:last-child {
margin-right: 1em;
}
button, input[type=submit] {
padding-bottom: 2px;
}
button {
margin-top: 4px;
}
#new-comment-form textarea {
width: 60em;
height: 1.5em;
resize: vertical;
margin-top: 2px;
margin-bottom: 4px;
}
.priority-number { .priority-number {
font-size: x-large; font-size: x-large;
color: darkcyan; color: darkcyan;
......
{% load custom_filters %} {% load custom_filters %}
{% load html_components %}
<li class="dashed-box application {{application|student_status|minify|lower}} {{application|professor_status|minify|lower}}"> <li class="dashed-box application {{application|student_status|minify|lower}} {{application|professor_status|minify|lower}}">
<div class="application-meta-container"> <div class="application-meta-container">
{% if application.priority %} {% if application.priority %}
...@@ -53,5 +54,7 @@ ...@@ -53,5 +54,7 @@
<hr> <hr>
{% comment %}<em>Description: </em>{{application.project.description}}<br/>{% endcomment %} {% comment %}<em>Description: </em>{{application.project.description}}<br/>{% endcomment %}
{{application.message}} {{application.message}}
<br>
{% application_comment_section application.id comments comment_box=True %}
</div> </div>
</li> </li>
\ No newline at end of file
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
{% block imports %} {% block imports %}
{% load static %} {% load static %}
<script src={% static 'pasapp/js/app_student_edit.js' %}></script> <script src={% static 'pasapp/js/app_student_edit.js' %}></script>
<script src={% static 'pasapp/js/form_redirect.js' %}></script>
{% endblock %} {% endblock %}
{% block onload %} {% endblock %} {% block onload %} addNextRoutes() {% endblock %}
{% block content %} {% block content %}
{% load html_components %} {% load html_components %}
{% load custom_filters %} {% load custom_filters %}
{% if applications %} {% if applications %}
<form action="/applications/update_priorities/" method="post"> <form action="/applications/update_priorities/" method="post">
{% csrf_token %} {% csrf_token %}
<ol> <ol id="student-priority-list">
{% for i in 5|times %} {% for i in 5|times %}
<li> <li>
<select class="prioritySelect" name="priority{{i}}" oninput="checkForConflicts(this)"> <select class="prioritySelect" name="priority{{i}}" oninput="checkForConflicts(this)">
...@@ -34,27 +35,27 @@ ...@@ -34,27 +35,27 @@
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="application" id="status_id"> <input type="hidden" name="application" id="status_id">
<input type="hidden" name="state" id="status_state"> <input type="hidden" name="state" id="status_state">
<ol> </form>
<ol id="student-applications-list">
{% if offeredApplications %} {% if offeredApplications %}
<h2>Extended Offers</h2> <h2>Extended Offers</h2>
{% for application in offeredApplications %} {% for application in offeredApplications %}
{% application_student application True %} {% application_student application comments|for_application:application True %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if openApplications %} {% if openApplications %}
<h2>Pending Applications</h2> <h2>Pending Applications</h2>
{% for application in openApplications %} {% for application in openApplications %}
{% application_student application True %} {% application_student application comments|for_application:application True %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if closedApplications %} {% if closedApplications %}
<h2>Declined Applications</h2> <h2>Declined Applications</h2>
{% for application in closedApplications %} {% for application in closedApplications %}
{% application_student application False %} {% application_student application comments|for_application:application False %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</ol> </ol>
</form>
{% else %} {% else %}
<p>You have no applications to display yet!</p> <p>You have no applications to display yet!</p>
{% endif %} {% endif %}
......
{% extends 'pasapp/templates/base_template.html' %} {% extends 'pasapp/templates/base_template.html' %}
{% block title %} {{project.title}} {% endblock %} {% block title %} {{project.title}} {% endblock %}
{% block imports %}
{% load static %}
<script src={% static 'pasapp/js/form_redirect.js' %}></script>
{% endblock %}
{% block onload %} addNextRoutes() {% endblock %}
{% block content %} {% block content %}
{% load html_components %} {% load html_components %}
<h1>{{project.title}}</h1> <h1>{{project.title}}</h1>
...@@ -25,6 +30,6 @@ ...@@ -25,6 +30,6 @@
{% endif %} {% endif %}
{% if student_application %} {% if student_application %}
<h2>Your application:</h2> <h2>Your application:</h2>
{% application_student student_application %} {% application_student student_application comments|for_application:student_application True %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
...@@ -37,7 +37,7 @@ def tags_dropdown(tags): ...@@ -37,7 +37,7 @@ def tags_dropdown(tags):
return { 'tags': tags } return { 'tags': tags }
@register.inclusion_tag('pasapp/components/application_student.html') @register.inclusion_tag('pasapp/components/application_student.html')
def application_student(application, interactive=False): def application_student(application, comments=[], interactive=False, comment_box=False):
if interactive: if interactive:
checkbox = application.student_status in ('APPL', 'PRE') and application.professor_status in ('NONE') checkbox = application.student_status in ('APPL', 'PRE') and application.professor_status in ('NONE')
responses = application.professor_status in ('OFFR') and application.student_status in ('APPL', 'PRE') # 'PRE' not necessary after automation responses = application.professor_status in ('OFFR') and application.student_status in ('APPL', 'PRE') # 'PRE' not necessary after automation
...@@ -45,7 +45,10 @@ def application_student(application, interactive=False): ...@@ -45,7 +45,10 @@ def application_student(application, interactive=False):
checkbox = responses = False checkbox = responses = False
student_status = application.student_status student_status = application.student_status
professor_status = application.professor_status professor_status = application.professor_status
return { 'application': application, 'studentStatus': student_status, 'professorStatus': professor_status, 'checkbox': checkbox, 'responses': responses } return { 'application': application,
'studentStatus': student_status, 'professorStatus': professor_status,
'checkbox': checkbox, 'responses': responses,
'comments': comments, 'commentBox': comment_box }
@register.inclusion_tag('pasapp/components/application_professor.html') @register.inclusion_tag('pasapp/components/application_professor.html')
def application_professor(application, comments=[], buttons=False, comment_box=False): def application_professor(application, comments=[], buttons=False, comment_box=False):
......
...@@ -70,7 +70,8 @@ def student_project_details(request, project_id): ...@@ -70,7 +70,8 @@ def student_project_details(request, project_id):
num_applicants = Application.objects.filter(project=project_id).count() num_applicants = Application.objects.filter(project=project_id).count()
student_application = Application.objects.filter(project=project_id, student=request.user).first() if is_student(request.user) else None student_application = Application.objects.filter(project=project_id, student=request.user).first() if is_student(request.user) else None
project_tags = ProjectTag.objects.filter(project=project) project_tags = ProjectTag.objects.filter(project=project)
context = {'project': project, 'numApplicants': num_applicants, 'projectTags': project_tags, 'student_application': student_application} comments = Comment.objects.filter(application=student_application)
context = {'project': project, 'numApplicants': num_applicants, 'projectTags': project_tags, 'student_application': student_application, 'comments': comments}
return render(request, 'pasapp/pages/student_project_details.html', contextWithHeader(context, request)) return render(request, 'pasapp/pages/student_project_details.html', contextWithHeader(context, request))
def professor_project_details(request, project_id): def professor_project_details(request, project_id):
...@@ -239,8 +240,10 @@ def student_applications_view(request): ...@@ -239,8 +240,10 @@ def student_applications_view(request):
offered_applications = applications.filter(professor_status=Application.ProfessorStatus.OFFERED) offered_applications = applications.filter(professor_status=Application.ProfessorStatus.OFFERED)
open_applications = applications.filter(professor_status=Application.ProfessorStatus.NONE) open_applications = applications.filter(professor_status=Application.ProfessorStatus.NONE)
closed_applications = applications.filter(professor_status=Application.ProfessorStatus.DECLINED) closed_applications = applications.filter(professor_status=Application.ProfessorStatus.DECLINED)
comments = Comment.objects.filter(application__in=applications)
context = {'applications': applications, 'offeredApplications': offered_applications, context = {'applications': applications, 'offeredApplications': offered_applications,
'openApplications': open_applications, 'closedApplications': closed_applications} 'openApplications': open_applications, 'closedApplications': closed_applications,
'comments': comments}
return render(request, 'pasapp/pages/student_applications.html', contextWithHeader(context, request)) return render(request, 'pasapp/pages/student_applications.html', contextWithHeader(context, request))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment