Commit 14fa7c5d40e97e4b3c19a5484e9bd9afb6279cd5
1 parent
b725f573
Exists in
master
and in
2 other branches
Criando o modal de deletar usuários pelo admin e remover a conta de usuário
Showing
5 changed files
with
54 additions
and
72 deletions
Show diff stats
amadeus/templates/base.html
... | ... | @@ -44,7 +44,8 @@ |
44 | 44 | <script type="text/javascript" src="{% static 'js/alertify.min.js' %}"></script> |
45 | 45 | <script type="text/javascript" src="{% static 'js/jscookie.js' %}"></script> |
46 | 46 | <script type="text/javascript" src="{% static 'js/jPages.js' %}"></script> |
47 | - <script type="text/javascript" src="{% static "js/d3.min.js" %}"></script> | |
47 | + <script type="text/javascript" src="{% static 'js/d3.min.js' %}"></script> | |
48 | + <script type="text/javascript" src="{% static 'subjects/js/modal_subject.js' %}"></script> | |
48 | 49 | |
49 | 50 | <!-- Font awesome --> |
50 | 51 | <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}"> |
... | ... | @@ -151,7 +152,7 @@ |
151 | 152 | <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> |
152 | 153 | <li><a href="{% url 'users:edit_profile' %}">{% trans 'Edit Profile' %}</a></li> |
153 | 154 | <li><a href="{% url 'users:change_pass' %}">{% trans 'Change Password' %}</a></li> |
154 | - <li><a href="{% url 'users:remove_acc' %}">{% trans 'Delete Account' %}</a></li> | |
155 | + <li><a href="javascript:delete_subject.get('{% url 'users:remove_acc' %}','#remove_account','#remove_acc')">{% trans 'Delete Account' %}</a></li> | |
155 | 156 | <li><a href="{% url 'users:logout' %}">{% trans 'Logout' %}</a></li> |
156 | 157 | </ul> |
157 | 158 | </li> |
... | ... | @@ -306,6 +307,9 @@ |
306 | 307 | |
307 | 308 | }); |
308 | 309 | </script> |
310 | + <div id="remove_acc"> | |
311 | + | |
312 | + </div> | |
309 | 313 | </body> |
310 | 314 | |
311 | 315 | </html> | ... | ... |
users/templates/users/delete.html
1 | -{% extends 'users/list.html' %} | |
1 | +{% load static i18n permission_tags %} | |
2 | 2 | |
3 | -{% load static i18n %} | |
4 | -{% load widget_tweaks %} | |
5 | -{% load django_bootstrap_breadcrumbs %} | |
6 | - | |
7 | -{% block breadcrumbs %} | |
8 | - {{ block.super }} | |
9 | - {% trans 'Delete User' as bread %} | |
10 | - {% breadcrumb bread 'users:delete' %} | |
11 | -{% endblock %} | |
12 | - | |
13 | -{% block content %} | |
14 | - <div class="row"> | |
15 | - <div class="col-md-12"> | |
16 | - <div class="well well-lg"> | |
17 | - <form action="" method="post"> | |
18 | - {% csrf_token %} | |
19 | - <h2>{% trans 'Are you sure you want delete the user' %}: {{ acc }}?</h2> | |
20 | - <p>{% trans 'All data will be lost and havent how recover it.' %}</p> | |
21 | - <div class="row"> | |
22 | - <div class="col-md-12"> | |
23 | - <div class="pull-left"> | |
24 | - <input type="submit" class="btn btn-raised btn-block btn-success" value="{% trans 'Remove' %}" /> | |
25 | - </div> | |
26 | - <div class="pull-right"> | |
27 | - <a href="{% url 'users:manage' %}" class="btn btn-raised btn-block btn-default" >{% trans 'Cancel' %}</a> | |
28 | - </div> | |
29 | - </div> | |
30 | - </div> | |
31 | - </form> | |
32 | - </div> | |
33 | - </div> | |
3 | +<!-- Modal (remember to change the ids!!!) --> | |
4 | +<div class="modal fade" id="users" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
5 | + <div class="modal-dialog" role="document"> | |
6 | + <div class="modal-content"> | |
7 | + <!-- Modal Body --> | |
8 | + <div class="modal-body"> | |
9 | + <!-- Put ONLY your content here!!! --> | |
10 | + <form id="delete_form" action="{% url 'users:delete' email %}" method="post"> | |
11 | + {% csrf_token %} | |
12 | + <p>{% trans 'Are you sure you want delete the user' %}: {{ acc }}?</p> | |
13 | + </form> | |
14 | + </div> | |
15 | + <!-- Modal Footer --> | |
16 | + <div id="delete-category-footer"class="modal-footer"> | |
17 | + <!-- Don't remove that!!! --> | |
18 | + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button> | |
19 | + <button type="submit" form="delete_form" class="btn btn-success btn-raised erase-button">{% trans "Delete" %}</button> | |
20 | + </div> | |
34 | 21 | </div> |
35 | - <br clear="all" /> | |
36 | -{% endblock %} | |
22 | + </div> | |
23 | +</div> | ... | ... |
users/templates/users/delete_account.html
1 | -{% extends 'users/profile.html' %} | |
1 | +{% load static i18n permission_tags %} | |
2 | 2 | |
3 | -{% load static i18n %} | |
4 | -{% load widget_tweaks %} | |
5 | -{% load django_bootstrap_breadcrumbs %} | |
6 | - | |
7 | -{% block breadcrumbs %} | |
8 | - {{ block.super }} | |
9 | - {% trans 'Remove Account' as bread %} | |
10 | - {% breadcrumb bread 'users:remove_acc' %} | |
11 | -{% endblock %} | |
12 | - | |
13 | -{% block content %} | |
14 | - <div class="row"> | |
15 | - <div class="col-md-12"> | |
16 | - <div class="well well-lg"> | |
17 | - <form action="" method="post"> | |
18 | - {% csrf_token %} | |
19 | - <h2>{% trans 'Are you sure you want delete your account?' %}</h2> | |
20 | - <p>{% trans 'All data will be lost and havent how recover it.' %}</p> | |
21 | - <div class="row"> | |
22 | - <div class="col-md-12"> | |
23 | - <div class="pull-left"> | |
24 | - <input type="submit" class="btn btn-raised btn-block btn-success" value="{% trans 'Remove' %}" /> | |
25 | - </div> | |
26 | - <div class="pull-right"> | |
27 | - <a href="{% url 'users:profile' %}" class="btn btn-raised btn-block btn-default" >{% trans 'Cancel' %}</a> | |
28 | - </div> | |
29 | - </div> | |
30 | - </div> | |
31 | - </form> | |
32 | - </div> | |
33 | - </div> | |
3 | +<!-- Modal (remember to change the ids!!!) --> | |
4 | +<div class="modal fade" id="remove_account" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
5 | + <div class="modal-dialog" role="document"> | |
6 | + <div class="modal-content"> | |
7 | + <!-- Modal Body --> | |
8 | + <div class="modal-body"> | |
9 | + <!-- Put ONLY your content here!!! --> | |
10 | + <form id="delete_form" action="{% url 'users:remove_acc' %}" method="post"> | |
11 | + {% csrf_token %} | |
12 | + <p>{% trans 'Are you sure you want delete your account?' %}</p> | |
13 | + </form> | |
14 | + </div> | |
15 | + <!-- Modal Footer --> | |
16 | + <div id="delete-category-footer" class="modal-footer"> | |
17 | + <!-- Don't remove that!!! --> | |
18 | + <button type="button" class="btn btn-default btn-raised" data-dismiss="modal">{% trans "Close" %}</button> | |
19 | + <button type="submit" form="delete_form" class="btn btn-success btn-raised erase-button">{% trans "Delete" %}</button> | |
20 | + </div> | |
34 | 21 | </div> |
35 | - <br clear="all" /> | |
36 | -{% endblock %} | |
22 | + </div> | |
23 | +</div> | ... | ... |
users/templates/users/list.html
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | <div class="col-md-6"> |
55 | 55 | <p><b>{% trans 'Name' %}:</b> {{ acc }}</p> |
56 | 56 | <p><b>{% trans 'Email' %}:</b> {{ acc.email }}</p> |
57 | - <p><b>{% trans 'Description' %}:</b> | |
57 | + <p><b>{% trans 'Description' %}:</b> | |
58 | 58 | {% autoescape off %} |
59 | 59 | {{ acc.description|default:_("Not Informed")|striptags|truncatechars:300 }} |
60 | 60 | {% endautoescape %} |
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <div class="col-md-3"> |
64 | 64 | <div align="right"> |
65 | 65 | <a href="{% url 'users:update' acc.email %}" class="btn btn-success btn-raised btn-sm"><i class="fa fa-edit"></i> {% trans 'Edit' %}</a> |
66 | - <a href="{% url 'users:delete' acc.email %}" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a> | |
66 | + <a href="javascript:delete_subject.get('{% url 'users:delete' acc.email %}','#users','#modal_remove')" class="btn btn-default btn-raised btn-sm"><i class="fa fa-trash"></i> {% trans 'Delete' %}</a> | |
67 | 67 | </div> |
68 | 68 | </div> |
69 | 69 | </div> |
... | ... | @@ -77,4 +77,7 @@ |
77 | 77 | </div> |
78 | 78 | </div> |
79 | 79 | {% endif %} |
80 | + <div id="modal_remove"> | |
81 | + | |
82 | + </div> | |
80 | 83 | {% endblock %} | ... | ... |
users/views.py
... | ... | @@ -247,6 +247,7 @@ class DeleteView(braces_mixins.LoginRequiredMixin, LogMixin, generic.DeleteView) |
247 | 247 | def get_context_data(self, **kwargs): |
248 | 248 | context = super(DeleteView, self).get_context_data(**kwargs) |
249 | 249 | context['title'] = _('Delete Account') |
250 | + context['email'] = self.kwargs.get('email', None) | |
250 | 251 | |
251 | 252 | return context |
252 | 253 | ... | ... |