Skip to content

Commit

Permalink
Merge pull request #844 from SuffolkLITLab/allow-string-hidden-for-nav
Browse files Browse the repository at this point in the history
Allow using 'data' rather than 'data from code' for al_nav_sections
  • Loading branch information
nonprofittechy authored Apr 26, 2024
2 parents 2c45d80 + 80084d1 commit 9347434
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions docassemble/AssemblyLine/al_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2244,8 +2244,12 @@ def send_email(
return send_email(
to=to,
template=template,
attachments=set(
self.as_editable_list(key=key) + self.as_pdf_list(key=key)
# Add both DOCX and PDF versions, but if it's not possible to be a DOCX don't add the PDF
# twice
attachments=list(
dict.fromkeys(
self.as_editable_list(key=key) + self.as_pdf_list(key=key)
)
),
**kwargs,
)
Expand Down
8 changes: 5 additions & 3 deletions docassemble/AssemblyLine/al_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@ def get_visible_al_nav_items(

# For dictionaries at top level
item_copy = deepcopy(item)
if not item_copy.pop("hidden", False): # if not hidden
if not str(item_copy.pop("hidden", "False")).lower() == "true": # if not hidden
for key, val in item_copy.items():
if isinstance(val, list): # if value of a key is a list
new_sublist: List[Union[str, dict]] = []
Expand All @@ -2105,8 +2105,10 @@ def get_visible_al_nav_items(
if isinstance(subitem, str):
new_sublist.append(subitem)
# Add dictionaries if not hidden
elif isinstance(subitem, dict) and not subitem.pop(
"hidden", False
elif (
isinstance(subitem, dict)
and not str(subitem.pop("hidden", "False")).lower()
== "true"
):
new_sublist.append(subitem)
item_copy[key] = new_sublist
Expand Down

0 comments on commit 9347434

Please sign in to comment.