Skip to content

Commit 2d5339d

Browse files
committed
2 parents 2fd3882 + 951c07b commit 2d5339d

File tree

11 files changed

+275
-22
lines changed

11 files changed

+275
-22
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.20.0](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.20.0) - 2022-08-25
8+
- Add `django-streamfield` compatibility.
9+
10+
## [0.19.2](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.19.2) - 2022-08-04
11+
- Fix `hashlib` compatibility with `FIPS` enabled systems. #167 (by [@jonlev1n](https://github.com/jonlev1n) in #168)
12+
713
## [0.19.1](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.19.1) - 2022-05-14
814
- [css] Fixed dashboard alignment when recent-actions are not visible.
915

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ django-admin-interface is a modern **responsive flat admin interface customizabl
3737
- `django-json-widget`
3838
- `django-modeltranslation`
3939
- `django-tabbed-admin`
40+
- `django-streamfield`
4041
- `sorl-thumbnail`
4142

4243
---
@@ -100,31 +101,48 @@ You can add a theme you've created through the admin to this repository by [send
100101
4. Edit the section above to document your theme.
101102

102103
### Add theme support to third-party libraries
103-
You can add **theme support to existing third-party libraries** using the following **css variables**:
104+
You can add **theme support to existing third-party libraries** using the following **CSS variables**:
104105

105-
- `--admin-interface-title-color`
106-
- `--admin-interface-logo-color`
107-
- `--admin-interface-env-color`
108-
- `--admin-interface-header-background-color:`
106+
#### Header
107+
108+
- `--admin-interface-header-background-color`
109109
- `--admin-interface-header-text-color`
110110
- `--admin-interface-header-link-color`
111111
- `--admin-interface-header-link_hover-color`
112+
- `--admin-interface-title-color`
113+
- `--admin-interface-env-color`
114+
115+
#### Logo
116+
117+
- `--admin-interface-logo-color`
118+
- `--admin-interface-logo-default-background-image`
119+
- `--admin-interface-logo-max-width`
120+
- `--admin-interface-logo-max-height`
121+
122+
#### Modules / Links
112123
- `--admin-interface-module-background-color`
113124
- `--admin-interface-module-background-selected-color`
125+
- `--admin-interface-module-border-radius`
114126
- `--admin-interface-module-text-color`
115127
- `--admin-interface-module-link-color`
116128
- `--admin-interface-module-link-selected-color`
117129
- `--admin-interface-module-link-hover-color`
118130
- `--admin-interface-generic-link-color`
119131
- `--admin-interface-generic-link-hover-color`
132+
133+
#### Buttons
120134
- `--admin-interface-save-button-background-color`
121135
- `--admin-interface-save-button-background-hover-color`
122136
- `--admin-interface-save-button-text-color`
123137
- `--admin-interface-delete-button-background-color`
124138
- `--admin-interface-delete-button-background-hover-color`
125139
- `--admin-interface-delete-button-text-color`
140+
141+
#### Related Modal
126142
- `--admin-interface-related-modal-background-color`
127143
- `--admin-interface-related-modal-background-opacity`
144+
- `--admin-interface-related-modal-border-radius`
145+
- `--admin-interface-related-modal-close-button-display`
128146

129147
---
130148

admin_interface/static/admin_interface/css/admin-interface.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@
127127

128128
.admin-interface #branding h1 img.logo,
129129
.admin-interface.login #header #branding h1 img.logo {
130-
max-width: var(--admin-interface-log-max-width);
131-
max-height: var(--admin-interface-log-max-height);
130+
max-width: var(--admin-interface-logo-max-width);
131+
max-height: var(--admin-interface-logo-max-height);
132132
}
133133

134134
.admin-interface #header #user-tools a {
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/*
2+
django-streamfield support
3+
https://github.com/raagin/django-streamfield/
4+
*/
5+
6+
.admin-interface .form-row.field-stream {
7+
margin: 0;
8+
padding: 0;
9+
border-bottom: none;
10+
}
11+
12+
.admin-interface .form-row.field-stream label[for=id_stream] {
13+
display: none;
14+
}
15+
16+
.admin-interface .streamfield_app {
17+
clear: both;
18+
width: 100%;
19+
}
20+
21+
.admin-interface .streamfield_app .stream-help-text {
22+
margin-bottom: 15px;
23+
display: flex;
24+
flex-direction: column;
25+
clear: both;
26+
}
27+
28+
.admin-interface .streamfield_app .stream-help-text .stream-help-text__title {
29+
align-self: flex-end;
30+
user-select: none;
31+
padding: 8px;
32+
padding-right: 0;
33+
color: var(--admin-interface-generic-link-color);
34+
}
35+
36+
.admin-interface .streamfield_app .stream-help-text .stream-help-text__title:hover {
37+
color: var(--admin-interface-generic-link-hover-color);
38+
}
39+
40+
.admin-interface .streamfield_app .stream-help-text .stream-help-text__content {
41+
background: var(--admin-interface-module-background-selected-color);
42+
border-radius: var(--admin-interface-module-border-radius);
43+
border: 1px solid rgba(0,0,0,0.1);
44+
padding: 15px;
45+
}
46+
47+
.admin-interface .streamfield_app .stream-help-text .stream-help-text__content > ul {
48+
margin: 0;
49+
padding: 0;
50+
}
51+
52+
.admin-interface .streamfield_app .collapse-handler {
53+
user-select: none;
54+
padding: 8px;
55+
padding-right: 0;
56+
margin: 0 0 5px 0;
57+
color: var(--admin-interface-generic-link-color);
58+
text-decoration: none;
59+
}
60+
61+
.admin-interface .streamfield_app .collapse-handler:hover {
62+
color: var(--admin-interface-generic-link-hover-color);
63+
text-decoration: none;
64+
}
65+
66+
.admin-interface .streamfield_app .stream-model-block {
67+
position: relative;
68+
box-shadow: none;
69+
border: 1px solid rgba(0,0,0,0.1);
70+
border-radius: var(--admin-interface-module-border-radius);
71+
overflow: hidden;
72+
}
73+
74+
.admin-interface .streamfield_app .stream-model-block,
75+
.admin-interface .streamfield_app .streamfield-models.collapsed .stream-model-block {
76+
margin-bottom: 10px;
77+
}
78+
79+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title {
80+
display: flex;
81+
flex-direction: row;
82+
justify-content: space-between;
83+
align-items: center;
84+
margin: 0;
85+
padding: 10px 10px 10px 20px;
86+
}
87+
88+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title span {
89+
font-size: 18px;
90+
}
91+
92+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle {
93+
position: static;
94+
right: 0;
95+
top: 0;
96+
color: var(--admin-interface-generic-link-color);
97+
}
98+
99+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle:hover {
100+
color: var(--admin-interface-generic-link-hover-color);
101+
}
102+
103+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle {
104+
display: flex;
105+
justify-content: center;
106+
align-items: center;
107+
}
108+
109+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle .block-move,
110+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle .block-delete {
111+
display: flex;
112+
justify-content: center;
113+
align-items: center;
114+
width: 40px;
115+
height: 40px;
116+
font-weight: normal;
117+
background: none;
118+
flex-shrink: 0;
119+
color: inherit;
120+
font-size: 16px;
121+
}
122+
123+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle .block-move {
124+
cursor: move; /* fallback if grab cursor is unsupported */
125+
cursor: grab;
126+
cursor: -moz-grab;
127+
cursor: -webkit-grab;
128+
}
129+
130+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle .block-move:before {
131+
content: "↕";
132+
133+
display: block;
134+
}
135+
136+
.admin-interface .streamfield_app .stream-model-block .streamblock__block__title .streamblock__block-handle .block-delete:before {
137+
content: "×";
138+
display: block;
139+
font-size: 18px;
140+
}
141+
142+
.admin-interface .streamfield_app .block-fields > div {
143+
margin-bottom: 15px;
144+
}
145+
146+
.admin-interface .streamfield_app .stream-model-block .stream-model-block__content {
147+
background-color: #f8f8f8;
148+
padding: 20px;
149+
}
150+
151+
.admin-interface .streamfield_app .stream-model-block .stream-model-block__content.no-subblocks.abstract-block {
152+
display: none;
153+
}
154+
155+
.admin-interface .streamfield_app .stream-insert-new-block {
156+
margin-bottom: 20px;
157+
}
158+
159+
.admin-interface .streamfield_app .stream-insert-new-block .add-new-block-button {
160+
color: var(--admin-interface-generic-link-color);
161+
text-decoration: none;
162+
}
163+
164+
.admin-interface .streamfield_app .stream-insert-new-block .add-new-block-button:hover {
165+
color: var(--admin-interface-generic-link-hover-color);
166+
text-decoration: none;
167+
}
168+
169+
.admin-interface .streamfield_app .stream-insert-new-block ul {
170+
display: block;
171+
width: 100%;
172+
margin: 10px 0 0 0;
173+
padding: 0;
174+
user-select: none;
175+
}
176+
177+
.admin-interface .streamfield_app .stream-insert-new-block ul li {
178+
display: inline-block;
179+
font-size: 12px;
180+
margin: 0;
181+
padding: 0;
182+
}
183+
184+
.admin-interface .streamfield_app .stream-btn {
185+
font-weight: normal;
186+
text-decoration: none;
187+
background-color: var(--admin-interface-generic-link-color);
188+
padding: 6px 12px;
189+
border-radius: 4px;
190+
}
191+
192+
.admin-interface .streamfield_app .stream-btn:hover {
193+
text-decoration: none;
194+
background-color: var(--admin-interface-generic-link-hover-color);
195+
}
196+
197+
.admin-interface .streamfield_app .stream-insert-new-block ul li .stream-btn {
198+
margin-top: 5px;
199+
margin-left: 5px;
200+
}

admin_interface/static/admin_interface/magnific-popup/jquery.magnific-popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@
15071507
}
15081508
},
15091509

1510-
// Get element postion relative to viewport
1510+
// Get element position relative to viewport
15111511
_getOffset: function(isLarge) {
15121512
var el;
15131513
if(isLarge) {

admin_interface/static/admin_interface/related-modal/related-modal.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,30 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
136136
window.presentRelatedObjectModalOnClickOn = presentRelatedObjectModalOnClickOn;
137137

138138
// django 1.7 compatibility
139-
// $('a.add-another').removeAttr('onclick').click({ lookup:false }, presentRelatedObjectModal);
140139
presentRelatedObjectModalOnClickOn('a.add-another');
141140

142141
// django 1.8 and above
143-
// $('a.related-widget-wrapper-link').click({ lookup:false }, presentRelatedObjectModal);
144142
presentRelatedObjectModalOnClickOn('a.related-widget-wrapper-link');
145143

146144
// raw_id_fields support
147-
// $('a.related-lookup').unbind('click').click({ lookup:true }, presentRelatedObjectModal);
148145
presentRelatedObjectModalOnClickOn('a.related-lookup', true);
149146

150147
// django-dynamic-raw-id support - #61
151148
// https://github.com/lincolnloop/django-dynamic-raw-id
152149
presentRelatedObjectModalOnClickOn('a.dynamic_raw_id-related-lookup', true);
153150

154-
// show_change_link=True support
155-
presentRelatedObjectModalOnClickOn('a.inlinechangelink');
151+
// django-streamfield support
152+
// https://github.com/raagin/django-streamfield/
153+
presentRelatedObjectModalOnClickOn('.streamfield_app a.stream-btn[href*="_popup=1"]');
154+
// Vanilla js for catching the click during capture phase for anticipating Vue.js listener.
155+
document.addEventListener('click', function(event) {
156+
// console.log('click intercepted before Vue.');
157+
if (event.target.matches('.streamfield_app a.stream-btn[href*="_popup=1"]')) {
158+
event.stopImmediatePropagation();
159+
event.preventDefault();
160+
$(event.target).trigger('click');
161+
}
162+
}, { capture: true });
156163
});
157164

158165
})(django.jQuery);

admin_interface/static/ckeditor/ckeditor/skins/light/skin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CKEDITOR.skin.name = 'husky';
4949
// the complete list:
5050
// http://docs.ckeditor.com/#!/api/CKEDITOR.env
5151
//
52-
// Internet explorer is an expection and the browser version is also accepted
52+
// Internet explorer is an exception and the browser version is also accepted
5353
// (ie7, ie8, ie9, ie10), as well as a special name for IE in Quirks mode (iequirks).
5454
//
5555
// The available browser specific files must be set separately for editor.css
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function() {
2+
3+
'use strict';
4+
5+
var windowRef = window;
6+
var openerRef = windowRef.parent;
7+
8+
var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
9+
switch (initData.action) {
10+
case 'change':
11+
openerRef.streamapps[initData.app_id].updateBlock(initData.block_id, initData.instance_id);
12+
openerRef.dismissRelatedObjectModal();
13+
break;
14+
case 'delete':
15+
break;
16+
default:
17+
openerRef.streamapps[initData.app_id].updateBlock(initData.block_id, initData.instance_id);
18+
openerRef.dismissRelatedObjectModal();
19+
break;
20+
}
21+
22+
})();

admin_interface/templates/admin/base_site.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
{% endif %}
4545

4646
{% if theme.logo_max_width > 0 %}
47-
--admin-interface-log-max-width: min({{ theme.logo_max_width }}px, 100%);
47+
--admin-interface-logo-max-width: min({{ theme.logo_max_width }}px, 100%);
4848
{% else %}
49-
--admin-interface-log-max-width: 100%;
49+
--admin-interface-logo-max-width: 100%;
5050
{% endif %}
5151

5252
{% if theme.logo_max_height > 0 %}
53-
--admin-interface-log-max-height: {{ theme.logo_max_height }}px;
53+
--admin-interface-logo-max-height: {{ theme.logo_max_height }}px;
5454
{% else %}
55-
--admin-interface-log-max-height: unset;
55+
--admin-interface-logo-max-height: unset;
5656
{% endif %}
5757

5858
{% if theme.related_modal_rounded_corners %}

admin_interface/templatetags/admin_interface_tags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def get_admin_interface_version():
8080

8181

8282
def hash_string(text):
83-
hash_object = hashlib.md5(text.encode())
84-
md5_hash = hash_object.hexdigest()
85-
return md5_hash
83+
hash_object = hashlib.sha224(text.encode())
84+
sha224_hash = hash_object.hexdigest()
85+
return sha224_hash
8686

8787

8888
@simple_tag(takes_context=False)

0 commit comments

Comments
 (0)