From 62b0eb36ab7c1c6eb7ee7d647178bb3cd6884ade Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 4 Jun 2020 16:46:00 +0200 Subject: [PATCH] LSrelation: use LSview_actions.tpl --- src/css/default/LSrelation.css | 6 ++++++ src/includes/class/class.LSrelation.php | 3 +++ src/includes/js/LSrelation.js | 10 +++++----- src/templates/default/LSrelations.tpl | 9 +++------ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/css/default/LSrelation.css b/src/css/default/LSrelation.css index 9ecb917d..d0cef282 100644 --- a/src/css/default/LSrelation.css +++ b/src/css/default/LSrelation.css @@ -17,3 +17,9 @@ a.LSrelation { color: #000; font-weight: normal; } + +@media (max-width: 400px) { + ul.LSrelation { + clear: both + } +} diff --git a/src/includes/class/class.LSrelation.php b/src/includes/class/class.LSrelation.php index 2078837f..4079f1fc 100644 --- a/src/includes/class/class.LSrelation.php +++ b/src/includes/class/class.LSrelation.php @@ -660,6 +660,9 @@ class LSrelation extends LSlog_staticLoggerClass { 'url' => "object/select/$id", 'action' => 'modify', 'class' => 'LSrelation_modify', + 'data' => array( + 'relation-id' => $id, + ) ); } if ($relation -> canCreate()) { diff --git a/src/includes/js/LSrelation.js b/src/includes/js/LSrelation.js index 64875867..6e33e128 100644 --- a/src/includes/js/LSrelation.js +++ b/src/includes/js/LSrelation.js @@ -98,15 +98,15 @@ var LSrelation = new Class({ onLSrelationModifyBtnClick: function(event,a) { new Event(event).stop(); - + var relation_id = a.getProperty('data-relation-id'); var data = { - id: a.id, + id: relation_id, href: a.href }; LSdebug(data); - this.refreshRelation=a.id; - data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+a.id,'inside'); + this.refreshRelation=relation_id; + data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+relation_id,'inside'); 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'] ) { varLSsmoothbox.asNew(); 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}); } }, diff --git a/src/templates/default/LSrelations.tpl b/src/templates/default/LSrelations.tpl index 5770df74..8e5700c4 100644 --- a/src/templates/default/LSrelations.tpl +++ b/src/templates/default/LSrelations.tpl @@ -1,10 +1,7 @@

{$item.label|escape:"htmlall"}

-{if $item.actions!=''} - +{if $item.actions} + {assign var=LSview_actions value=$item.actions} + {include file='ls:LSview_actions.tpl'} {/if}