Blame view

vendor/yiisoft/yii2-gii/views/default/view/files.php 4.87 KB
abf1649b   andryeyev   Чистая установка ...
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  <?php
  
  use yii\helpers\Html;
  use yii\gii\CodeFile;
  
  /* @var $this \yii\web\View */
  /* @var $generator \yii\gii\Generator */
  /* @var $files CodeFile[] */
  /* @var $answers array */
  /* @var $id string panel ID */
  
  ?>
  <div class="default-view-files">
      <div id="action-toggle" class="btn-group btn-group-xs pull-right">
          <label class="btn btn-success active" title="Filter files that are created">
              <input type="checkbox" value="<?= CodeFile::OP_CREATE ?>" checked> Create
          </label>
          <label class="btn btn-default active" title="Filter files that are unchanged.">
              <input type="checkbox" value="<?= CodeFile::OP_SKIP ?>" checked> Unchanged
          </label>
          <label class="btn btn-warning active" title="Filter files that are overwritten">
              <input type="checkbox" value="<?= CodeFile::OP_OVERWRITE ?>" checked> Overwrite
          </label>
      </div>
  
      <p>Click on the above <code>Generate</code> button to generate the files selected below:</p>
  
      <table class="table table-bordered table-striped table-condensed">
          <thead>
              <tr>
                  <th class="file">Code File</th>
                  <th class="action">Action</th>
                  <?php
                  $fileChangeExists = false;
                  foreach ($files as $file) {
                      if ($file->operation !== CodeFile::OP_SKIP) {
                          $fileChangeExists = true;
                          echo '<th><input type="checkbox" id="check-all"></th>';
                          break;
                      }
                  }
                  ?>
  
              </tr>
          </thead>
          <tbody>
              <?php foreach ($files as $file): ?>
              <?php
              if ($file->operation === CodeFile::OP_OVERWRITE) {
                  $trClass = 'warning';
              } elseif ($file->operation === CodeFile::OP_SKIP) {
                  $trClass = 'active';
              } elseif ($file->operation === CodeFile::OP_CREATE) {
                  $trClass = 'success';
              } else {
                  $trClass = '';
              }
              ?>
              <tr class="<?= "$file->operation $trClass" ?>">
                  <td class="file">
                      <?= Html::a(Html::encode($file->getRelativePath()), ['preview', 'id' => $id, 'file' => $file->id], ['class' => 'preview-code', 'data-title' => $file->getRelativePath()]) ?>
                      <?php if ($file->operation === CodeFile::OP_OVERWRITE): ?>
                          <?= Html::a('diff', ['diff', 'id' => $id, 'file' => $file->id], ['class' => 'diff-code label label-warning', 'data-title' => $file->getRelativePath()]) ?>
                      <?php endif; ?>
                  </td>
                  <td class="action">
                      <?php
                      if ($file->operation === CodeFile::OP_SKIP) {
                          echo 'unchanged';
                      } else {
                          echo $file->operation;
                      }
                      ?>
                  </td>
                  <?php if ($fileChangeExists): ?>
                  <td class="check">
                      <?php
                      if ($file->operation === CodeFile::OP_SKIP) {
                          echo '&nbsp;';
                      } else {
                          echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : ($file->operation === CodeFile::OP_CREATE));
                      }
                      ?>
                  </td>
                  <?php endif; ?>
              </tr>
              <?php endforeach; ?>
          </tbody>
      </table>
  
      <div class="modal fade" id="preview-modal" tabindex="-1" role="dialog">
          <div class="modal-dialog">
              <div class="modal-content">
                  <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                      <div class="btn-group pull-left">
                          <a class="modal-previous btn btn-xs btn-default" href="#" title="Previous File (Left Arrow)"><span class="glyphicon glyphicon-arrow-left"></span></a>
                          <a class="modal-next btn btn-xs btn-default" href="#" title="Next File (Right Arrow)"><span class="glyphicon glyphicon-arrow-right"></span></a>
                          <a class="modal-refresh btn btn-xs btn-default" href="#" title="Refresh File (R)"><span class="glyphicon glyphicon-refresh"></span></a>
                          <a class="modal-checkbox btn btn-xs btn-default" href="#" title="Check This File (Space)"><span class="glyphicon"></span></a>
                          &nbsp;
                      </div>
                      <strong class="modal-title pull-left">Modal title</strong>
                      <div class="clearfix"></div>
                  </div>
                  <div class="modal-body">
                      <p>Please wait ...</p>
                  </div>
              </div>
          </div>
      </div>
  </div>