diff options
author | adityacp | 2020-09-07 12:53:08 +0530 |
---|---|---|
committer | adityacp | 2020-09-07 12:53:08 +0530 |
commit | 7e5608d0853d69358c14f9fb8fbd6465e21b8962 (patch) | |
tree | 949aeb4303f7cdd8cdd106977b0a06dcd6d5b8af /yaksh/templates | |
parent | d22930f72652b0b306dd491767e8368280bb8266 (diff) | |
download | online_test-7e5608d0853d69358c14f9fb8fbd6465e21b8962.tar.gz online_test-7e5608d0853d69358c14f9fb8fbd6465e21b8962.tar.bz2 online_test-7e5608d0853d69358c14f9fb8fbd6465e21b8962.zip |
Add edit and delete table of contents options
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/add_lesson.html | 6 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_topic.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_video_quiz.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_toc.html | 39 |
4 files changed, 40 insertions, 9 deletions
diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html index 62aa881..6018e54 100644 --- a/yaksh/templates/yaksh/add_lesson.html +++ b/yaksh/templates/yaksh/add_lesson.html @@ -158,7 +158,13 @@ <div class="card-body"> {% if lesson_form.instance and lesson_form.instance.video_path %} {% with lesson_form.instance.video_path|video_name as video %} + {% if video.1 == "others" %} + <video id="player" playsinline controls> + <source src="{{video.0}}" /> + </video> + {% else %} <div id="player" data-plyr-provider="{{video.1}}" data-plyr-embed-id="{{video.0}}"></div> + {% endif %} <br> <form action="{% url 'yaksh:add_marker' course_id lesson_form.instance.id %}" method="POST" id="marker-form" name="marker-form"> {% csrf_token %} diff --git a/yaksh/templates/yaksh/add_topic.html b/yaksh/templates/yaksh/add_topic.html index 8c8fdb3..52923e7 100644 --- a/yaksh/templates/yaksh/add_topic.html +++ b/yaksh/templates/yaksh/add_topic.html @@ -1,5 +1,5 @@ {% if topic_id %} -<form class="form-group" method="POST" action="{% url 'yaksh:edit_topic' content_type course_id lesson_id topic_id %}" id="topic-form"> +<form class="form-group" method="POST" action="{% url 'yaksh:edit_topic' content_type course_id lesson_id toc_id topic_id %}" id="topic-form"> {% else %} <form class="form-group" method="POST" action="{% url 'yaksh:add_topic' content_type course_id lesson_id %}" id="topic-form"> {% endif %} diff --git a/yaksh/templates/yaksh/add_video_quiz.html b/yaksh/templates/yaksh/add_video_quiz.html index cf59fcb..ad087bc 100644 --- a/yaksh/templates/yaksh/add_video_quiz.html +++ b/yaksh/templates/yaksh/add_video_quiz.html @@ -3,7 +3,7 @@ <script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"> </script> {% if question_id %} -<form class="form-group" method="POST" action="{% url 'yaksh:edit_marker_quiz' content_type course_id lesson_id question_id %}" id="question-form"> +<form class="form-group" method="POST" action="{% url 'yaksh:edit_marker_quiz' content_type course_id lesson_id toc_id question_id %}" id="question-form"> {% else %} <form class="form-group" method="POST" action="{% url 'yaksh:add_marker_quiz' content_type course_id lesson_id %}" id="question-form"> {% endif %} diff --git a/yaksh/templates/yaksh/show_toc.html b/yaksh/templates/yaksh/show_toc.html index 85bcf40..b263652 100644 --- a/yaksh/templates/yaksh/show_toc.html +++ b/yaksh/templates/yaksh/show_toc.html @@ -1,8 +1,9 @@ <table class="table table-responsive-sm"> {% for toc in contents %} + {% with toc.get_toc_text as toc_name %} <tr> <td> - {{ toc.get_toc_text }} + {{ toc_name }} </td> <td> {{toc.get_content_display}} @@ -12,18 +13,42 @@ </td> <td> {% if toc.content == 1 %} - <a href="#" class="btn btn-outline-primary" data-url="{% url 'yaksh:edit_topic' toc.content toc.course_id toc.lesson_id toc.object_id %}"> + <a href="#" class="btn btn-outline-info" data-url="{% url 'yaksh:edit_topic' toc.content toc.course_id toc.lesson_id toc.id toc.object_id %}" id="edit-toc" onclick="edit_toc(this)"> {% else %} - <a href="#" class="btn btn-outline-primary" data-url="{% url 'yaksh:edit_marker_quiz' toc.content toc.course_id toc.lesson_id toc.object_id %}"> + <a href="#" class="btn btn-outline-info" data-url="{% url 'yaksh:edit_marker_quiz' toc.content toc.course_id toc.lesson_id toc.id toc.object_id %}" id="edit-toc" onclick="edit_toc(this)"> {% endif %} - <i class="fa fa-edit"> Edit</i> + <i class="fa fa-edit"></i> Edit </a> </td> <td> - <a href="#" class="btn btn-outline-danger"> - <i class="fa fa-trash"> Delete</i> - </a> + <form action="{% url 'yaksh:delete_toc' toc.course_id toc.id %}" method="POST"> + {% csrf_token %} + <input type="hidden" name="redirect_url" id="redirect_url" class="hidden"> + <button class="btn btn-outline-danger" type="submit" onclick="return confirm('Are you sure you want to remove {{toc_name|capfirst}}?')"> + <i class="fa fa-trash"></i> Remove + </button> + </form> </td> </tr> + {% endwith %} +{% empty %} + <center> + <span class="badge badge-warning">No Table of contents added</span> + </center> {% endfor %} +<script type="text/javascript"> + $(document).ready(function() { + var divs = document.getElementsByClassName("hidden"); + for(var i = 0; i < divs.length; i++) + { + divs[i].value = window.location.pathname; + } + }); + + function edit_toc(obj) { + var url = obj.getAttribute("data-url"); + lock_screen(); + ajax_call(url, "GET"); + } +</script> </table>
\ No newline at end of file |