intermediate commit
This commit is contained in:
@ -19,6 +19,8 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?= $form->field($model, 'title') ?>
|
||||
|
||||
<?= $form->field($model, 'field_template') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
|
@ -12,8 +12,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="document-field-index">
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Создать поле документа', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
<?= Html::a('Создать новое поле', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
@ -23,6 +25,12 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'title',
|
||||
[
|
||||
'attribute' => 'field_template',
|
||||
'value' => function($model) {
|
||||
return '${' . $model->field_template . '}';
|
||||
},
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
|
@ -30,6 +30,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attributes' => [
|
||||
'id',
|
||||
'title',
|
||||
[
|
||||
'attribute' => 'field_template',
|
||||
'value' => '${' . $model->field_template . '}',
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
@ -91,4 +91,12 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
) ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?= Html::a(
|
||||
'Файл',
|
||||
['document/create-document', 'id' => $model->id],
|
||||
['class' => 'btn btn-primary']
|
||||
) ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use kartik\file\FileInput;
|
||||
use mihaildev\elfinder\InputFile;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
@ -17,12 +16,20 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'template')->widget(FileInput::classname(), [
|
||||
'options' => ['accept' => 'text/*'],
|
||||
'pluginOptions' => [
|
||||
'allowedFileExtensions'=>['doc','docx','txt'],'showUpload' => 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' => 'Выбрать шаблон',
|
||||
]);?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use kartik\file\FileInput;
|
||||
use mihaildev\elfinder\InputFile;
|
||||
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]) ?>
|
||||
|
||||
<?= $form->field($model, 'template')->widget(FileInput::classname(), [
|
||||
'options' => ['accept' => 'text/*'],
|
||||
'pluginOptions' => [
|
||||
'allowedFileExtensions'=>['doc','docx','txt'],'showUpload' => true
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
@ -5,10 +5,18 @@ use yii\helpers\Html;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\Template */
|
||||
|
||||
$this->title = 'Изменить шаблон: ' . $model->title;
|
||||
$this->title = 'Изменить шаблон: ' . cut_title($model->title);
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Templates', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
|
||||
function cut_title($str)
|
||||
{
|
||||
if(strlen($str) > 35){
|
||||
return mb_substr($str, 0, 25, 'UTF-8') . '...';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
?>
|
||||
<div class="template-update">
|
||||
|
||||
|
@ -11,11 +11,20 @@ use yii\grid\GridView;
|
||||
/* @var $templateFieldDataProvider yii\data\ActiveDataProvider */
|
||||
/* @var $model backend\modules\document\models\Template */
|
||||
|
||||
$this->title = $model->title;
|
||||
$this->title = cut_title($model->title);
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Templates', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
YiiAsset::register($this);
|
||||
|
||||
function cut_title($str)
|
||||
{
|
||||
if(strlen($str) > 35){
|
||||
return mb_substr($str, 0, 35, 'UTF-8') . '...';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="template-view">
|
||||
|
||||
<p>
|
||||
@ -35,34 +44,19 @@ YiiAsset::register($this);
|
||||
|
||||
'attributes' => [
|
||||
'id',
|
||||
[
|
||||
'attribute'=>'title',
|
||||
'format'=>'raw',
|
||||
'value' => function($model){
|
||||
return $model->title . Html::a(
|
||||
'<i class="glyphicon glyphicon-pencil"></i>', ['update', 'id' => $model->id],
|
||||
[
|
||||
'title' => 'Update',
|
||||
'class' => 'pull-right detail-button',
|
||||
]
|
||||
);
|
||||
}
|
||||
],
|
||||
'title',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
[
|
||||
'label'=>'template_file_name',
|
||||
'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',
|
||||
// 'class' => 'pull-right detail-button',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
'label'=>'template_file_name',
|
||||
'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',
|
||||
// 'class' => 'pull-right detail-button',
|
||||
]);
|
||||
}
|
||||
]
|
||||
],
|
||||
]) ?>
|
||||
@ -95,9 +89,13 @@ YiiAsset::register($this);
|
||||
|
||||
[
|
||||
'attribute' => 'field_id',
|
||||
'filter' => DocumentField::find()->select(['title', 'id'])->indexBy('id')->column(),
|
||||
'value' => 'field.title',
|
||||
],
|
||||
[
|
||||
'attribute' => 'field.field_template',
|
||||
'value' => 'field.field_template',
|
||||
],
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}{delete}',
|
||||
|
Reference in New Issue
Block a user