| @@ 279-310 (lines=32) @@ | ||
| 276 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 277 | EOT; |
|
| 278 | ||
| 279 | if ($this->fileActionSettings['showRemove']) { |
|
| 280 | $text = [ |
|
| 281 | 'title' => trans('admin.delete_confirm'), |
|
| 282 | 'confirm' => trans('admin.confirm'), |
|
| 283 | 'cancel' => trans('admin.cancel'), |
|
| 284 | ]; |
|
| 285 | ||
| 286 | $this->script .= <<<EOT |
|
| 287 | $("input{$this->getElementClassSelector()}").on('filebeforedelete', function() { |
|
| 288 | ||
| 289 | return new Promise(function(resolve, reject) { |
|
| 290 | ||
| 291 | var remove = resolve; |
|
| 292 | ||
| 293 | swal({ |
|
| 294 | title: "{$text['title']}", |
|
| 295 | type: "warning", |
|
| 296 | showCancelButton: true, |
|
| 297 | confirmButtonColor: "#DD6B55", |
|
| 298 | confirmButtonText: "{$text['confirm']}", |
|
| 299 | showLoaderOnConfirm: true, |
|
| 300 | cancelButtonText: "{$text['cancel']}", |
|
| 301 | preConfirm: function() { |
|
| 302 | return new Promise(function(resolve) { |
|
| 303 | resolve(remove()); |
|
| 304 | }); |
|
| 305 | } |
|
| 306 | }); |
|
| 307 | }); |
|
| 308 | }); |
|
| 309 | EOT; |
|
| 310 | } |
|
| 311 | ||
| 312 | if ($this->fileActionSettings['showDrag']) { |
|
| 313 | $this->addVariables([ |
|
| @@ 197-228 (lines=32) @@ | ||
| 194 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 195 | EOT; |
|
| 196 | ||
| 197 | if ($this->fileActionSettings['showRemove']) { |
|
| 198 | $text = [ |
|
| 199 | 'title' => trans('admin.delete_confirm'), |
|
| 200 | 'confirm' => trans('admin.confirm'), |
|
| 201 | 'cancel' => trans('admin.cancel'), |
|
| 202 | ]; |
|
| 203 | ||
| 204 | $this->script .= <<<EOT |
|
| 205 | $("input{$this->getElementClassSelector()}").on('filebeforedelete', function() { |
|
| 206 | ||
| 207 | return new Promise(function(resolve, reject) { |
|
| 208 | ||
| 209 | var remove = resolve; |
|
| 210 | ||
| 211 | swal({ |
|
| 212 | title: "{$text['title']}", |
|
| 213 | type: "warning", |
|
| 214 | showCancelButton: true, |
|
| 215 | confirmButtonColor: "#DD6B55", |
|
| 216 | confirmButtonText: "{$text['confirm']}", |
|
| 217 | showLoaderOnConfirm: true, |
|
| 218 | cancelButtonText: "{$text['cancel']}", |
|
| 219 | preConfirm: function() { |
|
| 220 | return new Promise(function(resolve) { |
|
| 221 | resolve(remove()); |
|
| 222 | }); |
|
| 223 | } |
|
| 224 | }); |
|
| 225 | }); |
|
| 226 | }); |
|
| 227 | EOT; |
|
| 228 | } |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|