| @@ 252-283 (lines=32) @@ | ||
| 249 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 250 | EOT; |
|
| 251 | ||
| 252 | if ($this->fileActionSettings['showRemove']) { |
|
| 253 | $text = [ |
|
| 254 | 'title' => trans('admin.delete_confirm'), |
|
| 255 | 'confirm' => trans('admin.confirm'), |
|
| 256 | 'cancel' => trans('admin.cancel'), |
|
| 257 | ]; |
|
| 258 | ||
| 259 | $this->script .= <<<EOT |
|
| 260 | $("input{$this->getElementClassSelector()}").on('filebeforedelete', function() { |
|
| 261 | ||
| 262 | return new Promise(function(resolve, reject) { |
|
| 263 | ||
| 264 | var remove = resolve; |
|
| 265 | ||
| 266 | swal({ |
|
| 267 | title: "{$text['title']}", |
|
| 268 | type: "warning", |
|
| 269 | showCancelButton: true, |
|
| 270 | confirmButtonColor: "#DD6B55", |
|
| 271 | confirmButtonText: "{$text['confirm']}", |
|
| 272 | showLoaderOnConfirm: true, |
|
| 273 | cancelButtonText: "{$text['cancel']}", |
|
| 274 | preConfirm: function() { |
|
| 275 | return new Promise(function(resolve) { |
|
| 276 | resolve(remove()); |
|
| 277 | }); |
|
| 278 | } |
|
| 279 | }); |
|
| 280 | }); |
|
| 281 | }); |
|
| 282 | EOT; |
|
| 283 | } |
|
| 284 | ||
| 285 | if ($this->fileActionSettings['showDrag']) { |
|
| 286 | $this->addVariables([ |
|
| @@ 192-223 (lines=32) @@ | ||
| 189 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 190 | EOT; |
|
| 191 | ||
| 192 | if ($this->fileActionSettings['showRemove']) { |
|
| 193 | $text = [ |
|
| 194 | 'title' => trans('admin.delete_confirm'), |
|
| 195 | 'confirm' => trans('admin.confirm'), |
|
| 196 | 'cancel' => trans('admin.cancel'), |
|
| 197 | ]; |
|
| 198 | ||
| 199 | $this->script .= <<<EOT |
|
| 200 | $("input{$this->getElementClassSelector()}").on('filebeforedelete', function() { |
|
| 201 | ||
| 202 | return new Promise(function(resolve, reject) { |
|
| 203 | ||
| 204 | var remove = resolve; |
|
| 205 | ||
| 206 | swal({ |
|
| 207 | title: "{$text['title']}", |
|
| 208 | type: "warning", |
|
| 209 | showCancelButton: true, |
|
| 210 | confirmButtonColor: "#DD6B55", |
|
| 211 | confirmButtonText: "{$text['confirm']}", |
|
| 212 | showLoaderOnConfirm: true, |
|
| 213 | cancelButtonText: "{$text['cancel']}", |
|
| 214 | preConfirm: function() { |
|
| 215 | return new Promise(function(resolve) { |
|
| 216 | resolve(remove()); |
|
| 217 | }); |
|
| 218 | } |
|
| 219 | }); |
|
| 220 | }); |
|
| 221 | }); |
|
| 222 | EOT; |
|
| 223 | } |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|