completion of the document module
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use kartik\file\FileInput;
|
||||
use mihaildev\elfinder\InputFile;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
@ -16,20 +17,12 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= InputFile::widget([
|
||||
'language' => 'ru',
|
||||
'controller' => 'elfinder',
|
||||
// вставляем название контроллера, по умолчанию равен elfinder
|
||||
//'filter' => ['image', 'application/zip', 'application/csv', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
||||
// фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con..
|
||||
'name' => 'Template[template_file_name]',
|
||||
'id' => 'template-doc',
|
||||
'template' => '<label>Шаблон</label><div class="input-group">{input}<span class="span-btn">{button}</span></div>',
|
||||
'options' => ['class' => 'form-control', 'maxlength' => '255'],
|
||||
'buttonOptions' => ['class' => 'btn btn-primary'],
|
||||
'value' => $model->template_file_name,
|
||||
'buttonName' => 'Выбрать шаблон',
|
||||
]);?>
|
||||
<?= $form->field($model, 'template')->widget(FileInput::classname(), [
|
||||
'options' => ['accept' => 'text/*'],
|
||||
'pluginOptions' => [
|
||||
'allowedFileExtensions'=>['docx'],'showUpload' => true
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use kartik\file\FileInput;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\Template */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="template-form">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'options' => ['enctype'=>'multipart/form-data']]); ?>
|
||||
|
||||
<?= $form->field($model, 'template')->widget(FileInput::classname(), [
|
||||
'options' => ['accept' => 'text/*'],
|
||||
'pluginOptions' => [
|
||||
'allowedFileExtensions'=>['docx'],'showUpload' => true
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\Template */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="template-form">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'options' => ['enctype'=>'multipart/form-data']]); ?>
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
@ -23,11 +23,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'title',
|
||||
// 'template_path',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {delete}',
|
||||
],
|
||||
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -29,7 +29,6 @@ function cut_title($str)
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
@ -44,7 +43,17 @@ function cut_title($str)
|
||||
|
||||
'attributes' => [
|
||||
'id',
|
||||
'title',
|
||||
[
|
||||
'label'=>'title',
|
||||
'format'=>'raw',
|
||||
'value' => function($model){
|
||||
return $model->title . Html::a(' <i class="glyphicon glyphicon-pencil"></i>',
|
||||
Url::to(['template/update-title', 'id' => $model->id]), [
|
||||
'title' => 'update-title',
|
||||
// 'class' => 'pull-right detail-button',
|
||||
]);
|
||||
}
|
||||
],
|
||||
'created_at',
|
||||
'updated_at',
|
||||
[
|
||||
@ -52,8 +61,8 @@ function cut_title($str)
|
||||
'format'=>'raw',
|
||||
'value' => function($model){
|
||||
return $model->template_file_name . Html::a(' <i class="glyphicon glyphicon-pencil"></i>',
|
||||
Url::to(['actualizar', 'id' => $model->id]), [
|
||||
'title' => 'Actualizar',
|
||||
Url::to(['template/update-file', 'id' => $model->id]), [
|
||||
'title' => 'update-file',
|
||||
// 'class' => 'pull-right detail-button',
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user