Skip to content

Commit

Permalink
Merge branch 'main' into eval_htmx_button
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho authored Sep 6, 2024
2 parents 3243f5f + 23c6852 commit 5dc122e
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions Products/zms/zpt/common/zmi_tabs.zpt
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<div xmlns:hx-on="https://htmx.org/" class="collapse navbar-collapse row" id="tabs_items">
<ul class="nav nav-tabs" tal:define="global
current python:request['URL'].split('/')[-1];
options options/options;
actions python:[x.get('alias',x['action']) for x in options];
active python:[
(x==current and not here.id+'/'+current in actions) or
(x==here.id+'/'+current) or
(current not in actions and current.startswith(x)) for x in actions];
noactive python:len([x for x in active if x])<1;
"><tal:block tal:repeat="i python:range(len(options))"
current python:request['URL'].split('/')[-1];
options options/options;
actions python:[x.get('alias',x['action']) for x in options];
active python:[
(x==current and not here.id+'/'+current in actions) or
(x==here.id+'/'+current) or
(current not in actions and current.startswith(x)) for x in actions];
noactive python:len([x for x in active if x])<1;"
><tal:block tal:repeat="i python:range(len(options))"
><tal:block tal:define="option python:options[i]"
><li class="nav-item" hx-target="body" hx-push-url="true"
tal:attributes="data-action option/action; hx-get python:here.url_append_params('%s/%s?lang=%s'%(here.getSelf().absolute_url(),option['action'],request['lang']),option.get('params',{}),sep='&');"
><a tal:attributes="class python:' '.join(['nav-link']+[['','active'][int(active[i] or (i==0 and noactive))]])"
tal:content="structure python:here.getZMILangStr(option['label'])">label</a>
><li class="nav-item" tal:attributes="data-action option/action;"
><a class="nav-link"
tal:define="
url python:here.url_append_params('%s/%s?lang=%s'%(here.getSelf().absolute_url(),option['action'],request['lang']),option.get('params',{}),sep='&');
css_class python:' '.join(['nav-link']+[['','active'][int(active[i] or (i==0 and noactive))]]);
label python:here.getZMILangStr(option['label']);"
hx-target="body"
hx-push-url="true"
hx-trigger="click"
tal:attributes="href url; hx-get url;class css_class;"
tal:content="structure label">
label
</a>
</li>
</tal:block>
</tal:block>
Expand Down

0 comments on commit 5dc122e

Please sign in to comment.