| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | protected function registerClientScripts() |
||
| 40 | { |
||
| 41 | $options = [ |
||
| 42 | 'url' => Url::to($this->url), |
||
| 43 | 'method' => $this->method, |
||
| 44 | 'data' => $this->data, |
||
| 45 | 'success' => $this->successCallback, |
||
| 46 | ]; |
||
| 47 | $options = Json::encode($options); |
||
| 48 | |||
| 49 | $js = <<<JS |
||
| 50 | jQuery('#{$this->getId()}').click(function(e){ |
||
| 51 | e.preventDefault(); |
||
| 52 | if ("{$this->confirm}"){ |
||
| 53 | if(confirm("{$this->confirm}")){ |
||
| 54 | jQuery.ajax($options); |
||
| 55 | } |
||
| 56 | }else{ |
||
| 57 | jQuery.ajax($options); |
||
| 58 | } |
||
| 59 | }); |
||
| 60 | JS; |
||
| 61 | $this->view->registerJs($js); |
||
| 62 | } |
||
| 63 | } |