diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index c2ee128c..dc55d91e 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -884,7 +884,7 @@ EOD; } $stateNoClass = 'fa-flip-horizontal text-gray'; $formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $yes ? '' : $stateNoClass]); - $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]); + $formEditElement = $this->getReplacedStub('html/' . $inputType . '-edit', ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]); } elseif ($inputType == 'citypicker') { $attrArr['class'] = implode(' ', $cssClassArr); $attrArr['data-toggle'] = "city-picker"; diff --git a/application/admin/command/Crud/stubs/html/switch-edit.stub b/application/admin/command/Crud/stubs/html/switch-edit.stub new file mode 100644 index 00000000..8e109181 --- /dev/null +++ b/application/admin/command/Crud/stubs/html/switch-edit.stub @@ -0,0 +1,9 @@ + + + + {if in_array($row.{%field%}, ['{%fieldYes%}', '{%fieldNo%}'])} + + {else/} + + {/if} +