Skip to content

Commit

Permalink
Merge branch 'CW-4236' into 'dev'
Browse files Browse the repository at this point in the history
dropdown instead of nav links [CW-4236]

Closes CW-4236

See merge request epi2melabs/ezcharts!184
  • Loading branch information
mattdmem committed Jun 12, 2024
2 parents 3c9493e + 1bd89e1 commit b37153f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.9.2]
### Changed
- Navigation bar links now replaced with a dropdown list of links to sections on the report.

## [v0.9.1]
### Added
- Ability to change height of seq summary plots.
Expand Down
2 changes: 1 addition & 1 deletion ezcharts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Simple eCharts API."""

__version__ = "0.9.1"
__version__ = "0.9.2"

import argparse
import importlib
Expand Down
39 changes: 26 additions & 13 deletions ezcharts/components/reports/labs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List, Optional, Type

from dominate.tags import (
a, code, div, h4, html_tag, li, p, section, ul)
a, button, code, div, h4, html_tag, p, section)

from ezcharts.components.params import ParamsTable
from ezcharts.components.reports import Report
Expand Down Expand Up @@ -73,9 +73,9 @@ class ILabsNavigationClasses(IClasses):
logo: str = cls(
"d-flex", "align-items-center", "pe-5", "mb-md-0",
"me-md-auto", "text-decoration-none")
nav_list: str = cls("nav", "nav-pills", "flex-row")
nav_item: str = cls("nav-item")
nav_item_link: str = cls("nav-link", "text-white")
dropdown_btn: str = cls("btn", "btn-primary", "dropdown-toggle")
dropdown_menu: str = cls("dropdown-menu")
dropdown_item_link: str = cls("dropdown-item")


class LabsNavigation(Snippet):
Expand Down Expand Up @@ -106,10 +106,24 @@ def __init__(
with div(className=self.classes.inner):
with a(href="https://labs.epi2me.io/", className=self.classes.logo):
logo()
for group in groups:
setattr(
self, group,
ul(className=self.classes.nav_list, __pretty=False))

button(
"Jump to section... ",
cls=self.classes.dropdown_btn,
type="button",
id="dropdownMenuButton",
data_bs_toggle="dropdown",
aria_haspopup="true",
aria_expanded="false")

ngroups = len(groups)
with div(className=self.classes.dropdown_menu):
for count, group in enumerate(groups):
setattr(
self, group,
div(className='', __pretty=False))
if count != ngroups - 1:
div(cls="dropdown-divider")

def add_link(
self,
Expand All @@ -120,11 +134,10 @@ def add_link(
"""Add a header nav link to the header links list."""
group_list = getattr(self, group)
with group_list:
with li(className=self.classes.nav_item):
a(
link_title,
href=link_href,
className=self.classes.nav_item_link)
a(
link_title,
href=link_href,
className=self.classes.dropdown_item_link)


class BasicReport(Report):
Expand Down

0 comments on commit b37153f

Please sign in to comment.