LSview actions: factorize templates in LSview_actions.tpl and improve responsive view

This commit is contained in:
Benjamin Renard 2020-06-04 16:34:40 +02:00
parent c221bbffdb
commit 9848e3d30e
8 changed files with 52 additions and 69 deletions

View file

@ -13,6 +13,9 @@ ul.LSform_layout_active {
margin: 1em; margin: 1em;
margin-bottom: 0; margin-bottom: 0;
clear: both; clear: both;
display: flex;
flex-wrap: nowrap;
overflow: auto;
} }
li.LSform_layout a { li.LSform_layout a {
@ -32,7 +35,7 @@ li.LSform_layout_active {
border-radius: 3px 3px 0px 0px; border-radius: 3px 3px 0px 0px;
padding: 4px; padding: 4px;
display: inline; display: inline;
margin-right: 1px; margin-right: 0.3rem;
} }
li.LSform_layout_current { li.LSform_layout_current {
@ -56,7 +59,7 @@ div.LSform_layout {
div.LSform_layout_active { div.LSform_layout_active {
display: none; display: none;
margin-top: 4px; margin-top: 0;
} }
div.LSform_layout_current { div.LSform_layout_current {
@ -171,6 +174,10 @@ p.LSform_listAvailableDataEntryForm {
margin-left: 0.5rem; margin-left: 0.5rem;
} }
dl.LSform {
clear: both;
}
dt.LSform { dt.LSform {
width: 34vw; width: 34vw;
} }

View file

@ -308,6 +308,10 @@ li.LSview-actions {
margin-right: 0.1rem; margin-right: 0.1rem;
} }
li.LSview-actions-hidden-label a span {
display: none;
}
/* /*
******************* *******************
* question * question
@ -518,6 +522,10 @@ input[type='submit'].LSview_search {
margin-top: 22px; margin-top: 22px;
border-top: 1px solid #0072b8; border-top: 1px solid #0072b8;
} }
ul.LSview-actions-dropdown li.LSview-actions-hidden-label a span {
display: initial;
}
} }
@media (max-width: 400px) { @media (max-width: 400px) {

View file

@ -0,0 +1,28 @@
{if isset($LSview_actions) && is_array($LSview_actions) && !empty($LSview_actions)}
<ul class='LSview-actions'>
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions{if isset($item['hideLabel']) && $item.hideLabel} LSview-actions-hidden-label{/if}'>
<a
href='{$item.url}'
class='
LSview-actions
{if isset($item['class'])}{$item.class|escape:"quotes"}{/if}
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)} LStips{/if}
'
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)}title='{if $item.helpInfo}{$item.helpInfo|escape:"htmlall"}{else}{$item.label|escape:"htmlall"}{/if}'{/if}
{if isset($item['id']) && $item.id}id='{$item.id|escape:"quotes"}'{/if}
{if isset($item['data']) && is_array($item['data']) && !empty($item['data'])}
{foreach $item['data'] as $data_key => $data_value}
data-{$data_key}='{$data_value|escape:'htmlall'}'
{/foreach}
{/if}
>
<img src="{img name=$item.action}" alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' />
<span>{$item.label}</span>
</a>
</li>
{/if}
{/foreach}
</ul>
{/if}

View file

@ -8,15 +8,7 @@
<h1>{tr msg="Global search"}</h1> <h1>{tr msg="Global search"}</h1>
{if $LSview_actions != ''} {include file='ls:LSview_actions.tpl'}
<ul class='LSview-actions LSview_search'>
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='{img name=$item.action}' alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' /> {$item.label|escape:"htmlall"}</a></li>
{/if}
{/foreach}
</ul>
{/if}
{foreach from=$pages item=page} {foreach from=$pages item=page}
{$page} {$page}

View file

@ -1,13 +1,8 @@
{extends file='ls:base_connected.tpl'} {extends file='ls:base_connected.tpl'}
{block name="content"} {block name="content"}
{if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle|escape:"htmlall"}</h1>{/if} {if $pagetitle != ''}<h1 id='LSform_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
{if $LSview_actions != ''}
<ul class='LSview-actions'> {include file='ls:LSview_actions.tpl'}
{foreach from=$LSview_actions item=item}
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='{img name=$item.action}' alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' /> {$item.label|escape:"htmlall"}</a></li>
{/foreach}
</ul>
{/if}
{include file='ls:LSform.tpl'} {include file='ls:LSform.tpl'}
{/block} {/block}

View file

@ -1,13 +1,7 @@
{extends file='ls:base_connected.tpl'} {extends file='ls:base_connected.tpl'}
{block name="content"} {block name="content"}
{if $pagetitle != ''}<h1>{$pagetitle|escape:"htmlall"}</h1>{/if} {if $pagetitle != ''}<h1>{$pagetitle|escape:"htmlall"}</h1>{/if}
{if $LSview_actions != ''} {include file='ls:LSview_actions.tpl'}
<p class='LSview-actions'>
{foreach from=$LSview_actions item=item}
<a href='{$item.url}' class='LSview-actions'><img src='{img name=$item.action}' alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' /></a>
{/foreach}
</p>
{/if}
<p class='question'>{$question}</p> <p class='question'>{$question}</p>
<a href='{$validation_url}' class='question'>{$validation_label|escape:"htmlall"}</a> <a href='{$validation_url}' class='question'>{$validation_label|escape:"htmlall"}</a>

View file

@ -1,28 +1,8 @@
{extends file='ls:base_connected.tpl'} {extends file='ls:base_connected.tpl'}
{block name="content"} {block name="content"}
{if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle|escape:"htmlall"}</h1>{/if} {if $pagetitle != ''}<h1 id='LSview_title'>{$pagetitle|escape:"htmlall"}</h1>{/if}
{if $LSview_actions != ''}
<ul class='LSview-actions'> {include file='ls:LSview_actions.tpl'}
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions'>
<a
href='{$item.url}'
class='
LSview-actions
{if isset($item['class'])}{$item.class|escape:"quotes"}{/if}
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)} LStips{/if}
'
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)}title='{if $item.helpInfo}{$item.helpInfo|escape:"htmlall"}{else}{$item.label|escape:"htmlall"}{/if}'{/if}
>
<img src="{img name=$item.action}" alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' />
{if !isset($item.hideLabel) || !$item.hideLabel} {$item.label}{/if}
</a>
</li>
{/if}
{/foreach}
</ul>
{/if}
{include file='ls:LSform_view.tpl'} {include file='ls:LSform_view.tpl'}

View file

@ -19,28 +19,7 @@
{$pagetitle|escape:"htmlall"} {$pagetitle|escape:"htmlall"}
</h1> </h1>
{if $LSview_actions != ''} {include file='ls:LSview_actions.tpl'}
<ul class='LSview-actions'>
{foreach from=$LSview_actions item=item}
{if is_array($item)}
<li class='LSview-actions'>
<a
href='{$item.url}'
class='
LSview-actions
{if isset($item['class'])}{$item.class|escape:"quotes"}{/if}
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)} LStips{/if}
'
{if isset($item['helpInfo']) || (isset($item['hideLabel']) && $item.hideLabel && isset($item.label) && $item.label)}title='{if $item.helpInfo}{$item.helpInfo|escape:"htmlall"}{else}{$item.label|escape:"htmlall"}{/if}'{/if}
>
<img src="{img name=$item.action}" alt='{$item.label|escape:"htmlall"}' title='{$item.label|escape:"htmlall"}' />
{if !isset($item.hideLabel) || !$item.hideLabel} {$item.label}{/if}
</a>
</li>
{/if}
{/foreach}
</ul>
{/if}
{if count($LSsearch->predefinedFilters) != 0} {if count($LSsearch->predefinedFilters) != 0}
<select id='LSview_search_predefinedFilter' name='predefinedFilter'> <select id='LSview_search_predefinedFilter' name='predefinedFilter'>