diff --git a/rapids/templates/rapids/question_display_block.html b/rapids/templates/rapids/question_display_block.html
index 19b368f5..38154a6a 100755
--- a/rapids/templates/rapids/question_display_block.html
+++ b/rapids/templates/rapids/question_display_block.html
@@ -92,127 +92,126 @@
/* beautify ignore:end */
$("#toggle-normal-button").click(function () {
- $.ajax({
- url: "{% url 'rapid-detail' question.id %}",
- type: 'PATCH',
- headers: {
- "X-CSRFToken": "{{ csrf_token }}"
- },
- timeout: 3000,
- data: {
- csrfmiddlewaretoken: "{{ csrf_token }}",
- normal: n,
- }
- })
- .done(function (data) {
- console.log(data);
- toastr.info('Answer saved')
- }
- })
- .fail(function () {
- alert('Error updating this model instance.');
- //chk_status_field.prop('checked', !chk_status_field.prop('checked'));
- });
+ $.ajax({
+ url: "{% url 'rapid-detail' question.id %}",
+ type: 'PATCH',
+ headers: {
+ "X-CSRFToken": "{{ csrf_token }}"
+ },
+ timeout: 3000,
+ data: {
+ csrfmiddlewaretoken: "{{ csrf_token }}",
+ normal: n,
+ }
+ })
+ .done(function (data) {
+ console.log(data);
+ toastr.info('Answer saved')
+ })
+ .fail(function () {
+ alert('Error updating this model instance.');
+ //chk_status_field.prop('checked', !chk_status_field.prop('checked'));
+ });
});
- $(".suggested_answers li").each((n, el) => {
- $(el).append($("[Add Correct]").on("click", function () {
- $.ajax({
- url: "{% url 'answer_submit' %}",
- data: {
- csrfmiddlewaretoken: "{{ csrf_token }}",
- //active: this.checked // true if checked else false
- question_type: "rapid",
- qid: "{{question.pk}}",
- status: 2,
- answer: el.dataset.string,
- },
- type: "POST",
- dataType: "json",
- })
- // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
- .done(function (data) {
- console.log(data);
+ $(".suggested_answers li").each((n, el) => {
+ $(el).append($("[Add Correct]").on("click", function () {
+ $.ajax({
+ url: "{% url 'answer_submit' %}",
+ data: {
+ csrfmiddlewaretoken: "{{ csrf_token }}",
+ //active: this.checked // true if checked else false
+ question_type: "rapid",
+ qid: "{{question.pk}}",
+ status: 2,
+ answer: el.dataset.string,
+ },
+ type: "POST",
+ dataType: "json",
+ })
+ // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
+ .done(function (data) {
+ console.log(data);
- if (data.success) {
- toastr.info('Answer saved')
- $(el).find(".correct").remove()
- }
- // show some message according to the response.
- // For eg. A message box showing that the status has been changed
- })
- .always(function () {
- console.log('[Done]');
- })
- }))
+ if (data.success) {
+ toastr.info('Answer saved')
+ $(el).find(".correct").remove()
+ }
+ // show some message according to the response.
+ // For eg. A message box showing that the status has been changed
+ })
+ .always(function () {
+ console.log('[Done]');
+ })
+ }))
- });
+ });
- // send request to change the is_private state on customSwitches toggle
- $(".proposed-answer").each((n, el) => {
+ // send request to change the is_private state on customSwitches toggle
+ $(".proposed-answer").each((n, el) => {
- // Add button to confirm answer is correct
- $(el).append($("[Add Correct]").on("click", function () {
- $.ajax({
- url: "{% url 'answer_suggestion_confirm' %}",
- data: {
- csrfmiddlewaretoken: "{{ csrf_token }}",
- //active: this.checked // true if checked else false
- question_type: "rapid",
- aid: el.dataset.aid,
- status: 2,
- },
- type: "POST",
- dataType: "json",
- })
- // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
- .done(function (data) {
- console.log(data);
+ // Add button to confirm answer is correct
+ $(el).append($("[Add Correct]").on("click", function () {
+ $.ajax({
+ url: "{% url 'answer_suggestion_confirm' %}",
+ data: {
+ csrfmiddlewaretoken: "{{ csrf_token }}",
+ //active: this.checked // true if checked else false
+ question_type: "rapid",
+ aid: el.dataset.aid,
+ status: 2,
+ },
+ type: "POST",
+ dataType: "json",
+ })
+ // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
+ .done(function (data) {
+ console.log(data);
- if (data.success) {
- toastr.info('Answer saved')
- $(el).find(".confirm").remove()
- $(el).removeClass("proposed-answer")
- }
- // show some message according to the response.
- // For eg. A message box showing that the status has been changed
- })
- .always(function () {
- console.log('[Done]');
- })
- }))
+ if (data.success) {
+ toastr.info('Answer saved')
+ $(el).find(".confirm").remove()
+ $(el).removeClass("proposed-answer")
+ }
+ // show some message according to the response.
+ // For eg. A message box showing that the status has been changed
+ })
+ .always(function () {
+ console.log('[Done]');
+ })
+ }))
- // Add button to confirm answer is incorrect
- $(el).append($("[Incorrect]").on("click", function () {
- $.ajax({
- url: "{% url 'answer_suggestion_confirm' %}",
- data: {
- csrfmiddlewaretoken: "{{ csrf_token }}",
- //active: this.checked // true if checked else false
- question_type: "rapid",
- aid: el.dataset.aid,
- status: 0,
- },
- type: "POST",
- dataType: "json",
- })
- // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
- .done(function (data) {
- console.log(data);
+ // Add button to confirm answer is incorrect
+ $(el).append($("[Incorrect]").on("click", function () {
+ $.ajax({
+ url: "{% url 'answer_suggestion_confirm' %}",
+ data: {
+ csrfmiddlewaretoken: "{{ csrf_token }}",
+ //active: this.checked // true if checked else false
+ question_type: "rapid",
+ aid: el.dataset.aid,
+ status: 0,
+ },
+ type: "POST",
+ dataType: "json",
+ })
+ // $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
+ .done(function (data) {
+ console.log(data);
- if (data.success) {
- toastr.info('Answer saved')
- $(el).find(".confirm").remove()
- $(el).removeClass("proposed-answer")
- }
- // show some message according to the response.
- // For eg. A message box showing that the status has been changed
- })
- .always(function () {
- console.log('[Done]');
- })
- }))
- });
+ if (data.success) {
+ toastr.info('Answer saved')
+ $(el).find(".confirm").remove()
+ $(el).removeClass("proposed-answer")
+ }
+ // show some message according to the response.
+ // For eg. A message box showing that the status has been changed
+ })
+ .always(function () {
+ console.log('[Done]');
+ })
+ }))
+ });
});