You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 satır
5.1KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\gii\CodeFile;
  4. /* @var $this \yii\web\View */
  5. /* @var $generator \yii\gii\Generator */
  6. /* @var $files CodeFile[] */
  7. /* @var $answers array */
  8. /* @var $id string panel ID */
  9. ?>
  10. <div class="default-view-files">
  11. <div id="action-toggle" class="btn-group btn-group-xs pull-right">
  12. <label class="btn btn-success active" title="Filter files that are created">
  13. <input type="checkbox" value="<?= CodeFile::OP_CREATE ?>" checked> Create
  14. </label>
  15. <label class="btn btn-default active" title="Filter files that are unchanged.">
  16. <input type="checkbox" value="<?= CodeFile::OP_SKIP ?>" checked> Unchanged
  17. </label>
  18. <label class="btn btn-warning active" title="Filter files that are overwritten">
  19. <input type="checkbox" value="<?= CodeFile::OP_OVERWRITE ?>" checked> Overwrite
  20. </label>
  21. </div>
  22. <p>Click on the above <code>Generate</code> button to generate the files selected below:</p>
  23. <table class="table table-bordered table-striped table-condensed">
  24. <thead>
  25. <tr>
  26. <th class="file">Code File</th>
  27. <th class="action">Action</th>
  28. <?php
  29. $fileChangeExists = false;
  30. foreach ($files as $file) {
  31. if ($file->operation !== CodeFile::OP_SKIP) {
  32. $fileChangeExists = true;
  33. echo '<th><input type="checkbox" id="check-all"></th>';
  34. break;
  35. }
  36. }
  37. ?>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. <?php foreach ($files as $file): ?>
  42. <?php
  43. if ($file->operation === CodeFile::OP_OVERWRITE) {
  44. $trClass = 'warning';
  45. } elseif ($file->operation === CodeFile::OP_SKIP) {
  46. $trClass = 'active';
  47. } elseif ($file->operation === CodeFile::OP_CREATE) {
  48. $trClass = 'success';
  49. } else {
  50. $trClass = '';
  51. }
  52. ?>
  53. <tr class="<?= "$file->operation $trClass" ?>">
  54. <td class="file">
  55. <?= Html::a(Html::encode($file->getRelativePath()), ['preview', 'id' => $id, 'file' => $file->id], ['class' => 'preview-code', 'data-title' => $file->getRelativePath()]) ?>
  56. <?php if ($file->operation === CodeFile::OP_OVERWRITE): ?>
  57. <?= Html::a('diff', ['diff', 'id' => $id, 'file' => $file->id], ['class' => 'diff-code label label-warning', 'data-title' => $file->getRelativePath()]) ?>
  58. <?php endif; ?>
  59. </td>
  60. <td class="action">
  61. <?php
  62. if ($file->operation === CodeFile::OP_SKIP) {
  63. echo 'unchanged';
  64. } else {
  65. echo $file->operation;
  66. }
  67. ?>
  68. </td>
  69. <?php if ($fileChangeExists): ?>
  70. <td class="check">
  71. <?php
  72. if ($file->operation === CodeFile::OP_SKIP) {
  73. echo '&nbsp;';
  74. } else {
  75. echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : ($file->operation === CodeFile::OP_CREATE));
  76. }
  77. ?>
  78. </td>
  79. <?php endif; ?>
  80. </tr>
  81. <?php endforeach; ?>
  82. </tbody>
  83. </table>
  84. <div class="modal fade" id="preview-modal" tabindex="-1" role="dialog">
  85. <div class="modal-dialog">
  86. <div class="modal-content">
  87. <div class="modal-header">
  88. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  89. <div class="btn-group pull-left">
  90. <a class="modal-previous btn btn-xs btn-default" href="#" title="Previous File (Left Arrow)"><span class="glyphicon glyphicon-arrow-left"></span></a>
  91. <a class="modal-next btn btn-xs btn-default" href="#" title="Next File (Right Arrow)"><span class="glyphicon glyphicon-arrow-right"></span></a>
  92. <a class="modal-refresh btn btn-xs btn-default" href="#" title="Refresh File (R)"><span class="glyphicon glyphicon-refresh"></span></a>
  93. <a class="modal-checkbox btn btn-xs btn-default" href="#" title="Check This File (Space)"><span class="glyphicon"></span></a>
  94. &nbsp;
  95. </div>
  96. <strong class="modal-title pull-left">Modal title</strong>
  97. <span class="modal-copy-hint pull-right"><kbd>CTRL</kbd>+<kbd>C</kbd> to copy</span>
  98. <div id="clipboard-container"><textarea id="clipboard"></textarea></div>
  99. <div class="clearfix"></div>
  100. </div>
  101. <div class="modal-body">
  102. <p>Please wait ...</p>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>