Blame view

backend/views/question/_form.php 1.39 KB
8bc87953   Anastasia   - questions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  <?php
      
      use artbox\core\admin\assets\Switchery;
      use yii\helpers\Html;
      use yii\web\View;
      use yii\widgets\ActiveForm;
      
      /* @var $this yii\web\View */
      /* @var $model \common\models\Question */
      /* @var $form yii\widgets\ActiveForm */
      Switchery::register($this);
      $js = <<< JS
  $('.switchery').each(function(idx, elem) {
    new Switchery(elem, {
      color:'#46b749',
      secondaryColor:'#e2e2e2'
    });
  });
  JS;
      
      
      $this->registerJs($js, View::POS_READY);
  ?>
  
  <div class="feedback-form">
      
      <?php $form = ActiveForm::begin(); ?>
      
      <?= $form->field($model, 'name')
               ->textInput([ 'maxlength' => true ]) ?>
      
      <?= $form->field($model, 'email')
               ->textInput([ 'maxlength' => true ]) ?>
      
      <?= $form->field($model, 'question')
               ->textarea([ 'rows' => 6 ]) ?>
    
      <?= $form->field($model, 'answer')
               ->textarea([ 'rows' => 6 ]) ?>
    
      <?= $form->field($model, 'status')
               ->checkbox(
                   [
                       'class' => 'switchery',
                   ]
               ) ?>
      
      <div class="form-group">
          <?= Html::submitButton(
              $model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'),
              [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
          ) ?>
      </div>
      
      <?php ActiveForm::end(); ?>
  
  </div>