Skip to content

Commit a1bd252

Browse files
committed
Moved docs search bar to top navigation in prep for global search.
1 parent 72b3840 commit a1bd252

File tree

21 files changed

+160
-80
lines changed

21 files changed

+160
-80
lines changed

accounts/tests.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
from django_hosts.resolvers import reverse
77

88
from accounts.forms import DeleteProfileForm
9+
from djangoproject.tests import ReleaseMixin
910
from foundation import models as foundationmodels
1011
from tracdb.models import Revision, Ticket, TicketChange
1112
from tracdb.testutils import TracDBCreateDatabaseMixin
1213

1314

1415
@override_settings(TRAC_URL="https://code.djangoproject.com/")
15-
class UserProfileTests(TracDBCreateDatabaseMixin, TestCase):
16+
class UserProfileTests(TracDBCreateDatabaseMixin, ReleaseMixin, TestCase):
1617
databases = {"default", "trac"}
1718

1819
@classmethod
1920
def setUpTestData(cls):
21+
super().setUpTestData()
2022
User.objects.create_user(username="user1", password="password")
2123
User.objects.create_user(username="user2", password="password")
2224
cls.user1_url = reverse("user_profile", args=["user1"])
@@ -175,7 +177,7 @@ def test_caches_trac_stats(self):
175177
self.assertIsNotNone(cache.get(key))
176178

177179

178-
class ViewsTests(TestCase):
180+
class ViewsTests(ReleaseMixin, TestCase):
179181

180182
def test_login_redirect(self):
181183
credentials = {"username": "a-user", "password": "password"}
@@ -193,7 +195,7 @@ def test_profile_view_reversal(self):
193195
reverse("user_profile", host="www", args=[username])
194196

195197

196-
class UserDeletionTests(TestCase):
198+
class UserDeletionTests(ReleaseMixin, TestCase):
197199
def create_user_and_form(self, bound=True, **userkwargs):
198200
userkwargs.setdefault("username", "test")
199201
userkwargs.setdefault("email", "[email protected]")

aggregator/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def setUp(self, mocker):
9292
def test_community_index_number_of_queries(self):
9393
"""Intended to prevent an n+1 issue on the community index view"""
9494
url = reverse("community-index")
95-
with self.assertNumQueries(6):
95+
with self.assertNumQueries(7):
9696
self.client.get(url)
9797

9898
def test_empty_feed_type_not_rendered(self):
@@ -119,7 +119,7 @@ def test_feed_list_number_of_queries(self):
119119
url = reverse(
120120
"community-feed-list", kwargs={"feed_type_slug": self.feed_type.slug}
121121
)
122-
with self.assertNumQueries(7):
122+
with self.assertNumQueries(8):
123123
self.client.get(url)
124124

125125
def test_management_command_sends_no_email_with_no_pending_feeds(self):

blog/tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from django.urls import reverse
1313
from django.utils import timezone, translation
1414

15+
from djangoproject.tests import ReleaseMixin
16+
1517
from .models import ContentFormat, Entry, Event, ImageUpload
1618
from .sitemaps import WeblogSitemap
1719

@@ -189,7 +191,7 @@ def test_past_future_ordering(self):
189191
)
190192

191193

192-
class ViewsTestCase(DateTimeMixin, TestCase):
194+
class ViewsTestCase(ReleaseMixin, DateTimeMixin, TestCase):
193195
def test_staff_with_change_permission_can_see_unpublished_detail_view(self):
194196
"""
195197
Staff users with change permission on BlogEntry can't see unpublished entries
@@ -418,7 +420,7 @@ def test_user_cannot_see_unpublished_entries(self):
418420
+ ["django.middleware.cache.FetchFromCacheMiddleware"]
419421
),
420422
)
421-
class ViewsCachingTestCase(DateTimeMixin, TestCase):
423+
class ViewsCachingTestCase(ReleaseMixin, DateTimeMixin, TestCase):
422424
def test_drafts_have_no_cache_headers(self):
423425
"""
424426
Draft (unpublished) entries have no-cache headers.

contact/tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from django.test import TestCase
77
from django.test.utils import override_settings
88

9+
from djangoproject.tests import ReleaseMixin
10+
911
from .views import FoundationContactForm
1012

1113

@@ -21,7 +23,7 @@ def check_network_connection():
2123

2224

2325
@override_settings(AKISMET_TESTING=True)
24-
class ContactFormTests(TestCase):
26+
class ContactFormTests(ReleaseMixin, TestCase):
2527
def setUp(self):
2628
self.url = "/contact/foundation/"
2729

dashboard/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from django.test import RequestFactory, TestCase
1010
from django_hosts.resolvers import reverse
1111

12+
from djangoproject.tests import ReleaseMixin
1213
from tracdb.models import Ticket
1314
from tracdb.testutils import TracDBCreateDatabaseMixin
1415
from tracdb.tractime import datetime_to_timestamp
@@ -24,7 +25,7 @@
2425
from .views import index, metric_detail, metric_json
2526

2627

27-
class ViewTests(TestCase):
28+
class ViewTests(ReleaseMixin, TestCase):
2829
fixtures = ["dashboard_test_data"]
2930

3031
def setUp(self):

djangoproject/scss/_dark-mode.scss

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,19 +347,23 @@ html[data-theme="light"] .theme-toggle .theme-label-when-light {
347347
}
348348

349349
.mobile-toggle {
350-
width: 45px;
351-
height: 45px;
352350
line-height: 45px;
353351
text-align: center;
354-
margin: 4px 10px;
352+
display: flex;
353+
align-items: center;
354+
.dark-mode {
355+
height: 45px;
356+
width: 45px;
357+
margin: 2px;
358+
}
355359

356-
@include respond-min(768px) {
360+
@include respond-min(1080px) {
357361
display: none;
358362
}
359363
}
360364

361-
header nav li:last-child {
362-
@include respond-max(768px) {
365+
header nav li:nth-last-child(-n+2) {
366+
@include respond-max(1080px) {
363367
display: none;
364368
}
365369
}

djangoproject/scss/_style.scss

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ main {
425425
.container {
426426
@include respond-min(768px) {
427427
margin: 0 auto;
428-
max-width: 1400px;
429428
padding: 0 (32/768) * 100%;
430429
}
431430

@@ -464,7 +463,7 @@ header {
464463
.container {
465464
display: flex;
466465
flex-direction: row;
467-
@include respond-min(768px) {
466+
@include respond-min(1080px) {
468467
position: relative;
469468
}
470469
}
@@ -479,7 +478,7 @@ header {
479478
margin: 8px 0 0 10px;
480479
display: none;
481480

482-
@include respond-min(1150px) {
481+
@include respond-min(1080px) {
483482
width: 200px;
484483
display: block;
485484
}
@@ -490,19 +489,24 @@ header {
490489
.logo {
491490
@include font-size(40);
492491
@include sans-serif;
493-
background: url(../img/logo-django.svg) center center no-repeat;
492+
background: url(../img/logo-dj.svg) center center no-repeat;
494493
color: var(--white-color);
495494
display: block;
496495
font-weight: 700;
497-
margin: 10px;
496+
margin: 10px 4px;
498497
overflow: hidden;
499498
text-decoration: none;
500499
text-indent: 100%;
501-
width: 104px;
500+
width: 45px;
502501
height: 36px;
503502

504-
@include respond-min(768px) {
505-
margin-left: 0;
503+
@include respond-min(500px) {
504+
background: url(../img/logo-django.svg) center center no-repeat;
505+
width: 104px;
506+
}
507+
508+
@include respond-min(1080px) {
509+
margin-left: 10px 10px 10px 10px;
506510
}
507511
}
508512

@@ -515,12 +519,12 @@ header {
515519
display: block;
516520
height: 45px;
517521
line-height: 48px;
518-
margin: 4px 10px;
522+
margin: 2px;
519523
text-align: center;
520524
text-decoration: none;
521525
width: 45px;
522526

523-
@include respond-min(768px) {
527+
@include respond-min(1080px) {
524528
display: none;
525529
}
526530

@@ -544,7 +548,7 @@ header {
544548
max-height: 580px;
545549
}
546550

547-
@include respond-min(768px) {
551+
@include respond-min(1080px) {
548552
width: auto;
549553
max-height: none; // always show menu on a desktop width
550554
}
@@ -553,7 +557,9 @@ header {
553557
margin: 10px 0 0;
554558
padding: 0;
555559

556-
@include respond-min(768px) {
560+
@include respond-min(1080px) {
561+
display: flex;
562+
align-items: center;
557563
margin: 0;
558564
}
559565
}
@@ -568,14 +574,18 @@ header {
568574
text-transform: uppercase;
569575
margin: 0 10px;
570576
border-top: 1px solid lighten($green-dark, 5%);
571-
padding: 20px 0px;
577+
> :not(.search){
578+
padding: 20px 0px;
579+
}
572580

573-
@include respond-min(768px) {
581+
@include respond-min(1080px) {
574582
margin: 0;
575583
border: 0;
576584
float: left;
577585
text-align: left;
578-
padding: 20px 10px;
586+
> :not(.search){
587+
padding: 10px;
588+
}
579589
}
580590

581591
&.active a {
@@ -608,13 +618,13 @@ header {
608618
color: var(--secondary-accent);
609619
}
610620

611-
@include respond-min(768px) {
621+
@include respond-min(1080px) {
612622
padding: 20px 10px;
613623
}
614624
}
615625

616626
.nav-primary {
617-
@include respond-min(768px) {
627+
@include respond-min(1080px) {
618628
position: absolute;
619629
right: 0;
620630
top: 45px;
@@ -645,7 +655,7 @@ header {
645655
top: 0;
646656
max-width: 660px;
647657

648-
@include respond-min(768px) {
658+
@include respond-min(1080px) {
649659
position: static;
650660
}
651661
}
@@ -3005,14 +3015,10 @@ form {
30053015
height: 40px;
30063016
padding: 0;
30073017
position: absolute;
3008-
right: 2%;
3018+
right: 0;
30093019
top: 6%;
30103020
width: 40px;
30113021

3012-
@include respond-min(768px) {
3013-
right: 1%;
3014-
}
3015-
30163022
i {
30173023
@include font-size(20);
30183024
line-height: 1;
@@ -3054,16 +3060,17 @@ form {
30543060
}
30553061

30563062
&.search {
3057-
@include respond-min(768px) {
3058-
flex: 0 0 40%;
3059-
margin: 10px 0;
3060-
}
3061-
3062-
flex: 0 0 100%;
3063-
margin: 0 0 10px 0;
3064-
3065-
button {
3066-
top: 19%;
3063+
width: 20%;
3064+
min-width: 200px;
3065+
margin: 0 8px 0 0;
3066+
@include respond-min(1080px) {
3067+
margin: 10px 0;
3068+
}
3069+
input {
3070+
margin: 0;
3071+
@include respond-min(1080px) {
3072+
margin: 0 10px;
3073+
}
30673074
}
30683075
}
30693076
}
@@ -3602,7 +3609,7 @@ ul.corporate-members li {
36023609
justify-content: space-between;
36033610
}
36043611

3605-
@include respond-max(1200px) {
3612+
@include respond-max(1080px) {
36063613
.community-title {
36073614
text-align: center;
36083615
}
Lines changed: 10 additions & 0 deletions
Loading

djangoproject/templates/includes/header.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% load docs %}
12
{% if 'preview.djangoproject.com' in request.get_host %}
23
<div class="copy-banner" style="background: #fff78e; padding: 10px;"></div>
34
{% endif %}
@@ -6,7 +7,10 @@
67
<a class="logo" href="{% url 'homepage' %}">Django</a>
78
<p class="meta">The web framework for perfectionists with deadlines.</p>
89
<div class="mobile-toggle">
9-
{% include "includes/toggle_theme.html" %}
10+
{% search_form %}
11+
<div class="dark-mode">
12+
{% include "includes/toggle_theme.html" %}
13+
</div>
1014
</div>
1115
<button class="menu-button">
1216
<i class="icon icon-reorder"></i>
@@ -42,6 +46,9 @@
4246
<li{% if 'fundraising' in request.path %} class="active"{% endif %}>
4347
<a href="{% url 'fundraising:index' %}">&#9829; Donate</a>
4448
</li>
49+
<li>
50+
{% search_form %}
51+
</li>
4552
<li>
4653
{% include "includes/toggle_theme.html" %}
4754
</li>
File renamed without changes.

0 commit comments

Comments
 (0)