summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2017-08-22 12:22:32 +0530
committeradityacp2017-08-22 12:22:32 +0530
commitdade8a89e3e3f882aa05f974feed1b7248fd6de8 (patch)
tree474670d1556c7225389f19b321a475ee8ddc1959
parent30bd1c36a4abea6c6afea3a52d3a84d335c5673a (diff)
downloadonline_test-dade8a89e3e3f882aa05f974feed1b7248fd6de8.tar.gz
online_test-dade8a89e3e3f882aa05f974feed1b7248fd6de8.tar.bz2
online_test-dade8a89e3e3f882aa05f974feed1b7248fd6de8.zip
Change course.js, course_detail.html and views.py
- Change form submission for send email in js - Change template and view variable for mail status
-rw-r--r--yaksh/static/yaksh/js/course.js31
-rw-r--r--yaksh/templates/yaksh/course_detail.html4
-rw-r--r--yaksh/views.py2
3 files changed, 15 insertions, 22 deletions
diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js
index 0eeb017..8fb2773 100644
--- a/yaksh/static/yaksh/js/course.js
+++ b/yaksh/static/yaksh/js/course.js
@@ -38,7 +38,7 @@ $(".reject").change( function(){
$(function() {
$('textarea#email_body').froalaEditor({
- heightMin: 100,
+ heightMin: 200,
heightMax: 200
})
});
@@ -46,31 +46,24 @@ $(function() {
$("#send_mail").click(function(){
var subject = $("#subject").val();
var body = $('#email_body').val();
- var status;
- if (subject == '' || body == ''){
- status = false;
- $("#error_msg").html("Please enter mail details");
- $("#dialog").dialog();
- }
- else{
- status = true;
- }
- return status;
-});
-
-$('#send_mail_form').submit(function(eventObj) {
+ var status = false;
var selected = [];
$('#reject input:checked').each(function() {
selected.push($(this).attr('value'));
});
- if(selected.length > 0) {
- return true;
+
+ if (subject == '' || body == ''){
+ $("#error_msg").html("Please enter mail details");
+ $("#dialog").dialog();
}
- else {
+ else if (selected.length == 0){
$("#error_msg").html("Please select atleast one user");
- $( "#dialog" ).dialog();
- return false;
+ $("#dialog").dialog();
}
+ else {
+ status = true;
+ }
+ return status;
});
});
diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html
index 1f0e894..bcada42 100644
--- a/yaksh/templates/yaksh/course_detail.html
+++ b/yaksh/templates/yaksh/course_detail.html
@@ -20,7 +20,7 @@
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
- {% if status == 'mail'%}
+ {% if state == 'mail'%}
<li><a href="{{URL_ROOT}}/exam/manage/course_detail/{{course.id}}/">
Go to Course Details</a></li>
{% else %}
@@ -55,7 +55,7 @@
</center>
</div>
{% endif %}
- {% if status == 'mail' %}
+ {% if state == 'mail' %}
<div id="enrolled-students">
<center><b><u>Send Mails to Students</u></b></center><br>
{% if course.get_enrolled %}
diff --git a/yaksh/views.py b/yaksh/views.py
index b4ab9bb..db45a89 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -759,7 +759,7 @@ def send_mail(request, course_id, user_id=None):
)
context = {
'course': course, 'message': message,
- 'status': 'mail'
+ 'state': 'mail'
}
return my_render_to_response(
'yaksh/course_detail.html', context, context_instance=ci