diff --git a/docassemble/ALToolbox/data/questions/collapse_template_demo.yml b/docassemble/ALToolbox/data/questions/collapse_template_demo.yml index 97cce555..678d54f8 100644 --- a/docassemble/ALToolbox/data/questions/collapse_template_demo.yml +++ b/docassemble/ALToolbox/data/questions/collapse_template_demo.yml @@ -42,7 +42,7 @@ subquestion: | Don't you have a favorite fruit? - ${ collapse_template(favorite_explanation, container_classname="favorites_container") } + ${ collapse_template(favorite_explanation) } You must have a favorite. fields: diff --git a/docassemble/ALToolbox/data/questions/display_template_demo.yml b/docassemble/ALToolbox/data/questions/display_template_demo.yml index b41d0a6b..da348610 100644 --- a/docassemble/ALToolbox/data/questions/display_template_demo.yml +++ b/docassemble/ALToolbox/data/questions/display_template_demo.yml @@ -33,8 +33,6 @@ subquestion: | - This feature applies the **copy_button_html()** function to template content. See [copy button demo](${interview_url(i=user_info().package + ":copy_button_demo.yml")}). 1. **classname** (default="bg-light") - To style your template content, include a `classname` keyword argument when you call the function and add your css rules either on the screen or to a .css file. - 1. **container_classname** (default=None) - - To style the whole container of your subject and content, include a `content_classname` keyword argument when you call the function and add your css rules either on the screen or to a .css file. You can mix and match these features. The following screens will show you how. @@ -46,7 +44,7 @@ question: | Scrollable examples subquestion: | ##### Srollable only - ${ display_template(my_template1, container_classname="my_class") } + ${ display_template(my_template1) } ##### Style only ${ display_template(my_template2, scrollable=False, classname="my_color") } diff --git a/docassemble/ALToolbox/display_template.py b/docassemble/ALToolbox/display_template.py index 31226b5c..017a5faa 100644 --- a/docassemble/ALToolbox/display_template.py +++ b/docassemble/ALToolbox/display_template.py @@ -9,7 +9,6 @@ def display_template( collapse=False, copy=False, classname="bg-light", - container_classname=None, class_name=None # depricated ) -> str: # 1. Initialize @@ -27,9 +26,7 @@ def display_template( class_name = classname class_name = class_name.strip() - container_classname_plus = "al_display_template" - if container_classname: - container_classname_plus += f" { container_classname }" + container_classname = "al_display_template" container_id = b64encode(str(template.instanceName).encode()).decode().replace('=', '') contents_id = f"{ container_id }_contents" @@ -50,12 +47,12 @@ def display_template( # 2.1 If collapsible, add collapsible elements to the output if collapse: - return f'
{contents}
' + return f'
{contents}
' # 2.2 If not collapsible, simply return output from copy_button_html() else: return f""" -
+
{subject_html} {contents}
@@ -64,7 +61,7 @@ def display_template( # 3. If not copiable, generate the whole output else: if collapse: - return f'
{template.content_as_html()}
' + return f'
{template.content_as_html()}
' else: - return f'
{subject_html}
{template.content_as_html()}
' + return f'
{subject_html}
{template.content_as_html()}
' diff --git a/docassemble/ALToolbox/misc.py b/docassemble/ALToolbox/misc.py index 75f382da..974b3809 100644 --- a/docassemble/ALToolbox/misc.py +++ b/docassemble/ALToolbox/misc.py @@ -162,7 +162,6 @@ def number_to_letter(n: Optional[int]) -> str: def collapse_template( template, classname=None, - container_classname=None, closed_icon="caret-right", open_icon="caret-down", ): @@ -181,15 +180,13 @@ def collapse_template( classname = " bg-light" else: classname = " " + classname.strip() - container_classes_plus = "al_collapse_template" - if container_classname: - container_classes_plus += f" { container_classname }" + container_classnames = "al_collapse_template" container_id = b64encode(str(template.instanceName).encode()).decode().replace('=', '') contents_id = f'{ container_id }_contents' return f"""\ -
+