Skip to content

Commit

Permalink
Handle 'skip level' condition of selecting a child far down the tree …
Browse files Browse the repository at this point in the history
…with nothing previously selected
  • Loading branch information
Kaurin committed Nov 8, 2023
1 parent d406a6c commit df8aa7d
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions templates/onclick_handler.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,25 @@ FunctionEnd
{%- endmacro%}


{#- Selects a dependancy if any of the dependants are clicked #}
{#- Selects a parent if any of the children are clicked #}
{#- Applies to install items only #}
{%- macro dependancy_install_select_parent(parent) %}
{#- ; PARENT: {{parent.basename}} // {{parent.category_name}} #}
{%- for child in parent._dependants %}
{#- ; CHILD: {{child.basename}} // {{child.category_name}} #}
{%- if child == parent._dependants[0] %} {# First element in the loop has 'IfNot', others have 'AndIfNot'#}
${If} ${SectionIsSelected} {{ '${' }}{{child._ids.install}}{{ '}' }} ; child.basename: {{child.basename}} // child.category_name: {{child.category_name}}
${OrIf} ${SectionIsPartiallySelected} {{ '${' }}{{child._ids.install}}{{ '}' }} ; child.basename: {{child.basename}} // child.category_name: {{child.category_name}}
{%- else %}
${OrIf} ${SectionIsSelected} {{ '${' }}{{child._ids.install}}{{ '}' }} ; child.basename: {{child.basename}} // child.category_name: {{child.category_name}}
${OrIf} ${SectionIsPartiallySelected} {{ '${' }}{{child._ids.install}}{{ '}' }} ; child.basename: {{child.basename}} // child.category_name: {{child.category_name}}
{%- endif %}
{%- endfor %}
!insertmacro SelectSection {{ '${' }}{{parent._ids.install_bespoke}}{{ '}' }} ; parent.basename: {{parent.basename}} // parent.category_name: {{parent.category_name}}
${EndIf}
{%- endmacro %}


{#- Selects all children if the dependancy is clicked #}
{#- Applies to UN-install items only #}
{%- macro dependancy_uninstall_select_children(parent) %}
{#- ; PARENT: {{parent.basename}} // {{parent.category_name}} #}
${If} ${SectionIsSelected} {{ '${' }}{{parent._ids.uninstall_bespoke}}{{ '}' }} ; parent.basename: {{parent.basename}} // parent.category_name: {{parent.category_name}}
{%- for child in parent._dependants %}
{#- ; CHILD: {{child.basename}} // {{child.category_name}} #}
!insertmacro SelectSection {{ '${' }}{{child._ids.uninstall}}{{ '}' }} ; child.basename: {{child.basename}} // child.category_name: {{child.category_name}}
{%- endfor %}
${EndIf}
{%- endmacro %}


{#- helper function to print the available name or category_name #}
{%- macro print_available_name(asset) -%}
{%- if asset.category_name is not none -%}
Expand Down

0 comments on commit df8aa7d

Please sign in to comment.