Commit 80319b7d00600e1c2f791aac9e8319fcf48a0b29
1 parent
750b5ae6
Exists in
master
and in
5 other branches
Render icons #132
Showing
3 changed files
with
5 additions
and
5 deletions
Show diff stats
files/templates/files/delete_file.html
... | ... | @@ -60,8 +60,8 @@ |
60 | 60 | success: function(data) { |
61 | 61 | $('#fileDeleteModal').modal('hide'); |
62 | 62 | $('#file_{{ file.slug }}').remove(); |
63 | - $('#file_edit_{{ file.slug }}').remove(); | |
64 | 63 | $('#file_edit_icon_{{ file.slug }}').remove(); |
64 | + $('#file_edit_{{ file.slug }}').remove(); | |
65 | 65 | }, |
66 | 66 | error: function(data){ |
67 | 67 | // $('.erro-update').html(data.responseText); | ... | ... |
files/templates/files/update_file.html
... | ... | @@ -104,8 +104,8 @@ |
104 | 104 | contentType: false, |
105 | 105 | success: function(data) { |
106 | 106 | $('#fileUpdateModal').modal('hide'); |
107 | - alert(data); | |
108 | - // $('#list-topic-files').append(data); | |
107 | + $('#file_edit_{{ file.slug }}').replaceWith(data); | |
108 | + $('#file_{{ file.slug }}').replaceWith(data); | |
109 | 109 | }, |
110 | 110 | error: function(data){ |
111 | 111 | $('.erro-update').html(data.responseText); | ... | ... |
files/views.py
... | ... | @@ -55,7 +55,7 @@ class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
55 | 55 | |
56 | 56 | self.object.save() |
57 | 57 | |
58 | - return self.render_to_response(self.get_context_data(form = form), status = 200) | |
58 | + return self.get_success_url() | |
59 | 59 | |
60 | 60 | def get_context_data(self, **kwargs): |
61 | 61 | context = super(CreateFile, self).get_context_data(**kwargs) |
... | ... | @@ -70,7 +70,7 @@ class CreateFile(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
70 | 70 | return context |
71 | 71 | |
72 | 72 | def get_success_url(self): |
73 | - self.success_url = reverse('course:file:render_file', args = (self.object.id, )) | |
73 | + self.success_url = redirect('course:file:render_file', id = self.object.id) | |
74 | 74 | |
75 | 75 | return self.success_url |
76 | 76 | ... | ... |