123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- use yii\helpers\Html;
- use dosamigos\fileupload\FileUpload;
- use dosamigos\fileupload\FileUploadUI;
- /** @var yii\web\View $this */
- /** @var app\models\Page $model */
- $this->title = 'Create Pages';
- $this->params['breadcrumbs'][] = ['label' => 'Docs', 'url' => ['index']];
- $this->params['breadcrumbs'][] = $this->title;
- $cat = Yii::$app->request->get('cat', '');
- ?>
- <div class="page-create">
- <?php
- // with UI
- ?>
- <?= FileUploadUI::widget([
- 'model' => $model,
- 'attribute' => 'file',
- 'url' => ['docsupload', 'id' => 0, 'cat'=>$cat],
- 'gallery' => false,
- 'fieldOptions' => [
- 'accept' => '*'
- ],
- 'clientOptions' => [
- 'limitConcurrentUploads' => 3,
- 'disableImageMetaDataLoad' => true
- ],
- // ...
- 'clientEvents' => [
- 'fileuploaddone' => 'function(e, data) {
- // console.log(e);
- // console.log(data);
- console.log(data.context);
- console.log(data);
- setTimeout(() => {
- // $(data.context[0]).removeClass("show");
- $(data.context[0]).css("display","none");
- }, 4000);
- e.preventDefault();
- }',
- 'fileuploadfail' => 'function(e, data) {
- // console.log(e);
- // console.log(data);
- e.preventDefault();
- }',
- 'fileuploadchange' => 'function(e, data) {
- // console.log(e);
- // console.log(data);
- setTimeout(() => {
- $(".template-upload").removeClass("fade");
- }, 500);
- //e.preventDefault();
- }',
- 'fileuploadstart' => 'function(e, data) {
- $(".fileupload-progress").removeClass("fade");
- e.preventDefault();
- }',
- ],
- ]); ?>
- </div>
|