bug fixing
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use common\models\EventType;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
@@ -8,12 +9,28 @@ use yii\widgets\ActiveForm;
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<style>
|
||||
select.form-control, option{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
function setThemeColor(elem){
|
||||
elem.className = 'form-control event-theme-active-' +elem.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="event-type-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'theme')->dropDownList(\common\models\EventType::themes()) ?>
|
||||
<?= $form->field($model, 'theme')->dropDownList(EventType::themes(),
|
||||
['onchange' => "setThemeColor(this);"]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-type', 'Create') : Yii::t('event-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
@@ -22,3 +39,16 @@ use yii\widgets\ActiveForm;
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
let themeDropDown = document.getElementById("eventtype-theme");
|
||||
let themeOptions = themeDropDown.getElementsByTagName("option");
|
||||
for (let item of themeOptions) {
|
||||
item.classList.add("event-theme-active-"+item.value)
|
||||
}
|
||||
|
||||
setThemeColor(themeDropDown);
|
||||
console.info("selected: "+ themeDropDown.value);
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user