LSrelation: use LSview_actions.tpl

This commit is contained in:
Benjamin Renard 2020-06-04 16:46:00 +02:00
parent 6f3edba986
commit 62b0eb36ab
4 changed files with 17 additions and 11 deletions

View file

@ -17,3 +17,9 @@ a.LSrelation {
color: #000; color: #000;
font-weight: normal; font-weight: normal;
} }
@media (max-width: 400px) {
ul.LSrelation {
clear: both
}
}

View file

@ -660,6 +660,9 @@ class LSrelation extends LSlog_staticLoggerClass {
'url' => "object/select/$id", 'url' => "object/select/$id",
'action' => 'modify', 'action' => 'modify',
'class' => 'LSrelation_modify', 'class' => 'LSrelation_modify',
'data' => array(
'relation-id' => $id,
)
); );
} }
if ($relation -> canCreate()) { if ($relation -> canCreate()) {

View file

@ -98,15 +98,15 @@ var LSrelation = new Class({
onLSrelationModifyBtnClick: function(event,a) { onLSrelationModifyBtnClick: function(event,a) {
new Event(event).stop(); new Event(event).stop();
var relation_id = a.getProperty('data-relation-id');
var data = { var data = {
id: a.id, id: relation_id,
href: a.href href: a.href
}; };
LSdebug(data); LSdebug(data);
this.refreshRelation=a.id; this.refreshRelation=relation_id;
data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+a.id,'inside'); data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+relation_id,'inside');
new Request({url: 'ajax/class/LSrelation/initSelection', data: data, onSuccess: this.onLSrelationModifyBtnClickComplete.bind(this)}).send(); new Request({url: 'ajax/class/LSrelation/initSelection', data: data, onSuccess: this.onLSrelationModifyBtnClickComplete.bind(this)}).send();
}, },
@ -115,7 +115,7 @@ var LSrelation = new Class({
if ( varLSdefault.checkAjaxReturn(data) && data['success'] ) { if ( varLSdefault.checkAjaxReturn(data) && data['success'] ) {
varLSsmoothbox.asNew(); varLSsmoothbox.asNew();
varLSsmoothbox.addEvent('valid', this.onLSsmoothboxValid.bind(this)); varLSsmoothbox.addEvent('valid', this.onLSsmoothboxValid.bind(this));
varLSsmoothbox.openURL(data.href,{startElement: $(data.id), width: 635}); varLSsmoothbox.openURL(data.href,{startElement: $$('a.LSrelation_modify[data-relation-id='+data.id+']').getFirst(), width: 635});
} }
}, },

View file

@ -1,10 +1,7 @@
<h1 id='LSrelation_title_{$item.id|escape:"quotes"}' class='LSrelation'>{$item.label|escape:"htmlall"}</h1> <h1 id='LSrelation_title_{$item.id|escape:"quotes"}' class='LSrelation'>{$item.label|escape:"htmlall"}</h1>
{if $item.actions!=''} {if $item.actions}
<ul class='LSview-actions'> {assign var=LSview_actions value=$item.actions}
{foreach from=$item.actions item=action} {include file='ls:LSview_actions.tpl'}
<li class='LSview-actions'><a href='{$action.url}' class='LSview-actions{if $action.class} {$action.class}{/if}' id='{$item.id|escape:"quotes"}'><img src='{img name=$action.action}' alt='{$action.label|escape:"htmlall"}' title='{$action.label|escape:"htmlall"}' /> {$action.label|escape:"htmlall"}</a></li>
{/foreach}
</ul>
{/if} {/if}
<ul id='LSrelation_ul_{$item.id|escape:"quotes"}' class='LSrelation'> <ul id='LSrelation_ul_{$item.id|escape:"quotes"}' class='LSrelation'>
{if isset($item['objectList']) && !empty($item.objectList)} {if isset($item['objectList']) && !empty($item.objectList)}