diff options
-rw-r--r-- | yaksh/static/yaksh/js/course.js | 31 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_detail.html | 4 | ||||
-rw-r--r-- | yaksh/views.py | 2 |
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 |