Skip to content

Commit 4763253

Browse files
authored
fix: make grid layout (rows/columns) compatible with flex box-based Django admin (#208)
1 parent ce882c3 commit 4763253

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

djangocms_frontend/contrib/link/helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from django.utils.encoding import force_str
1111
from django.utils.html import mark_safe
1212

13+
from djangocms_frontend.settings import EMPTY_CHOICE
14+
1315
LINK_MODELS = getattr(django_settings, "DJANGOCMS_FRONTEND_LINK_MODELS", [])
1416

1517

@@ -66,7 +68,7 @@ def get_link_choices(request, term="", lang=None, nbsp=None):
6668

6769
if nbsp is None:
6870
nbsp = "" if term else "\u2000"
69-
available_objects = []
71+
available_objects = [dict(id=EMPTY_CHOICE[0][0], text=EMPTY_CHOICE[0][1])]
7072
# Now create our list of cms pages
7173
type_id = ContentType.objects.get_for_model(Page).id
7274
for value, descr in get_page_choices(lang):

djangocms_frontend/contrib/utilities/frameworks/bootstrap5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def render(self, context, instance, placeholder):
66
)
77
else:
88
instance.add_classes(
9-
f"{instance.space_property}{instance.space_sides}-{ instance.space_device }-{instance.space_size}"
9+
f"{instance.space_property}{instance.space_sides}-{instance.space_device}-{instance.space_size}"
1010
)
1111
return super().render(context, instance, placeholder)
1212

djangocms_frontend/static/djangocms_frontend/css/base.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

private/sass/components/_grid-layout.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
padding: 0;
3131
min-width: 800px;
3232

33+
> div > div:not([class]) { // fix a quirk of djangocms-admin-style
34+
width: unset !important;
35+
max-width: unset !important;
36+
}
3337
.field-box:first-child {
3438
width: 115px !important;
3539
}
@@ -39,6 +43,7 @@
3943
box-sizing: content-box;
4044
width: 86px !important;
4145
flex: none;
46+
display: block;
4247
padding: 15px 10px;
4348
margin: 0 !important;
4449
border-bottom: 1px solid #eee;

tests/link/test_plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def test_plugin(self):
119119
def test_smart_link_field(self):
120120
slf = SmartLinkField()
121121
choices = get_choices(None)
122-
self.assertEqual("example.com", choices[0][0]) # Site name
123-
self.assertIn(("2-1", "home"), choices[0][1])
122+
self.assertEqual("example.com", choices[1][0]) # Site name
123+
self.assertIn(("2-1", "home"), choices[1][1])
124124

125125
cleaned = slf.clean("2-1")
126126
self.assertEqual(dict(model="cms.page", pk=1), cleaned)

0 commit comments

Comments
 (0)