add resource course views
This commit is contained in:
parent
cf31735e80
commit
bc2c64f3b8
11 changed files with 358 additions and 30 deletions
4
templates/course/home.html
Normal file
4
templates/course/home.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<h1> {{ title }} - Home </h1>
|
||||
<h2> About: {{ description }} </h2>
|
||||
|
||||
<a href="/courses/{{ course.pk }}-{{ course.slug }}/resource"> See course resource.</a>
|
|
@ -1,19 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Enrolling</h1>
|
||||
{% for course in enrolling %}
|
||||
<h2> {{ course }} </h2>
|
||||
{% endfor %}
|
||||
<ul>
|
||||
{% for course in enrolling %}
|
||||
<li>
|
||||
<a href="/courses/{{ course.pk }}-{{ course.slug }}"> {{ course }} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h1> Available </h1>
|
||||
{% for course in available %}
|
||||
<h2> {{ course }} </h2>
|
||||
{% endfor %}
|
||||
<ul>
|
||||
{% for course in available %}
|
||||
<li>
|
||||
<a href="/courses/{{ course.pk }}-{{ course.slug }}"> {{ course }} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
</html>
|
12
templates/course/resource-content.html
Normal file
12
templates/course/resource-content.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<h1> {{ object }} </h1>
|
||||
<h2> This resource belong to {{ object.course }}</h2>
|
||||
|
||||
<h3> {{ object.description }}</h3>
|
||||
|
||||
<div>
|
||||
{% if object.files != None %}
|
||||
<div> <a href="{{ object.files.url}}" target="_blank"> See files </a> </div>
|
||||
{% endif %}
|
||||
<div> <a href="/courses/{{ object.course.pk }}-{{ object.course.slug }}/resource/{{ object.pk }}/edit"> Edit
|
||||
Resource </a> </div>
|
||||
</div>
|
11
templates/course/resource.html
Normal file
11
templates/course/resource.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<h1> {{ course.name }}'s Resource </h1>
|
||||
|
||||
<ul>
|
||||
{% for resource in object_list %}
|
||||
<li>
|
||||
<a href="/courses/{{ course.pk }}-{{ course.slug }}/resource/{{ resource.pk }}"> {{ resource }} </a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<a href="/courses/{{ course.pk }}-{{ course.slug }}/resource_edit"> Edit resources</a>
|
5
templates/course/resource_detail_edit.html
Normal file
5
templates/course/resource_detail_edit.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<input type="submit" value="Update">
|
||||
</form>
|
33
templates/course/resource_edit.html
Normal file
33
templates/course/resource_edit.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{{ course }}
|
||||
|
||||
<form id="resource-form" method="post" action="">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Delete</th>
|
||||
<th>Order</th>
|
||||
<th>Public</th>
|
||||
<th>Edit link</th>
|
||||
</tr>
|
||||
{% for resource in object_list %}
|
||||
<tr>
|
||||
<td> {{ resource }} </td>
|
||||
<td> <input type="checkbox" name="resource-{{ resource.pk }}-delete" id="resource-{{ resource.pk }}-delete">
|
||||
</td>
|
||||
<td> <input type="number" name="resource-{{ resource.pk }}-order" value="{{
|
||||
resource.order }}" id="resource-{{ resource.pk }}-order"> </a></td>
|
||||
{% if resource.is_public %}
|
||||
<td> <input type="checkbox" name="resource-{{ resource.pk }}-public" id="resource-{{ resource.pk }}-public"
|
||||
checked=""> </a></td>
|
||||
{% else %}
|
||||
<td> <input type="checkbox" name="resource-{{ resource.pk }}-public" id="resource-{{ resource.pk }}-public">
|
||||
</a></td>
|
||||
{% endif %}
|
||||
<td> <a href="/courses/{{ course.pk }}-{{ course.slug }}/resource/{{ resource.pk }}/edit"> Edit </a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue