Skip to content

Commit 7455986

Browse files
committed
v3
1 parent d01592c commit 7455986

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Widget/PlaneAction/HeadPosAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ public function __construct($title,$url,$xhr,$options)
1515
{
1616
parent::__construct();
1717
$this->title = $title;
18+
$callback = isset($xhr['callback']) ? $xhr['callback'] : 'null';
19+
unset($xhr['callback']);
1820
$xhr = json_encode($xhr);
1921
$options = json_encode($options);
2022
$this->document_id = substr(md5($title.$url),16);
2123
Admin::script(<<<EOF
2224
$('#{$this->document_id}').click(function(){
2325
let url = '{$url}';
2426
let XHR = JSON.parse('{$xhr}');
27+
XHR.callback = {$callback};
2528
XHR.url = XHR.url !== undefined ? XHR.url : url;
26-
XHR.element = document.querySelector('#dlp-plane button[type="submit"]');
27-
XHR.listener = (DOM)=>{DOM.querySelector('button[type="submit"]')};
29+
XHR.listener = (DOM)=>DOM.querySelector('button[type="submit"]');
2830
new ComponentPlane(url,XHR,JSON.parse('{$options}'));
2931
});
3032
EOF

src/Widget/PlaneAction/RowPosAction.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ public function __construct($title,$url,$xhr,$options)
1515
{
1616
parent::__construct();
1717
$this->title = $title;
18+
$callback = isset($xhr['callback']) ? $xhr['callback'] : 'null';
19+
unset($xhr['callback']);
1820
$xhr = json_encode($xhr);
1921
$options = json_encode($options);
2022
$this->document_class = substr(md5($title.$url),16);
2123
Admin::script(<<<EOF
2224
$('.{$this->document_class}').click(function(){
2325
let url = '{$url}'.replace('{id}',$(this).attr('data-id'));
2426
let XHR = JSON.parse('{$xhr}');
27+
XHR.callback = {$callback};
2528
let xhr_url = XHR.url !== undefined ? XHR.url : url;
2629
XHR.url = xhr_url.replace('{id}',$(this).attr('data-id'));
2730
XHR.listener = (DOM)=>DOM.querySelector('button[type="submit"]');

0 commit comments

Comments
 (0)