Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/upgrade bootstrap #560

Open
wants to merge 40 commits into
base: epic/new-interface
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5dd95f1
Subindo app clipping para gerenciamento de links e referencias a data…
marcmatias Apr 5, 2021
069eaa3
Adicionando o app na settings e setando content para as relacoes que …
marcmatias Apr 5, 2021
7301c7e
Exibindo clippings nas templates de table junto com formulario para s…
marcmatias Apr 9, 2021
dcdac32
Adicionando comando management para importar dados de csv com links/c…
marcmatias Apr 9, 2021
56fa90d
make lint
turicas May 10, 2024
0f5431d
New datasets views and urls
marcmatias Sep 13, 2021
d4384a4
New templates and updates in dataset-detail template
marcmatias Sep 13, 2021
77d6945
Link to dataset new template in dataset-card
marcmatias Sep 13, 2021
28d281f
Clipping form from dataset-detail and dataset-table-detail
marcmatias Sep 15, 2021
829c6a8
Changing breadcrumb dropdown signal
marcmatias Sep 15, 2021
6dd95ec
New fields short_description and renaming field description dataset a…
marcmatias Sep 15, 2021
bd434e3
Updating tests and migrate_wrong_usernames
marcmatias Feb 15, 2022
a24a150
make lint
turicas May 10, 2024
a3c2216
Updating ignore folders
marcmatias Jan 29, 2022
e4e623b
Logo no text
marcmatias Jan 29, 2022
ccd5d0e
Scss styles src_static folder and new datepicker and dataTables css f…
marcmatias Jan 29, 2022
b8741c8
Templates updates
marcmatias Jan 29, 2022
1e96b56
Js files updates datepicker, dataTables and map
marcmatias Feb 2, 2022
7a907d8
Forms and alerts updates and enhancements
marcmatias Feb 1, 2022
e20f325
Removing unused files
marcmatias Feb 9, 2022
1c5e053
make lint
turicas May 10, 2024
cc9b891
New endpoint for better fetch
marcmatias Mar 2, 2022
f23ec10
Updating styles
marcmatias Mar 2, 2022
6d8ad3a
Dashboard js update and datatable tranlate texts
marcmatias Mar 2, 2022
70f1c5e
Dashboard and data-tables templates update
marcmatias Mar 2, 2022
1d8ccf9
Rename custom recaptcha field
turicas May 10, 2024
e6eb445
make lint
turicas May 10, 2024
b90cecf
Remove COVID-19 banner from homepage
marcmatias May 14, 2024
d78a77e
Remove empty spaces
marcmatias May 14, 2024
5f9f1c4
Upgrade bootstrap and sass versions
marcmatias May 14, 2024
e082fca
Fix last news home component styles with new bootstrap version
marcmatias May 14, 2024
b6439ec
Update footer styles to work with dark theme
marcmatias May 14, 2024
53bcf35
Update dataset-card styles with new bootstrap dark theme
marcmatias May 14, 2024
4c5ebe5
Update breadcrumb styles with new bootstrap dark theme
marcmatias May 14, 2024
767e00e
Fixes COVID19 dashboard to work with new bootstrap update dark theme
marcmatias May 14, 2024
ec5298e
Update auth themes to work better with different screen sizes
marcmatias May 14, 2024
acdbe42
New theme selector
marcmatias May 14, 2024
8a73ec5
Fix indent menu template archive
marcmatias May 14, 2024
1a4228e
Fix toast long messages and update toast styles
marcmatias May 16, 2024
5235d72
Generate new styles
marcmatias May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
New theme selector
  • Loading branch information
marcmatias authored and turicas committed Jun 30, 2024
commit acdbe42d22631567091d14c20dc9b2f40c0ed28e
39 changes: 38 additions & 1 deletion core/templates/core/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,48 @@
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle"
id="bd-theme"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-circle-half"
viewBox="0 0 16 16"
>
<path d="M8 15A7 7 0 1 0 8 1zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16"/>
</svg>
</a>
<ul class="dropdown-menu">
<li>
<a type="button" class="dropdown-item" data-bs-theme-value="light">
Iluminado
</a>
</li>
<li>
<a type="button" class="dropdown-item" data-bs-theme-value="dark">
Escuro
</a>
</li>
<li>
<a type="button" class="dropdown-item" data-bs-theme-value="auto">
Automático
</a>
</li>
</ul>
</li>
</ul>

<a class="btn btn-bd-download ms-2"
href="{% url 'core:donate' %}"
target="_blank">
Apoie
</a>
{% endcache %}
{% endcache %}
76 changes: 76 additions & 0 deletions static/js/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2024 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/

(() => {
'use strict'

const getStoredTheme = () => localStorage.getItem('theme')
const setStoredTheme = theme => localStorage.setItem('theme', theme)

const getPreferredTheme = () => {
const storedTheme = getStoredTheme()
if (storedTheme) {
return storedTheme
}

return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}

const setTheme = theme => {
if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}

setTheme(getPreferredTheme())

const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')

if (!themeSwitcher) {
return
}

const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)

document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
element.setAttribute('aria-pressed', 'false')
})

btnToActive.classList.add('active')
btnToActive.setAttribute('aria-pressed', 'true')
const themeSwitcherLabel = `(${btnToActive.dataset.bsThemeValue})`
themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)

if (focus) {
themeSwitcher.focus()
}
}

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
const storedTheme = getStoredTheme()
if (storedTheme !== 'light' && storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})

window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())

document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
setStoredTheme(theme)
setTheme(theme)
showActiveTheme(theme, true)
})
})
})
})()
1 change: 1 addition & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ <h5>Inscreva-se na nossa newsletter</h5>
{% block bodyscript %}
<!-- Bootstrap core JS-->
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'js/theme.js' %}"></script>
<script>
// Query and show all toasts
const toasts = document.querySelectorAll(".toast");
Expand Down