Skip to content

Commit f799548

Browse files
committed
more rework of css/themes
1 parent 2bf7516 commit f799548

13 files changed

Lines changed: 352 additions & 156 deletions

File tree

src/assets/css/bornhack.scss

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,55 @@
66
// also update SRI in settings.py:
77
// $ openssl dgst -sha384 -binary bootstrap-v5.3.3.bornhackcustom.css | openssl base64 -A
88

9-
$color-mode-type: media-query;
9+
// Only create bootstrap with the default theme (light) the other themes are loaded as seperate css files
10+
@import "node_modules/bootstrap/scss/mixins/banner";
11+
@include bsBanner("node_modules/bootstrap/scss/");
1012

11-
@import "node_modules/bootstrap/scss/bootstrap";
13+
14+
// scss-docs-start import-stack
15+
// Configuration
16+
@import "node_modules/bootstrap/scss/functions";
17+
@import "node_modules/bootstrap/scss/variables";
18+
@import "node_modules/bootstrap/scss/maps";
19+
@import "node_modules/bootstrap/scss/mixins";
20+
@import "node_modules/bootstrap/scss/utilities";
21+
22+
// Layout & components
23+
@import "node_modules/bootstrap/scss/root";
24+
@import "node_modules/bootstrap/scss/reboot";
25+
@import "node_modules/bootstrap/scss/type";
26+
@import "node_modules/bootstrap/scss/images";
27+
@import "node_modules/bootstrap/scss/containers";
28+
@import "node_modules/bootstrap/scss/grid";
29+
@import "node_modules/bootstrap/scss/tables";
30+
@import "node_modules/bootstrap/scss/forms";
31+
@import "node_modules/bootstrap/scss/buttons";
32+
@import "node_modules/bootstrap/scss/transitions";
33+
@import "node_modules/bootstrap/scss/dropdown";
34+
@import "node_modules/bootstrap/scss/button-group";
35+
@import "node_modules/bootstrap/scss/nav";
36+
@import "node_modules/bootstrap/scss/navbar";
37+
@import "node_modules/bootstrap/scss/card";
38+
@import "node_modules/bootstrap/scss/accordion";
39+
@import "node_modules/bootstrap/scss/breadcrumb";
40+
@import "node_modules/bootstrap/scss/pagination";
41+
@import "node_modules/bootstrap/scss/badge";
42+
@import "node_modules/bootstrap/scss/alert";
43+
@import "node_modules/bootstrap/scss/progress";
44+
@import "node_modules/bootstrap/scss/list-group";
45+
@import "node_modules/bootstrap/scss/close";
46+
@import "node_modules/bootstrap/scss/toasts";
47+
@import "node_modules/bootstrap/scss/modal";
48+
@import "node_modules/bootstrap/scss/tooltip";
49+
@import "node_modules/bootstrap/scss/popover";
50+
@import "node_modules/bootstrap/scss/carousel";
51+
@import "node_modules/bootstrap/scss/spinners";
52+
@import "node_modules/bootstrap/scss/offcanvas";
53+
@import "node_modules/bootstrap/scss/placeholders";
54+
55+
// Helpers
56+
@import "node_modules/bootstrap/scss/helpers";
57+
58+
// Utilities
59+
@import "node_modules/bootstrap/scss/utilities/api";
60+
// scss-docs-end import-stack

src/profiles/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ def get(self, request, *args, **kwargs):
119119
theme = request.GET.get("theme") or "default"
120120
next_url = request.GET.get("next") or "/"
121121
if theme in dict(Profile.THEME_CHOICES) and next_url[:1] == "/":
122-
self.request.session["theme"] = theme
122+
if self.request.user.is_authenticated and theme == "default":
123+
self.request.session["theme"] = self.request.user.profile.theme
124+
else:
125+
self.request.session["theme"] = theme
123126
return redirect(next_url)
124127
else:
125128
return HttpResponseForbidden()
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{% if camp.show_schedule %}
2-
<a href="{% url 'program:schedule_index' camp_slug=camp.slug %}" class="btn {% if url_name == "schedule_index" or urlyear %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">Schedule</a>
2+
<a href="{% url 'program:schedule_index' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name == "schedule_index" or urlyear %}btn-primary{% else %}btn-outline-secondary{% endif %}">Schedule</a>
33
{% endif %}
4-
<a href="{% url 'program:event_index' camp_slug=camp.slug %}" class="btn {% if url_name == "event_index" %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">Events</a>
5-
<a href="{% url 'program:speaker_index' camp_slug=camp.slug %}" class="btn {% if url_name == "speaker_index" %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">Speakers</a>
6-
<a href="{% url 'program:call_for_participation' camp_slug=camp.slug %}" class="btn {% if url_name == "call_for_participation" %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">Call for Participation</a>
4+
<a href="{% url 'program:event_index' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name == "event_index" %}btn-primary{% else %}btn-outline-secondary{% endif %}">Events</a>
5+
<a href="{% url 'program:speaker_index' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name == "speaker_index" %}btn-primary{% else %}btn-outline-secondary{% endif %}">Speakers</a>
6+
<a href="{% url 'program:call_for_participation' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name == "call_for_participation" %}btn-primary{% else %}btn-outline-secondary{% endif %}">Call for Participation</a>
77
{% if request.user.is_authenticated %}
88
{% if camp.call_for_participation_open %}
9-
<a href="{% url 'program:proposal_list' camp_slug=camp.slug %}" class="btn {% if url_name in proposal_urls %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">Submit Proposal</a>
9+
<a href="{% url 'program:proposal_list' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name in proposal_urls %}btn-primary{% else %}btn-outline-secondary{% endif %}">Submit Proposal</a>
1010
{% else %}
11-
<a href="{% url 'program:proposal_list' camp_slug=camp.slug %}" class="btn {% if url_name in proposal_urls %}btn-primary{% else %}btn-outline-secondary btn-menu{% endif %}">View Proposals</a>
11+
<a href="{% url 'program:proposal_list' camp_slug=camp.slug %}" class="bornhack-program-menu btn {% if url_name in proposal_urls %}btn-primary{% else %}btn-outline-secondary{% endif %}">View Proposals</a>
1212
{% endif %}
1313
{% endif %}

src/program/templates/program_base.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
{% with url_name=request.resolver_match.url_name proposal_urls="proposal_list,speaker_proposal_create,speaker_proposal_detail,speaker_proposal_update,speaker_proposal_submit,speaker_proposal_picture,event_proposal_create,event_proposal_detail,event_proposal_update,event_proposal_submit" %}
1010

1111
<div class="row">
12-
<div class="w-100 d-none d-lg-flex btn-group" role="group">
13-
{% include 'includes/program_menu.html' %}
14-
</div>
15-
<div class="d-lg-none btn-group-vertical w-100" role="group">
12+
<div class="d-flex flex-wrap justify-content-center mt-1">
1613
{% include 'includes/program_menu.html' %}
1714
</div>
1815
</div>

src/sponsors/templates/sponsors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ <h1>{{ sponsor.tier.name}}</h1>
3939
{% if sponsor.url %}
4040
<a href="{{ sponsor.url }}">
4141
{% endif %}
42-
<img class="img-responsive center-block sponsor-white" src="{% static 'img/sponsors/' %}{{ sponsor.logo_filename }}" width="300"/>
42+
<img class="img-responsive center-block bornhack-sponsor-white" src="{% static 'img/sponsors/' %}{{ sponsor.logo_filename }}" width="300"/>
4343
{% if sponsor.url %}
4444
</a>
4545
{% endif %}

src/static_src/css/bootstrap-v5.3.5.bornhackcustom.css

Lines changed: 77 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/static_src/css/bootstrap-v5.3.5.bornhackcustom.css.map

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

src/static_src/css/bornhack.css

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ strong { font-weight: bold; }
3535
height: 75px;
3636
}
3737

38-
.btn-menu {
38+
/* Navbar buttom customization */
39+
.bornhack-program-menu, .btn-menu {
3940
--bs-btn-border-width: unset !important;
4041
}
4142

42-
/* Hide elements if theme is active */
43-
/* Only used for data-bs-theme="light" and prefers-color-scheme: dark */
43+
.btn-primary.bornhack-program-menu {
44+
background-color: unset;
45+
color: var(--bs-info);
46+
}
47+
48+
49+
/* Theme switcher css logic mainly used to set/hide icons in the theme switcher */
50+
/* Only used for data-bs-theme="light" */
4451
/* For the other themes these should be defined in the theme css file */
4552

4653
body:not([data-bs-theme]) .bornhack-hide-light {
@@ -55,6 +62,16 @@ body:not([data-bs-theme]) .bornhack-hide-light {
5562
[data-bs-theme="light"] .bornhack-hide-light {
5663
display: none !important;
5764
}
65+
[data-bs-theme="light"] .bornhack-theme-light {
66+
color: var(--bs-orange);
67+
}
68+
body:not([data-bs-theme]) .bornhack-theme-system {
69+
color: var(--bs-primary-text-emphasis);
70+
}
71+
72+
.bornhack-theme-light, .bornhack-theme-dark, .bornhack-theme-system {
73+
opacity: 1;
74+
}
5875

5976
@media (prefers-color-scheme: dark) {
6077
body:not([data-bs-theme]) .bornhack-logo {
@@ -74,7 +91,14 @@ body:not([data-bs-theme]) .bornhack-hide-light {
7491
display: unset !important;
7592
}
7693
}
77-
/* end of theme based hiding */
94+
/* end of theme based css */
95+
96+
/* Set a white background behind sponsor logos */
97+
.bornhack-sponsor-white {
98+
background-color: white;
99+
color: black;
100+
border: 20px solid white;
101+
}
78102

79103
.navbar-fixed-top {
80104
min-height: 70px;
@@ -89,10 +113,6 @@ body:not([data-bs-theme]) .bornhack-hide-light {
89113
margin-top: 6px;
90114
}
91115

92-
#top-navbar > .nav > li > a {
93-
padding: 30px 7px;
94-
}
95-
96116
.nav .dropdown-menu {
97117
padding: 0;
98118
}
@@ -107,7 +127,6 @@ body:not([data-bs-theme]) .bornhack-hide-light {
107127
}
108128

109129
/* Form stuff */
110-
111130
.form-control, .form-control:focus {
112131
box-shadow: none;
113132
}

0 commit comments

Comments
 (0)