Commit bccb11397518cd5061c62608aad692a083c49e9b

Authored by Jailson Dias
2 parents 718fab64 82b0fe85

Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev

files/templates/files/delete_file.html
@@ -15,16 +15,6 @@ @@ -15,16 +15,6 @@
15 <!-- Card --> 15 <!-- Card -->
16 <form class="form-horizontal" method="post" id="form-delete-file" enctype="multipart/form-data"> 16 <form class="form-horizontal" method="post" id="form-delete-file" enctype="multipart/form-data">
17 {% csrf_token %} 17 {% csrf_token %}
18 - {% if messages %}  
19 - {% for message in messages %}  
20 - <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">  
21 - <button type="button" class="close" data-dismiss="alert" aria-label="Close">  
22 - <span aria-hidden="true">&times;</span>  
23 - </button>  
24 - <p>{{ message }}</p>  
25 - </div>  
26 - {% endfor %}  
27 - {% endif %}  
28 <fieldset> 18 <fieldset>
29 <div class="col-md-12"> 19 <div class="col-md-12">
30 {% trans "Are you sure to delete " %}<a href="{{ file.file_url.url }}" target="_blank" > {{ file.name }} </a> of {{ file.topic.name }}? 20 {% trans "Are you sure to delete " %}<a href="{{ file.file_url.url }}" target="_blank" > {{ file.name }} </a> of {{ file.topic.name }}?
@@ -62,6 +52,7 @@ @@ -62,6 +52,7 @@
62 $('#file_{{ file.slug }}').remove(); 52 $('#file_{{ file.slug }}').remove();
63 $('#file_edit_icon_{{ file.slug }}').remove(); 53 $('#file_edit_icon_{{ file.slug }}').remove();
64 $('#file_edit_{{ file.slug }}').remove(); 54 $('#file_edit_{{ file.slug }}').remove();
  55 + alertify.success(" {% trans 'File successfully deleted!' %} ");
65 }, 56 },
66 error: function(data){ 57 error: function(data){
67 // $('.erro-update').html(data.responseText); 58 // $('.erro-update').html(data.responseText);
@@ -74,4 +65,4 @@ @@ -74,4 +65,4 @@
74 }); 65 });
75 </script> 66 </script>
76 {% endblock script_file %} 67 {% endblock script_file %}
77 -<!-- EndModal -->  
78 \ No newline at end of file 68 \ No newline at end of file
  69 +<!-- EndModal -->
files/templates/files/update_file.html
@@ -15,16 +15,6 @@ @@ -15,16 +15,6 @@
15 <!-- Card --> 15 <!-- Card -->
16 <form class="form-horizontal" method="post" id="form-update-file" enctype="multipart/form-data"> 16 <form class="form-horizontal" method="post" id="form-update-file" enctype="multipart/form-data">
17 {% csrf_token %} 17 {% csrf_token %}
18 - {% if messages %}  
19 - {% for message in messages %}  
20 - <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">  
21 - <button type="button" class="close" data-dismiss="alert" aria-label="Close">  
22 - <span aria-hidden="true">&times;</span>  
23 - </button>  
24 - <p>{{ message }}</p>  
25 - </div>  
26 - {% endfor %}  
27 - {% endif %}  
28 <fieldset> 18 <fieldset>
29 {% for field in form %} 19 {% for field in form %}
30 <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput"> 20 <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput">
@@ -106,6 +96,7 @@ @@ -106,6 +96,7 @@
106 $('#fileUpdateModal').modal('hide'); 96 $('#fileUpdateModal').modal('hide');
107 $('#file_edit_{{ file.slug }}').replaceWith(data); 97 $('#file_edit_{{ file.slug }}').replaceWith(data);
108 $('#file_{{ file.slug }}').replaceWith(data); 98 $('#file_{{ file.slug }}').replaceWith(data);
  99 + alertify.success(" {% trans 'File successfully updated!' %} ");
109 }, 100 },
110 error: function(data){ 101 error: function(data){
111 $('.erro-update').html(data.responseText); 102 $('.erro-update').html(data.responseText);
@@ -117,4 +108,4 @@ @@ -117,4 +108,4 @@
117 }); 108 });
118 </script> 109 </script>
119 {% endblock script_file %} 110 {% endblock script_file %}
120 -<!-- EndModal -->  
121 \ No newline at end of file 111 \ No newline at end of file
  112 +<!-- EndModal -->
links/views.py
@@ -115,7 +115,7 @@ class DeleteLink(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.DeleteView) @@ -115,7 +115,7 @@ class DeleteLink(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.DeleteView)
115 115
116 def dispatch(self, *args, **kwargs): 116 def dispatch(self, *args, **kwargs):
117 link = get_object_or_404(Link, slug = self.kwargs.get('slug')) 117 link = get_object_or_404(Link, slug = self.kwargs.get('slug'))
118 - if(not (link.topic.owner == self.request.user) and not(has_role(self.request.user, 'system_admin')) ): 118 + if(not (has_role(self.request.user, 'professor')) or not(has_role(self.request.user, 'system_admin')) ):
119 return self.handle_no_permission() 119 return self.handle_no_permission()
120 return super(DeleteLink, self).dispatch(*args, **kwargs) 120 return super(DeleteLink, self).dispatch(*args, **kwargs)
121 121