diff options
author | adityacp | 2020-09-03 18:21:40 +0530 |
---|---|---|
committer | adityacp | 2020-09-03 18:21:40 +0530 |
commit | d22930f72652b0b306dd491767e8368280bb8266 (patch) | |
tree | d225e81dd26895b53e4d4f17ca44bb42d8d62aee /yaksh/templates | |
parent | 23c6caab733f5bba6458a07a6666a0580ee2e6a9 (diff) | |
download | online_test-d22930f72652b0b306dd491767e8368280bb8266.tar.gz online_test-d22930f72652b0b306dd491767e8368280bb8266.tar.bz2 online_test-d22930f72652b0b306dd491767e8368280bb8266.zip |
Show table of contents on adding new content
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/add_lesson.html | 10 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_topic.html | 4 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_video_quiz.html | 32 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_toc.html | 29 |
4 files changed, 60 insertions, 15 deletions
diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html index 71477e7..62aa881 100644 --- a/yaksh/templates/yaksh/add_lesson.html +++ b/yaksh/templates/yaksh/add_lesson.html @@ -146,8 +146,8 @@ Table Of Contents <i class="fa fa-angle-down"></i> </a> </div> - <div class="collapse hide" id="toc-collapse"> - <div class="card-body" id="toc"></div> + <div class="collapse show" id="toc-collapse"> + <div class="card-body" id="toc">{{toc}}</div> </div> </div> <br> @@ -160,11 +160,7 @@ {% with lesson_form.instance.video_path|video_name as video %} <div id="player" data-plyr-provider="{{video.1}}" data-plyr-embed-id="{{video.0}}"></div> <br> - <div style="display: none" id="loader"> - <span class="spinner-border text-success"></span> - Loading... - </div> - <form action="{% url 'yaksh:add_marker' course_id lesson_form.instance.id %}" method="POST" id="marker-form"> + <form action="{% url 'yaksh:add_marker' course_id lesson_form.instance.id %}" method="POST" id="marker-form" name="marker-form"> {% csrf_token %} <div class="row"> <div class="col-md-3"> diff --git a/yaksh/templates/yaksh/add_topic.html b/yaksh/templates/yaksh/add_topic.html index 6f88a88..8c8fdb3 100644 --- a/yaksh/templates/yaksh/add_topic.html +++ b/yaksh/templates/yaksh/add_topic.html @@ -1,7 +1,7 @@ {% if topic_id %} -<form class="form-group" method="POST" action="{% url 'yaksh:edit_topic' 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 topic_id %}" id="topic-form"> {% else %} -<form class="form-group" method="POST" action="{% url 'yaksh:add_topic' course_id lesson_id %}" id="topic-form"> +<form class="form-group" method="POST" action="{% url 'yaksh:add_topic' content_type course_id lesson_id %}" id="topic-form"> {% endif %} {% csrf_token %} {{ form.as_p }} diff --git a/yaksh/templates/yaksh/add_video_quiz.html b/yaksh/templates/yaksh/add_video_quiz.html index 5c8db5f..cf59fcb 100644 --- a/yaksh/templates/yaksh/add_video_quiz.html +++ b/yaksh/templates/yaksh/add_video_quiz.html @@ -1,7 +1,11 @@ +{% load static %} +<script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> +<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' 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 question_id %}" id="question-form"> {% else %} -<form class="form-group" method="POST" action="{% url 'yaksh:add_marker_quiz' course_id lesson_id %}" id="question-form"> +<form class="form-group" method="POST" action="{% url 'yaksh:add_marker_quiz' content_type course_id lesson_id %}" id="question-form"> {% endif %} {% csrf_token %} <table class="table table-responsive-sm"> @@ -39,7 +43,7 @@ </button> </form> <script type="text/javascript"> - $(document).ready(function(){ + $(document).ready(function() { var tc_type = "#id_"+"{{tc_class}}"+"_set-TOTAL_FORMS"; $('#add_more').click(function() { var form_idx = $(tc_type).val(); @@ -53,22 +57,38 @@ $(this).find('input[type=number]').addClass("form-control"); }); let option = $('#id_language').val(); - console.log(option); if(option === 'other') { $('#id_topic').closest('tr').show(); + $('#id_topic').prop("required", true); } else { $('#id_topic').closest('tr').hide(); + $('#id_topic').prop("required", false); } $('#id_language').on('change', function() { let lang_value = $(this).val(); - console.log(lang_value); if (lang_value === "other") { $('#id_topic').closest('tr').show(); + $('#id_topic').prop("required", true); $('#id_type').children("option[value='code']").hide(); } else { $('#id_topic').closest('tr').hide(); + $('#id_topic').prop("required", false); $('#id_type').children("option[value='code']").show(); } }); + function init_editor() { + tinymce.init({ + selector : "textarea", + setup : function(ed) { + ed.on('change', function(e) { + tinymce.triggerSave(); + }); + }, + max_height: 400, + height: 400, + plugins: "image code link", + convert_urls: false + }); + } }); -</script> +</script>
\ No newline at end of file diff --git a/yaksh/templates/yaksh/show_toc.html b/yaksh/templates/yaksh/show_toc.html new file mode 100644 index 0000000..85bcf40 --- /dev/null +++ b/yaksh/templates/yaksh/show_toc.html @@ -0,0 +1,29 @@ +<table class="table table-responsive-sm"> +{% for toc in contents %} + <tr> + <td> + {{ toc.get_toc_text }} + </td> + <td> + {{toc.get_content_display}} + </td> + <td> + {{toc.time}} + </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 %}"> + {% 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 %}"> + {% endif %} + <i class="fa fa-edit"> Edit</i> + </a> + </td> + <td> + <a href="#" class="btn btn-outline-danger"> + <i class="fa fa-trash"> Delete</i> + </a> + </td> + </tr> +{% endfor %} +</table>
\ No newline at end of file |