diff --git a/courses/forms.py b/courses/forms.py index 335e504..eb75607 100644 --- a/courses/forms.py +++ b/courses/forms.py @@ -5,7 +5,7 @@ class CourseForm(forms.ModelForm): class Meta: model = Course fields = ('name', 'category', 'coordenator','public') labels = { 'name': _('Name'), 'category': _('Category'), 'coordenator': _('Coordenator'), 'public':_('Public'), } help_texts = { 'name': _('Course name'), 'coordenator': _('Course Coordenator'), 'public':_('To define if the course can be accessed by people not registered'), } widgets = { 'category': forms.Select(), 'coordenator': forms.Select(), } class UpdateCourseForm(CourseForm): - class Meta: model = Course fields = ('name', 'category', 'coordenator','public') labels = { 'name': _('Name'), 'category': _('Category'), 'coordenator': _('Coordenator'), 'public':_('Public'), } help_texts = { 'name': _('Course name'), 'coordenator': _('Course Coordenator'), 'public':_('To define if the course can be accessed by people not registered'), } widgets = { 'category': forms.Select(), 'coordenator': forms.Select(), } class SubjectForm(forms.ModelForm): def clean_end_date(self): init_date = self.cleaned_data['init_date'] end_date = self.cleaned_data['end_date'] if init_date and end_date and end_date < init_date: raise forms.ValidationError(_('The end date may not be before the start date.')) return end_date + class Meta: model = Course fields = ('name', 'category', 'coordenator','public') labels = { 'name': _('Name'), 'category': _('Category'), 'coordenator': _('Coordenator'), 'public':_('Public'), } help_texts = { 'name': _('Course name'), 'coordenator': _('Course Coordenator'), 'public':_('To define if the course can be accessed by people not registered'), } widgets = { 'category': forms.Select(), 'coordenator': forms.Select(), } class SubjectForm(forms.ModelForm): def clean_end_date(self): end_date = self.cleaned_data['end_date'] if('init_date' in self.cleaned_data): init_date = self.cleaned_data['init_date'] if init_date and end_date and end_date < init_date: raise forms.ValidationError(_('The end date may not be before the start date.')) return end_date class Meta: model = Subject fields = ('name', 'description','init_date', 'end_date', 'visible',) labels = { 'name': _('Name'), 'description': _('Description'), 'init_date': _('Start date'), 'end_date': _('End date'), 'visible': _('Is it visible?'), } help_texts = { 'name': _("Subjects's name"), 'description': _("Subjects's description"), 'init_date': _('Start date of the subject'), 'end_date': _('End date of the subject'), 'visible': _('Is the subject visible?'), } widgets = { 'description':SummernoteWidget(), } class TopicForm(forms.ModelForm): class Meta: model = Topic fields = ('name', 'description',) labels = { 'name': _('Name'), 'description': _('Description'), } help_texts = { 'name': _("Topic's name"), 'description': _("Topic's description"), } widgets = { 'description':SummernoteWidget(), } diff --git a/courses/static/js/course.js b/courses/static/js/course.js index 102403d..6c84328 100644 --- a/courses/static/js/course.js +++ b/courses/static/js/course.js @@ -55,9 +55,11 @@ function subscribe(elem, url, id, confirm_message) { var RemoveCourse = { remove: function(url,dados,id_li_link){ - $('#course').modal('hide'); + $('#course').modal().hide(); $.post(url,dados, function(data){ $(id_li_link).remove(); + // alert("certo"); + $('body').removeClass('modal-open'); $("#modal_course").empty(); $(".modal-backdrop.in").remove(); alertify.success("Course removed successfully!"); diff --git a/courses/static/js/modal_subject.js b/courses/static/js/modal_subject.js index 3b04765..d62ad49 100644 --- a/courses/static/js/modal_subject.js +++ b/courses/static/js/modal_subject.js @@ -1,31 +1,27 @@ var RemoveSubject = { remove: function(url,dados,id_li_link){ - $('#subject').modal('hide'); + $("#subject").modal('toggle'); $.post(url,dados, function(data){ $(id_li_link).remove(); - $("#modal_subject").empty(); - $("#accordion").remove(); + $('body').removeClass('modal-open'); + $("#modal_course").empty(); $(".modal-backdrop.in").remove(); alertify.success("Subject removed successfully!"); - setTimeout(function () { location.reload(1); }, 2000); }).fail(function(){ - $("#modal_subject").empty(); - $("#modal_subject").append(data); + $("#modal_course").empty(); + $("#modal_course").append(data); $('#subject').modal('show'); }); } } - var delete_subject = { get: function (url, id_modal, id_div_modal){ $.get(url, function(data){ if($(id_modal).length){ $(id_div_modal).empty(); - $(id_div_modal).append(data); - } else { - $(id_div_modal).append(data); } + $(id_div_modal).append(data); $(id_modal).modal('show'); }); } -}; \ No newline at end of file +}; diff --git a/courses/templates/course/delete.html b/courses/templates/course/delete.html index ef11ebf..5d4824c 100644 --- a/courses/templates/course/delete.html +++ b/courses/templates/course/delete.html @@ -34,5 +34,3 @@ - - diff --git a/courses/templates/course/view.html b/courses/templates/course/view.html index 2263029..6b44497 100644 --- a/courses/templates/course/view.html +++ b/courses/templates/course/view.html @@ -64,7 +64,7 @@ alertify.success('{{message}}');