Skip to content

Commit d7d92b3

Browse files
committed
Admin
* Updated glyphicons to Bootstrap 5 icons
1 parent 665db47 commit d7d92b3

File tree

2 files changed

+78
-56
lines changed

2 files changed

+78
-56
lines changed

rest_framework/templates/rest_framework/admin.html

Lines changed: 70 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,57 +27,59 @@
2727
</head>
2828

2929
{% block body %}
30-
<body class="{% block bodyclass %}{% endblock %}">
31-
<div class="wrapper">
32-
{% block navbar %}
33-
<div class="navbar navbar-static-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}">
34-
<div class="container">
35-
<span>
36-
{% block branding %}
37-
<a class='navbar-brand' rel="nofollow" href='https://www.django-rest-framework.org/'>
38-
Django REST framework
39-
</a>
40-
{% endblock %}
41-
</span>
42-
<ul class="nav navbar-nav pull-right">
43-
{% block userlinks %}
44-
{% if user.is_authenticated %}
45-
{% optional_logout request user %}
46-
{% else %}
47-
{% optional_login request %}
48-
{% endif %}
49-
{% endblock %}
50-
</ul>
51-
</div>
52-
</div>
53-
{% endblock %}
30+
<body class="{% block bodyclass %}{% endblock %}">
5431

32+
<div class="wrapper">
33+
{% block navbar %}
34+
<div class="navbar navbar-expand-md fixed-top {% block bootstrap_navbar_variant %}navbar-dark{% endblock %}"
35+
role="navigation" aria-label="{% trans "navbar" %}">
5536
<div class="container">
56-
{% block breadcrumbs %}
57-
<ul class="breadcrumb">
58-
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
59-
{% if forloop.last %}
60-
<li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
61-
{% else %}
62-
<li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
63-
{% endif %}
64-
{% endfor %}
65-
</ul>
66-
{% endblock %}
37+
{% block branding %}
38+
<a class='navbar-brand' rel="nofollow" href='https://www.django-rest-framework.org/'>
39+
Django REST framework
40+
</a>
41+
{% endblock %}
42+
<ul class="navbar-nav">
43+
{% block userlinks %}
44+
{% if user.is_authenticated %}
45+
{% optional_logout request user %}
46+
{% else %}
47+
{% optional_login request %}
48+
{% endif %}
49+
{% endblock %}
50+
</ul>
51+
</div>
52+
</div>
53+
{% endblock %}
54+
55+
<div class="container">
56+
{% block breadcrumbs %}
57+
<ul class="breadcrumb">
58+
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
59+
{% if forloop.last %}
60+
<li class="breadcrumb-item active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
61+
{% else %}
62+
<li class="breadcrumb-item"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
63+
{% endif %}
64+
{% empty %}
65+
{% block breadcrumbs_empty %}&nbsp;{% endblock breadcrumbs_empty %}
66+
{% endfor %}
67+
</ul>
68+
{% endblock %}
6769

6870
<!-- Content -->
6971
<div id="content">
7072
{% if 'GET' in allowed_methods %}
71-
<form id="get-form" class="pull-right">
73+
<form id="get-form" class="float-right">
7274
<fieldset>
73-
<div class="btn-group format-selection">
75+
<div class="dropdown format-selection">
7476
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
75-
Format <span class="caret"></span>
77+
Format
7678
</button>
7779
<ul class="dropdown-menu">
7880
{% for format in available_formats %}
7981
<li>
80-
<a class="format-option"
82+
<a class="dropdown-item"
8183
href='{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}'
8284
rel="nofollow">
8385
{{ format }}
@@ -92,47 +94,60 @@
9294

9395
{% if post_form %}
9496
<button type="button" class="button-form btn btn-primary" data-toggle="modal" data-target="#createModal">
95-
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Create
97+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-file-plus mb-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
98+
<path fill-rule="evenodd" d="M4 1h8a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2zm0 1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4z"/>
99+
<path fill-rule="evenodd" d="M8 5.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V10a.5.5 0 0 1-1 0V8.5H6a.5.5 0 0 1 0-1h1.5V6a.5.5 0 0 1 .5-.5z"/>
100+
</svg>
101+
Create
96102
</button>
97103
{% endif %}
98104

99105
{% if put_form %}
100106
<button type="button" class="button-form btn btn-primary" data-toggle="modal" data-target="#editModal">
101-
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
107+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-pencil mb-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
108+
<path fill-rule="evenodd" d="M11.293 1.293a1 1 0 0 1 1.414 0l2 2a1 1 0 0 1 0 1.414l-9 9a1 1 0 0 1-.39.242l-3 1a1 1 0 0 1-1.266-1.265l1-3a1 1 0 0 1 .242-.391l9-9zM12 2l2 2-9 9-3 1 1-3 9-9z"/>
109+
<path fill-rule="evenodd" d="M12.146 6.354l-2.5-2.5.708-.708 2.5 2.5-.707.708zM3 10v.5a.5.5 0 0 0 .5.5H4v.5a.5.5 0 0 0 .5.5H5v.5a.5.5 0 0 0 .5.5H6v-1.5a.5.5 0 0 0-.5-.5H5v-.5a.5.5 0 0 0-.5-.5H3z"/>
110+
</svg>
111+
Edit
102112
</button>
103113
{% endif %}
104114

105115
{% if delete_form %}
106116
<form class="button-form" action="{{ request.get_full_path }}" data-method="DELETE">
107117
<button class="btn btn-danger">
108-
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete
118+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-file-minus mb-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
119+
<path fill-rule="evenodd" d="M4 1h8a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2zm0 1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H4z"/>
120+
<path fill-rule="evenodd" d="M5.5 8a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1H6a.5.5 0 0 1-.5-.5z"/>
121+
</svg>
122+
Delete
109123
</button>
110124
</form>
111125
{% endif %}
112126

113127
{% if extra_actions %}
114128
<div class="dropdown" style="float: right; margin-right: 10px">
115-
<button class="btn btn-default" id="extra-actions-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
129+
<button class="btn btn-info dropdown-toggle" id="extra-actions-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
116130
{% trans "Extra Actions" %}
117-
<span class="caret"></span>
118131
</button>
119132
<ul class="dropdown-menu" aria-labelledby="extra-actions-menu">
120133
{% for action_name, url in extra_actions|items %}
121-
<li><a href="{{ url }}">{{ action_name }}</a></li>
134+
<li><a class="dropdown-item" href="{{ url }}">{{ action_name }}</a></li>
122135
{% endfor %}
123136
</ul>
124137
</div>
125138
{% endif %}
126139

127140
{% if filter_form %}
128-
<button style="float: right; margin-right: 10px" data-toggle="modal" data-target="#filtersModal" class="btn btn-default">
129-
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
141+
<button data-toggle="modal" data-target="#filtersModal" class="btn btn-outline-secondary button-form">
142+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-wrench mb-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
143+
<path fill-rule="evenodd" d="M.102 2.223A3.004 3.004 0 0 0 3.78 5.897l6.341 6.252A3.003 3.003 0 0 0 13 16a3 3 0 1 0-.851-5.878L5.897 3.781A3.004 3.004 0 0 0 2.223.1l2.141 2.142L4 4l-1.757.364L.102 2.223zm13.37 9.019L13 11l-.471.242-.529.026-.287.445-.445.287-.026.529L11 13l.242.471.026.529.445.287.287.445.529.026L13 15l.471-.242.529-.026.287-.445.445-.287.026-.529L15 13l-.242-.471-.026-.529-.445-.287-.287-.445-.529-.026z"/>
144+
</svg>
130145
{% trans "Filters" %}
131146
</button>
132147
{% endif %}
133148

134149
<div class="content-main">
135-
<div class="page-header">
150+
<div class="page-header mt-3">
136151
<h1>{{ name }}</h1>
137152
</div>
138153

@@ -172,8 +187,8 @@ <h1>{{ name }}</h1>
172187
<div class="modal-dialog">
173188
<div class="modal-content">
174189
<div class="modal-header">
175-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
176190
<h4 class="modal-title" id="myModalLabel">Create</h4>
191+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
177192
</div>
178193
<form action="{{ request.get_full_path }}" method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
179194
<div class="modal-body">
@@ -183,7 +198,7 @@ <h4 class="modal-title" id="myModalLabel">Create</h4>
183198
</fieldset>
184199
</div>
185200
<div class="modal-footer">
186-
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
201+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
187202
<button type="submit" class="btn btn-primary">Save</button>
188203
</div>
189204
</form>
@@ -196,8 +211,8 @@ <h4 class="modal-title" id="myModalLabel">Create</h4>
196211
<div class="modal-dialog">
197212
<div class="modal-content">
198213
<div class="modal-header">
199-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
200214
<h4 class="modal-title" id="myModalLabel">Edit</h4>
215+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
201216
</div>
202217
<form action="{{ request.get_full_path }}" data-method="PUT" enctype="multipart/form-data" class="form-horizontal" novalidate>
203218
<div class="modal-body">
@@ -206,7 +221,7 @@ <h4 class="modal-title" id="myModalLabel">Edit</h4>
206221
</fieldset>
207222
</div>
208223
<div class="modal-footer">
209-
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
224+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
210225
<button type="submit" class="btn btn-primary">Save</button>
211226
</div>
212227
</form>
@@ -220,8 +235,8 @@ <h4 class="modal-title" id="myModalLabel">Edit</h4>
220235
<div class="modal-dialog">
221236
<div class="modal-content">
222237
<div class="modal-header">
223-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
224238
<h4 class="modal-title" id="myModalLabel">{{ error_title }}</h4>
239+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
225240
</div>
226241
<form action="{{ request.get_full_path }}" data-method="{{ request.method }}" enctype="multipart/form-data" class="form-horizontal" novalidate>
227242
<div class="modal-body">
@@ -230,7 +245,7 @@ <h4 class="modal-title" id="myModalLabel">{{ error_title }}</h4>
230245
</fieldset>
231246
</div>
232247
<div class="modal-footer">
233-
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
248+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
234249
<button type="submit" class="btn btn-primary">Save</button>
235250
</div>
236251
</form>
@@ -253,6 +268,7 @@ <h4 class="modal-title" id="myModalLabel">{{ error_title }}</h4>
253268
<script src="{% static "rest_framework/js/jquery-3.5.1.min.js" %}"></script>
254269
<script src="{% static "rest_framework/js/ajax-form.js" %}"></script>
255270
<script src="{% static "rest_framework/js/csrf.js" %}"></script>
271+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
256272
<script src="{% static "rest_framework/js/bootstrap.min.js" %}"></script>
257273
<script src="{% static "rest_framework/js/prettify-min.js" %}"></script>
258274
<script src="{% static "rest_framework/js/default.js" %}"></script>

rest_framework/templates/rest_framework/admin/list.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@
1515
{% endfor %}
1616
<td>
1717
{% if row.url %}
18-
<a href="{{ row.url }}"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
18+
<a href="{{ row.url }}">
19+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-chevron-right" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
20+
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
21+
</svg>
22+
</a>
1923
{% else %}
20-
<span class="glyphicon glyphicon-chevron-right text-muted" aria-hidden="true"></span>
24+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-chevron-right" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
25+
<path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
26+
</svg>
2127
{% endif %}
2228
</td>
2329
</tr>

0 commit comments

Comments
 (0)