Skip to content

Commit 8271109

Browse files
committed
Merge branch 'release/1.0.0b0'
2 parents 2dcf122 + 8c18c68 commit 8271109

File tree

14 files changed

+270
-82
lines changed

14 files changed

+270
-82
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ INSTALLED_APPS = [
2323
'django.contrib.sessions',
2424
'django.contrib.messages',
2525
'django.contrib.staticfiles',
26+
...
2627
]
2728
```

README.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
django-adminlte-ui
2+
==================
3+
4+
django admin theme base on adminlte
5+
6+
adminlte version: 2.3.6
7+
8+
install
9+
=======
10+
11+
::
12+
13+
pip install django-adminlte-ui
14+
15+
setup
16+
=====
17+
18+
::
19+
20+
INSTALLED_APPS = [
21+
'adminlteui',
22+
'django.contrib.admin',
23+
'django.contrib.auth',
24+
'django.contrib.sites',
25+
'django.contrib.sitemaps',
26+
'django.contrib.contenttypes',
27+
'django.contrib.sessions',
28+
'django.contrib.messages',
29+
'django.contrib.staticfiles',
30+
...
31+
]
32+

adminlteui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '1.0.0beta'
1+
version = '1.0.0b0'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% load i18n %}
2+
<div class="row">
3+
<div class="col-md-12">
4+
<div class="actions">
5+
{% block actions %}
6+
{% block actions-form %}
7+
{% for field in action_form %}<label>{{ field }}</label>{% endfor %}
8+
{% endblock %}
9+
{% block actions-submit %}
10+
<button type="submit" class="btn btn-primary" style="margin-right: 5px; margin-left: 15px;" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
11+
{% endblock %}
12+
{% block actions-counter %}
13+
{% if actions_selection_counter %}
14+
<span class="action-counter" data-actions-icnt="{{ cl.result_list|length }}">{{ selection_note }}</span>
15+
{% if cl.result_count != cl.result_list|length %}
16+
<span class="all" style="display: none;">{{ selection_note_all }}</span>
17+
<span class="question" style="display: none;">
18+
<a href="#" title="{% trans "Click here to select the objects across all pages" %}">{% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %}</a>
19+
</span>
20+
<span class="clear" style="display: none;"><a href="#">{% trans "Clear selection" %}</a></span>
21+
{% endif %}
22+
{% endif %}
23+
{% endblock %}
24+
{% endblock %}
25+
</div>
26+
</div>
27+
<script>document.querySelector('.actions select').setAttribute('class', 'form-control')</script>
28+
</div>

adminlteui/templates/admin/base.html

Lines changed: 45 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,18 @@
1818
<!-- AdminLTE Skins. Choose a skin from the css/skins
1919
folder instead of downloading all of them to reduce the load. -->
2020
<link rel="stylesheet" href={% static "admin/dist/css/skins/_all-skins.min.css" %}>
21-
<!-- iCheck -->
22-
<link rel="stylesheet" href={% static "admin/plugins/iCheck/flat/blue.css" %}>
23-
<!-- Morris chart -->
24-
<link rel="stylesheet" href={% static "admin/plugins/morris/morris.css" %}>
25-
<!-- jvectormap -->
26-
<link rel="stylesheet" href={% static "admin/plugins/jvectormap/jquery-jvectormap-1.2.2.css" %}>
27-
<!-- Date Picker -->
28-
<link rel="stylesheet" href={% static "admin/plugins/datepicker/datepicker3.css" %}>
29-
<!-- Daterange picker -->
30-
<link rel="stylesheet" href={% static "admin/plugins/daterangepicker/daterangepicker.css" %}>
31-
<!-- bootstrap wysihtml5 - text editor -->
32-
<link rel="stylesheet" href={% static "admin/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" %}>
3321

22+
{% block custom_style %} {% endblock %}
3423
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
3524
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
3625
<!--[if lt IE 9]>
3726
<script src="//oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
3827
<script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
3928
<![endif]-->
29+
30+
{% block extrahead %} {% endblock %}
4031
</head>
41-
<body class="hold-transition skin-blue sidebar-mini">
32+
<body class="hold-transition skin-blue sidebar-mini fixed">
4233
<div class="wrapper">
4334

4435
<header class="main-header">
@@ -337,8 +328,8 @@ <h3>
337328
<!-- /.search form -->
338329
<!-- sidebar menu: : style can be found in sidebar.less -->
339330
<ul class="sidebar-menu">
340-
<li class="header">页面导航</li>
341-
<li class="active">
331+
<li class="header">{% trans 'MAIN NAVIGATION' %}</li>
332+
<li>
342333
<a href="/admin/">
343334
<i class="fa fa-dashboard"></i> <span>{% trans 'Dashboard' %}</span>
344335
</a>
@@ -347,7 +338,7 @@ <h3>
347338
{% if app_list %}
348339
{% for app in app_list %}
349340
<li class="treeview">
350-
<a href="#">
341+
<a href="javascript:void(0)">
351342
<i class="fa fa-database"></i>
352343
<span style="overflow: hidden; display: inline-block; vertical-align:top;">{{ app.name }}</span>
353344
<span class="pull-right-container">
@@ -366,17 +357,17 @@ <h3>
366357
{% endif %}
367358
<!--{% if request.user.is_superuser %}-->
368359
<!--<li class="treeview">-->
369-
<!--<a href="#">-->
370-
<!--<i class="fa fa-cog"></i>-->
371-
<!--<span>{% trans 'System manage' %}</span>-->
372-
<!--<span class="pull-right-container">-->
373-
<!--<i class="fa fa-angle-left pull-right"></i>-->
374-
<!--</span>-->
375-
<!--</a>-->
376-
<!--<ul class="treeview-menu">-->
377-
<!--<li><a href="" ><i class="fa fa-file-text-o"></i>{% trans 'Log manage' %}</a></li>-->
378-
<!--<li><a href="/admin/config/system/" ><i class="fa fa-wrench"></i>{% trans 'System config' %}</a></li>-->
379-
<!--</ul>-->
360+
<!--<a href="#">-->
361+
<!--<i class="fa fa-cog"></i>-->
362+
<!--<span>{% trans 'System manage' %}</span>-->
363+
<!--<span class="pull-right-container">-->
364+
<!--<i class="fa fa-angle-left pull-right"></i>-->
365+
<!--</span>-->
366+
<!--</a>-->
367+
<!--<ul class="treeview-menu">-->
368+
<!--<li><a href="" ><i class="fa fa-file-text-o"></i>{% trans 'Log manage' %}</a></li>-->
369+
<!--<li><a href="/admin/config/system/" ><i class="fa fa-wrench"></i>{% trans 'System config' %}</a></li>-->
370+
<!--</ul>-->
380371
<!--</li>-->
381372
<!--{% endif %}-->
382373

@@ -390,7 +381,7 @@ <h3>
390381
</aside>
391382

392383
<!-- Content Wrapper. Contains page content -->
393-
<div class="content-wrapper" style="background-color: white">
384+
<div class="content-wrapper">
394385
<!-- Content Header (Page header) -->
395386
{% block page_content %}
396387
{% endblock %}
@@ -607,39 +598,41 @@ <h3 class="control-sidebar-heading">Chat Settings</h3>
607598
</script>
608599
<!-- Bootstrap 3.3.6 -->
609600
<script src={% static "admin/bootstrap/js/bootstrap.min.js" %}></script>
610-
<!-- Morris.js charts -->
611-
<script src="//cdn.bootcss.com/raphael/2.1.0/raphael-min.js"></script>
612-
<script src={% static "admin/plugins/morris/morris.min.js" %}></script>
613-
<!-- Sparkline -->
614-
<script src={% static "admin/plugins/sparkline/jquery.sparkline.min.js" %}></script>
615-
<!-- jvectormap -->
616-
<script src={% static "admin/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js" %}></script>
617-
<script src={% static "admin/plugins/jvectormap/jquery-jvectormap-world-mill-en.js" %}></script>
618-
<!-- jQuery Knob Chart -->
619-
<script src={% static "admin/plugins/knob/jquery.knob.js" %}></script>
620-
<!-- daterangepicker -->
621-
<script src="//cdn.bootcss.com/moment.js/2.11.2/moment.min.js"></script>
622-
<script src={% static "admin/plugins/daterangepicker/daterangepicker.js" %}></script>
623-
<!-- datepicker -->
624-
<script src={% static "admin/plugins/datepicker/bootstrap-datepicker.js" %}></script>
625-
<!-- Bootstrap WYSIHTML5 -->
626-
<script src={% static "admin/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" %}></script>
627601
<!-- Slimscroll -->
628602
<script src={% static "admin/plugins/slimScroll/jquery.slimscroll.min.js" %}></script>
629603
<!-- FastClick -->
630604
<script src={% static "admin/plugins/fastclick/fastclick.js" %}></script>
631605
<!-- AdminLTE App -->
632606
<script src={% static "admin/dist/js/app.min.js" %}></script>
633-
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
634-
<script src={% static "admin/dist/js/pages/dashboard.js" %}></script>
635607
<!-- AdminLTE for demo purposes -->
636608
<script src={% static "admin/dist/js/demo.js" %}></script>
637609
<script>
638-
// 用来控制iframe自适应行高
639-
$("#page_content").load(function () {
640-
var mainheight = $(this).contents().find("body").height() + 20;
641-
$(this).height(mainheight);
642-
});
610+
// use js control active status of siderbar-menu
611+
$(function() {
612+
var menuActions = document.querySelectorAll('.sidebar-menu a')
613+
for (var i in menuActions) {
614+
try {
615+
if (window.location.pathname === '/admin/') {
616+
menuActions[i].parentNode.setAttribute('class', 'active')
617+
break
618+
}
619+
620+
if (window.location.href.indexOf(menuActions[i].href) !== -1) {
621+
if (menuActions[i].href===window.location.origin + '/admin/') {
622+
continue
623+
}
624+
625+
console.log('menu matched.', window.location.href, menuActions[i].href);
626+
menuActions[i].parentNode.setAttribute('class', 'active');
627+
menuActions[i].parentNode.parentNode.setAttribute('class', 'treeview-menu menu-open');
628+
menuActions[i].parentNode.parentNode.parentNode.setAttribute('class', 'treeview active');
629+
// break
630+
}
631+
} catch (e) {
632+
console.log(window.location.href, menuActions[i].href, e)
633+
}
634+
}
635+
})
643636
</script>
644637

645638
{% block custom_js %}{% endblock %}

adminlteui/templates/admin/base_site.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends 'admin/base.html' %}
2+
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
23
{% block page_content %}
34
{% load i18n %}
45

@@ -9,7 +10,7 @@
910
<div id="container">
1011
{% if not is_popup %}
1112
<section class="content-header">
12-
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
13+
<h1>{% block content_title %}{% endblock %}</h1>
1314
{% block breadcrumbs %}{% endblock %}
1415
</section>
1516
{% endif %}
@@ -33,12 +34,8 @@ <h5><i class="icon fa fa-check"></i>{{ message|capfirst }}</h5>
3334
<div class="box box-primary">
3435
<div class="box-header with-border">
3536
<h4 class="box-title">
36-
<i class="fa fa-clipboard"></i>
37-
{% trans 'search result' %}{% block pretitle %}{% endblock %}
37+
{{title}}{% block pretitle %}{% endblock %}
3838
</h4>
39-
<div class="box-tools pull-right">
40-
{% block object-tools %}{% endblock %}
41-
</div>
4239
</div>
4340

4441
<div class="box-body">

adminlteui/templates/admin/change_list.html

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
{% endif %}
1919
{% endblock %}
2020

21+
{% block custom_style %}
22+
<link rel="stylesheet" href="{% static "admin/plugins/datatables/dataTables.bootstrap.css" %}">
23+
{% if cl.formset or action_form %}
24+
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
25+
{% endif %}
26+
{% endblock %}
27+
2128
{% block extrahead %}
2229
{{ block.super }}
2330
{{ media.js }}
@@ -35,17 +42,12 @@
3542
{% endblock %}
3643
{% endif %}
3744

45+
{% block content_title %} {{ cl.opts.verbose_name_plural|capfirst }} {% endblock %}
46+
3847
{% block coltype %}flex{% endblock %}
3948

4049
{% block content %}
4150
<div id="content-main">
42-
{% block object-tools %}
43-
<ul class="object-tools">
44-
{% block object-tools-items %}
45-
{% change_list_object_tools %}
46-
{% endblock %}
47-
</ul>
48-
{% endblock %}
4951
{% if cl.formset and cl.formset.errors %}
5052
<p class="errornote">
5153
{% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
@@ -54,12 +56,20 @@
5456
{% endif %}
5557
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
5658
<div class="row">
57-
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
59+
{% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
5860

59-
{% block search %}{% search_form cl %}{% endblock %}
61+
{% block search %}{% search_form cl %}{% endblock %}
6062

6163
</div>
6264

65+
{% block object-tools %}
66+
<div class="row" style="margin-bottom: 15px;">
67+
{% block object-tools-items %}
68+
{% change_list_object_tools %}
69+
{% endblock %}
70+
</div>
71+
{% endblock %}
72+
6373
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
6474
{% if cl.formset %}
6575
<div>{{ cl.formset.management_form }}</div>
@@ -77,6 +87,8 @@
7787
{% endblock %}
7888

7989
{% block custom_js %}
90+
<script src="{% static "admin/plugins/datatables/jquery.dataTables.min.js" %}"></script>
91+
<script src="{% static "admin/plugins/datatables/dataTables.bootstrap.min.js" %}"></script>
8092

8193
<script>
8294
var selectors = document.querySelector('#changelist-search').querySelectorAll('select');
@@ -85,7 +97,6 @@
8597
var $field = $(this);
8698
var $option = $field.find('option:selected');
8799
var select_name = $option.data('name');
88-
console.log(select_name);
89100
if (select_name) {
90101
$field.attr('name', select_name);
91102
} else {
@@ -105,7 +116,7 @@
105116
// }
106117

107118
// remove the hidden input of select_name
108-
var input = document.querySelector('#search_group').querySelector('input[name="' + select_name + '"]');
119+
var input = document.querySelector('#search_group').querySelector('input[name="' + $field.data('name') + '"]');
109120
input.parentNode.removeChild(input)
110121
}
111122
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% load i18n admin_urls %}
2+
3+
{% block object-tools-items %}
4+
{% if has_add_permission %}
5+
<div class="col-md-1">
6+
{% url cl.opts|admin_urlname:'add' as add_url %}
7+
<a href="{% add_preserved_filters add_url is_popup to_field %}" class="btn btn-success">
8+
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
9+
</a>
10+
</div>
11+
{% endif %}
12+
{% endblock %}

0 commit comments

Comments
 (0)