Commit f87e4ce6 by Qiang Xue

automatically hide model class input if needed.

parent c364e266
......@@ -76,6 +76,11 @@ yii.gii = (function ($) {
initPreviewDiffLinks();
initConfirmationCheckboxes();
// model generator: hide class name input when table name input contains *
$('#model-generator #generator-tablename').on('change', function () {
$('#model-generator .field-generator-modelclass').toggle($(this).val().indexOf('*') == -1);
}).change();
// hide Generate button if any input is changed
$('.default-view .form-group input,select,textarea').change(function () {
$('.default-view-results,.default-view-files').hide();
......
......@@ -35,7 +35,7 @@ class DefaultController extends Controller
public function actionView($id)
{
$generator = $this->loadGenerator($id);
$params = array('generator' => $generator);
$params = array('generator' => $generator, 'id' => $id);
if (isset($_POST['preview']) || isset($_POST['generate'])) {
if ($generator->validate()) {
$generator->saveStickyAttributes();
......
......@@ -28,7 +28,10 @@ foreach ($generator->templates as $name => $path) {
<p><?php echo $generator->getDescription(); ?></p>
<?php $form = ActiveForm::begin(array('fieldConfig' => array('class' => ActiveField::className()))); ?>
<?php $form = ActiveForm::begin(array(
'id' => "$id-generator",
'fieldConfig' => array('class' => ActiveField::className()),
)); ?>
<div class="row">
<div class="col-lg-8">
<?php echo $this->renderFile($generator->formView(), array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment