files.php 2.1 KB
Newer Older
Qiang Xue committed
1 2 3 4 5 6
<?php

use yii\helpers\Html;
use yii\gii\CodeFile;

/**
slavcodev committed
7 8
 * @var \yii\web\View $this
 * @var \yii\gii\Generator $generator
Qiang Xue committed
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
 * @var CodeFile[] $files
 * @var array $answers
 */
?>
<div class="default-view-files">
	<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>
				<th>
					<?php
					foreach ($files as $file) {
						if ($file->operation !== CodeFile::OP_SKIP) {
							echo '<input type="checkbox" id="check-all">';
							break;
						}
					}
					?>
				</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($files as $file): ?>
Alexander Makarov committed
35
			<tr class="<?= $file->operation ?>">
Qiang Xue committed
36
				<td class="file">
Alexander Makarov committed
37
					<?= Html::a(Html::encode($file->getRelativePath()), ['preview', 'file' => $file->id], ['class' => 'preview-code', 'data-title' => $file->getRelativePath()]) ?>
Qiang Xue committed
38
					<?php if ($file->operation === CodeFile::OP_OVERWRITE): ?>
Alexander Makarov committed
39
						<?= Html::a('diff', ['diff', 'file' => $file->id], ['class' => 'diff-code label label-warning', 'data-title' => $file->getRelativePath()]) ?>
Qiang Xue committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
					<?php endif; ?>
				</td>
				<td class="action">
					<?php
					if ($file->operation === CodeFile::OP_SKIP) {
						echo 'unchanged';
					} else {
						echo $file->operation;
					}
					?>
				</td>
				<td class="check">
					<?php
					if ($file->operation === CodeFile::OP_SKIP) {
						echo '&nbsp;';
					} else {
56
						echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : ($file->operation === CodeFile::OP_CREATE));
Qiang Xue committed
57 58 59 60 61 62 63 64
					}
					?>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>

65
	<div class="modal fade" id="preview-modal" tabindex="-1" role="dialog">
Qiang Xue committed
66 67 68 69 70 71 72 73 74 75 76 77 78
		<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>
					<h4 class="modal-title">Modal title</h4>
				</div>
				<div class="modal-body">
					<p>Please wait ...</p>
				</div>
			</div>
		</div>
	</div>
</div>