mirror of https://github.com/interlegis/sapl.git
				
				
			
			
			
				Browse Source
			
			
			
			
				
		- elimina view class independentes - elimina form class independentes - impl UserCrud e UserAdminFormpull/3372/head
				 19 changed files with 281 additions and 550 deletions
			
			
		| @ -1,51 +0,0 @@ | |||||
| {% extends "crud/list.html" %} |  | ||||
| {% load i18n %} |  | ||||
| {% load crispy_forms_tags staticfiles %} |  | ||||
| 
 |  | ||||
| {% block base_content %} |  | ||||
| 	{% if not show_results %} |  | ||||
| 		{% crispy filter.form %} |  | ||||
| 		<a href="{% url 'sapl.base:user_create' %}" class="btn btn-outline-primary">{% trans 'Criar usuário' %}</a> |  | ||||
|   {% endif %} |  | ||||
| 
 |  | ||||
| 	{% if show_results %} |  | ||||
|     <div class="actions btn-group float-right" role="group"> |  | ||||
| 			<a href="{% url 'sapl.base:usuario' %}" class="btn btn-outline-primary">{% trans 'Fazer nova pesquisa' %}</a> |  | ||||
| 			<a href="{% url 'sapl.base:user_create' %}" class="btn btn-outline-primary">{% trans 'Criar usuário' %}</a> |  | ||||
|     </div> |  | ||||
|     <br /><br /> |  | ||||
| 		{% if numero_res > 0 %} |  | ||||
| 			{% if numero_res == 1 %} |  | ||||
| 				<p>Foi encontrado {{ numero_res }} resultado</p> |  | ||||
| 			{% else %} |  | ||||
| 				<p>Foram encontrados {{ numero_res }} resultados</p> |  | ||||
| 			{% endif %} |  | ||||
|       <table class="table table-striped table-hover"> |  | ||||
|     	  <thead> |  | ||||
|     	    <tr> |  | ||||
|     				<th>Nome de Usuário</th> |  | ||||
| 						<th>Nome</th> |  | ||||
| 						<th>E-mail do Usuário</th> |  | ||||
|     	    </tr> |  | ||||
|     	  </thead> |  | ||||
|     	  <tbody> |  | ||||
|     			{% for usuario in page_obj %} |  | ||||
|     				<tr> |  | ||||
|     					<td> |  | ||||
| 								<a href="{% url 'sapl.base:user_detail' usuario.pk %}">{{ usuario.username }}</a> |  | ||||
| 							</td> |  | ||||
| 							<td>{{ usuario.first_name }} {{ usuario.last_name }}</td> |  | ||||
| 							<td>{{ usuario.email }}</td> |  | ||||
|     				</tr> |  | ||||
|     			{% endfor %} |  | ||||
|     	  </tbody> |  | ||||
|     	</table> |  | ||||
| 		{% else %} |  | ||||
| 			<font size="4"><p align="center">{{ NO_ENTRIES_MSG }}</p></font> |  | ||||
|     {% endif %} |  | ||||
| 	{% endif %} |  | ||||
| 	 |  | ||||
| 	<br/> |  | ||||
| 	{% include 'paginacao.html'%} |  | ||||
| 	<br /><br /><br /> |  | ||||
| {% endblock base_content %} |  | ||||
| @ -1,19 +1,20 @@ | |||||
| {% extends "base.html" %} | {% extends "crud/form.html" %} | ||||
| {% load i18n crispy_forms_tags %} | {% load i18n %} | ||||
| 
 | 
 | ||||
| {% block base_content %} | {% block extra_js %} | ||||
|  | <script type="text/javascript"> | ||||
|  |   $(() => { | ||||
|  |     var $crf_token = $('[name="csrfmiddlewaretoken"]').attr('value'); | ||||
|  |     $("#renovar-token").click(() => { | ||||
|  |       $.ajax({ | ||||
|  |         url: "{% url 'sapl.api:recria_token' object.id %}", | ||||
|  |         type: "POST", | ||||
|  |         headers: { "X-CSRFToken": $crf_token }, | ||||
|  |         dataType: "json", | ||||
|  |         success: (res) => $("#id_token").val(res.token) | ||||
|  |       }); | ||||
|  |     }); | ||||
|  |   }); | ||||
|  | </script> | ||||
| 
 | 
 | ||||
|     <form action="" method="post"> | {% endblock %} | ||||
|         {% csrf_token %} |  | ||||
|         {% if object.pk %} |  | ||||
|         <div class="actions btn-group float-left" role="group"> |  | ||||
| 			<a href="{% url 'sapl.base:usuario' %}" class="btn btn-outline-primary">{% trans 'Pesquisar usuários' %}</a> |  | ||||
| 			<a href="{% url 'sapl.base:user_create' %}" class="btn btn-outline-primary">{% trans 'Criar usuário' %}</a> |  | ||||
|         </div> |  | ||||
|             <a href="{% url 'sapl.base:user_delete' object.pk %}" class="btn btn-outline-danger float-right">{% trans 'Remover usuário' %}</a> |  | ||||
|             <br /> <br /> |  | ||||
|         {% endif %} |  | ||||
|         {%  crispy form %} |  | ||||
|     </form> |  | ||||
| 	<br /><br /><br /> |  | ||||
| {% endblock base_content %} |  | ||||
| @ -1,57 +0,0 @@ | |||||
| {% extends "crud/detail.html" %} |  | ||||
| {% load i18n %} |  | ||||
| {% load crispy_forms_tags cropping %} |  | ||||
| 
 |  | ||||
| {% block base_content %} |  | ||||
| <div class="actions btn-group float-right " role="group" style="margin: 0px 0px 20px"> |  | ||||
|   <a href="{% url 'sapl.base:usuario' %}" class="btn btn-outline-primary"> |  | ||||
|     {% blocktrans with verbose_name=view.verbose_name %} Fazer nova pesquisa {% endblocktrans %} |  | ||||
|   </a> |  | ||||
|   <a href="{% url 'sapl.base:user_edit' user.pk %}" class="btn btn-outline-primary"> |  | ||||
|     {% blocktrans with verbose_name=view.verbose_name %} Editar usuário {% endblocktrans %} |  | ||||
|   </a> |  | ||||
| </div> |  | ||||
| 
 |  | ||||
| <div> |  | ||||
|   <table class="table table-striped"> |  | ||||
|     <tbody> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Usuário</th> |  | ||||
|         <td>{{ user.username }}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Token</th> |  | ||||
|         <td>{{ token }}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Nome</th> |  | ||||
|         <td>{% firstof user.first_name "-" %}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Sobrenome</th> |  | ||||
|         <td>{% firstof user.last_name "-" %}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Endereço de e-mail</th> |  | ||||
|         <td>{% firstof user.email "-" %}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Usuário ativo?</th> |  | ||||
|         <td>{% if user.is_active %} Sim {% else %} Não {% endif %}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Último acesso</th> |  | ||||
|         <td>{{ user.last_login }}</td> |  | ||||
|       </tr> |  | ||||
|       <tr> |  | ||||
|         <th scope="row">Roles</th> |  | ||||
|         <td><ul style="list-style-type:none"> |  | ||||
|           {% for r in roles %} |  | ||||
|             <li><input type="checkbox" {{ r.checked }} disabled> {{r.group }}</li> |  | ||||
|           {% endfor %} |  | ||||
|         </ul></td> |  | ||||
|       </tr> |  | ||||
|     </tbody> |  | ||||
|   </table> |  | ||||
| </div> |  | ||||
| {% endblock base_content %} |  | ||||
| @ -1,20 +0,0 @@ | |||||
| {% extends "crud/form.html" %} |  | ||||
| {% load i18n %} |  | ||||
| 
 |  | ||||
| {% block extra_js %} |  | ||||
| <script type="text/javascript"> |  | ||||
|   $(() => { |  | ||||
|     var $crf_token = $('[name="csrfmiddlewaretoken"]').attr('value'); |  | ||||
|     $("#renovar-token").click(() => { |  | ||||
|       $.ajax({ |  | ||||
|         url: "{% url 'sapl.api:recria_token' user.id %}", |  | ||||
|         type: "POST", |  | ||||
|         headers: { "X-CSRFToken": $crf_token }, |  | ||||
|         dataType: "json", |  | ||||
|         success: (res) => $("#id_token").val(res.token) |  | ||||
|       }); |  | ||||
|     }); |  | ||||
|   }); |  | ||||
| </script> |  | ||||
| 
 |  | ||||
| {% endblock %} |  | ||||
					Loading…
					
					
				
		Reference in new issue