File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
adminlteui/templates/adminlte Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 22
33{% block extrajs %}
44{{ block.super }}
5+
56< script >
67 django . jQuery ( '#id_content_type' ) . select2 ( ) ;
8+ $ . fn . link_type = function ( ) {
9+ $ ( this ) . change ( function ( ) {
10+ var $field = $ ( this ) ;
11+ var $option = $field . find ( 'option:selected' ) ;
12+ if ( $option . val ( ) !== "0" ) {
13+ $ ( '.field-content_type' ) . hide ( ) ;
14+ } else {
15+ $ ( '.field-content_type' ) . show ( ) ;
16+ }
17+ if ( $option . val ( ) === "3" ) {
18+ $ ( '.field-link' ) . hide ( ) ;
19+ } else {
20+ $ ( '.field-link' ) . show ( ) ;
21+ }
22+ } ) ;
23+ $ ( this ) . trigger ( 'change' ) ;
24+ } ;
25+ $ ( '#id_link_type' ) . link_type ( ) ;
726</ script >
827{% endblock %}
Original file line number Diff line number Diff line change 11{% extends "admin/tree_change_list.html" %}
22{% load i18n %}
33{% block object-tools-items %}
4- < button class ="btn btn-danger "> {% trans 'Exchange Menu' %}</ button >
5- <!--TODO-->
4+ < button id ="exchange_menu " class ="btn btn-danger "> {% trans 'Exchange Menu' %}</ button >
65{{ block.super }}
6+ {% endblock %}
7+
8+ {% block extrajs %}
9+ {{ block.super }}
10+ < script >
11+ $ ( function ( ) {
12+ $ ( '#exchange_menu' ) . click ( function ( ) {
13+ $ . get ( '{% url "admin:exchange_menu" %}' , function ( response ) {
14+ console . log ( response ) ;
15+ if ( response . message === 'success' ) {
16+ window . location . reload ( ) ;
17+ }
18+ } )
19+ } )
20+ } ) ;
21+ </ script >
722{% endblock %}
You can’t perform that action at this time.
0 commit comments