summaryrefslogtreecommitdiff
path: root/grades/templates/add_grades.html
blob: 29da212c113a3694ed63b5c68cb83d61da4d01bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{% extends "manage.html" %}
{% load static %}
{% load custom_filters %}
{% block title %} Add/Edit Grading {% endblock %}
{% block pagetitle %} Add/Edit Grading {% endblock %}
{% block script %}
    <script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'yaksh/js/add_grades.js' %}"></script>
{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
    <div class="col-md-8">
        <ul class="nav nav-pills" id="course_tabs">
            <li class="nav-item">
                <a class="nav-link" href="{% url 'yaksh:courses' %}">
                    My Courses
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{% url 'yaksh:add_course' %}">
                    Add/Edit Course
                </a>
            </li>
            <li class="nav-item">
                <a href="{% url 'grades:grading_systems'%}" class="active nav-link" >
                    Add/View Grading Systems
                </a>
            </li>
        </ul>
    </div>
</div>
<hr>
<div class="container">
<a href="{% url 'grades:grading_systems'%}" class="btn btn-primary btn-lg">
    View Grading Systems
</a>
<br><br>
<div class="alert alert-info">
    Note: For grade range lower limit is inclusive and upper limit is exclusive
</div>
<br>
{% if messages %}
    {% for message in messages %}
      <div class="alert alert-dismissible alert-{{ message.tags }}">
          <button type="button" class="close" data-dismiss="alert">
              <i class="fa fa-close"></i>
          </button>
          <strong>{{ message }}</strong>
      </div>
    {% endfor %}
    <br>
{% endif %}
{% if not system_id  %}
    <form action="{% url 'grades:add_grade' %}" method="POST">
{% else %}
    <form action="{% url 'grades:edit_grade' system_id %}" method="POST">
{% endif %}
    {% csrf_token %}
    <table class="table table-responsive-sm">
        {% if grade_form.errors %}
            {% for field in grade_form %}
                {% for error in field.errors %}
                    <div class="alert alert-dismissible alert-danger">
                        <button type="button" class="close" data-dismiss="alert">
                            <i class="fa fa-close"></i>
                        </button>
                        <strong>{{ error|escape }}</strong>
                    </div>
                {% endfor %}
            {% endfor %}
            {% for error in grade_form.non_field_errors %}
                <div class="alert alert-dismissible alert-danger">
                    <button type="button" class="close" data-dismiss="alert">
                        <i class="fa fa-close"></i>
                    </button>
                    <strong>{{ error|escape }}</strong>
                </div>
            {% endfor %}
        {% endif %}
        {% for field in grade_form %}
            {{ field }}
            <hr>
        {% endfor %}
        {{ formset.management_form }}
        <br>
        <div class="col">
            {% for form in formset %}
                {% for hidden in form.hidden_fields %}
                    {{ hidden }}
                {% endfor %}
                <b><u>Grade Range {{forloop.counter}}.</u></b>
                    <div class="row">
                    {% for field in form.visible_fields  %}
                      <div class="col-sm-3">
                        {% if field.field.widget|is_checkbox %}
                            {{ field.label_tag }}
                        {% endif %}
                        {{ field }}
                      </div>
                    {% endfor %}
                    </div>
            {% endfor %}
        </div>
    </table>
    {% if not is_default %}
        <input type="submit" id="add" name="add" value="Add/Delete Grade Range" class="btn btn-info btn-lg">
        <input type="submit" id="save" name="save" value="Save" class="btn btn-success btn-lg">
    {% else %}
        <div class="alert alert-warning">
            Note: This is a default grading system. You cannot change this.
        </div>
    {% endif %}
    <br><br>
</form>
</div>
</div>
{% endblock %}