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

Make it possible to add additional CSS classes to language selector #872

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions docassemble/AssemblyLine/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def get_language_list_dropdown(
current: str = "",
languages_path: Optional[str] = None,
event_name="al_change_language",
icon="fa-solid fa-language",
icon="fa-solid fa-language fa-xl",
extra_class: str = "text-light",
) -> str:
"""
Get a Bootstrap 5 dropdown menu for language selection that can be added to navigation bar.
Expand All @@ -102,14 +103,14 @@ def get_language_list_dropdown(
current: the current language code
languages_path: the path to the languages.yml file (defaults to data/sources/languages.yml)
event_name: the name of the event to trigger when the language is changed
icon: the name of the icon to use for the dropdown menu (defaults to fa-solid fa-language)

icon: the name of the icon to use for the dropdown menu (defaults to fa-solid fa-language fa-xl)
extra_class: additional classes to add to the link
Returns:
A string containing the HTML for a dropdown menu for language selection.
"""
list_start = f"""<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-light" href="#" id="languageSelector" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="Language selection">
<i class="{icon}"></i>
<a class="nav-link dropdown-toggle { extra_class }" href="#" id="languageSelector" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="Language selection">
<i class="{ icon }"></i>
</a>
<div class="dropdown-menu" aria-labelledby="languageSelector">
"""
Expand Down
Loading