diff --git a/application/ui.htmleditorwidget.class.inc.php b/application/ui.htmleditorwidget.class.inc.php index 8904c5dff..9ba144df0 100644 --- a/application/ui.htmleditorwidget.class.inc.php +++ b/application/ui.htmleditorwidget.class.inc.php @@ -65,7 +65,7 @@ class UIHTMLEditorWidget $sHelpText = $this->m_sHelpText; $sValidationField = $this->m_sValidationField; - $sHtmlValue = "
$sValidationField"; + $sHtmlValue = "
$sValidationField"; // Replace the text area with CKEditor // To change the default settings of the editor, diff --git a/css/backoffice/components/input/_input.scss b/css/backoffice/components/input/_input.scss index 53d43c820..64a6b39f6 100644 --- a/css/backoffice/components/input/_input.scss +++ b/css/backoffice/components/input/_input.scss @@ -49,11 +49,22 @@ $ibo-input--margin-x: 5px !default; color: $ibo-input--placeholder--color; } } -.ibo-input-wrapper.is-error { - .ibo-input{ - background-color: $ibo-input-wrapper--is-error--background-color; +texarea.ibo-input{ + height:unset; +} +.ibo-input-wrapper.is-error, .ibo-input-field-wrapper.is-error { + .ibo-input, .ibo-input-vanilla, .cke, textarea { border: 1px solid $ibo-input-wrapper--is-error--border-color; + background-color: $ibo-input-wrapper--is-error--background-color; } + .ibo-input-vanilla input{ + border: 0; + background-color: #11ffee00; + } +} +input.ibo-input-vanilla{ + width: unset; + display:initial; } .ibo-input-wrapper--with-buttons{ position: relative; diff --git a/sources/Renderer/Console/FieldRenderer/ConsoleSelectObjectFieldRenderer.php b/sources/Renderer/Console/FieldRenderer/ConsoleSelectObjectFieldRenderer.php index fd5b55a54..fbc107e82 100644 --- a/sources/Renderer/Console/FieldRenderer/ConsoleSelectObjectFieldRenderer.php +++ b/sources/Renderer/Console/FieldRenderer/ConsoleSelectObjectFieldRenderer.php @@ -153,6 +153,7 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer $sSelected = ($value == $iObject) ? 'checked' : ''; } $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_$sId", $iObject, "{$sId}_{$iObject}", "radio"); + $oRadioCustom->AddCSSClass('ibo-input-field-wrapper'); $oRadioCustom->GetInput()->SetIsChecked($sSelected); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); @@ -193,6 +194,7 @@ EOF // Drop-down select // $oBlock->AddDataAttribute("input-type","Combodo\\iTop\\Form\\Field\\SelectObjectField\\Select"); + $oBlock->AddCSSClass('ibo-input-field-wrapper'); $sEditType = 'select'; $oSelect = SelectUIBlockFactory::MakeForSelect("",$this->oField->GetGlobalId()); $oBlock->AddSubBlock($oSelect); @@ -217,7 +219,8 @@ EOF value: me.val() }) .closest('.form_handler').trigger('value_change'); - } + }, + inputClass: 'ibo-input-vanilla ibo-input', }); JS ); @@ -250,12 +253,15 @@ JS if (oResult.is_valid) { oValidationElement.html(''); + $(me.element).find('.ibo-input-field-wrapper').removeClass("is-error"); } else { + //TODO: escape html entities var sExplain = oResult.error_messages.join(', '); oValidationElement.html(sExplain); - oValidationElement.addClass('ibo-field-validation'); + oValidationElement.addClass(' ibo-field-validation'); + $(me.element).find('.ibo-input-field-wrapper').addClass("is-error"); } } } diff --git a/sources/Renderer/Console/FieldRenderer/ConsoleSimpleFieldRenderer.php b/sources/Renderer/Console/FieldRenderer/ConsoleSimpleFieldRenderer.php index 1e78503c7..96a409eb4 100644 --- a/sources/Renderer/Console/FieldRenderer/ConsoleSimpleFieldRenderer.php +++ b/sources/Renderer/Console/FieldRenderer/ConsoleSimpleFieldRenderer.php @@ -91,7 +91,7 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer break; case 'Combodo\\iTop\\Form\\Field\\StringField': - $oValue = UIContentBlockUIBlockFactory::MakeStandard("",[""]); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["ibo-input-field-wrapper"]); if ($this->oField->GetReadOnly()) { @@ -107,11 +107,12 @@ class ConsoleSimpleFieldRenderer extends FieldRenderer break; case 'Combodo\\iTop\\Form\\Field\\TextAreaField': - $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content", "ibo-input-field-wrapper"]); $bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML); $oText = new TextArea("",$this->oField->GetCurrentValue(),$this->oField->GetGlobalId(),40,8); + $oText->AddCSSClass('ibo-input-field-wrapper ibo-input'); $oValue->AddSubBlock($oText); if ($this->oField->GetReadOnly()) { @@ -147,7 +148,7 @@ EOF break; case 'Combodo\\iTop\\Form\\Field\\SelectField': - $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content","ibo-input-field-wrapper"]); if ($this->oField->GetReadOnly()) { $aChoices = $this->oField->GetChoices(); @@ -158,6 +159,7 @@ EOF else { $oSelect = SelectUIBlockFactory::MakeForSelect("",$this->oField->GetGlobalId()); + $oSelect->AddCSSClass('ibo-input-field-wrapper'); if ($this->oField->GetMultipleValuesEnabled()) { $oSelect->SetIsMultiple(true); } @@ -198,7 +200,7 @@ EOF } else { $sSelected = ($value == $sChoice) ? 'checked' : ''; } - $oRadio = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_".$sId, $sChoice, "{$sId}_{$idx}", "radio");; + $oRadio = InputUIBlockFactory::MakeForInputWithLabel($sLabel, "radio_".$sId, $sChoice, "{$sId}_{$idx}", "radio"); $oRadio->GetInput()->SetIsChecked($sSelected); $oRadio->SetBeforeInput(false); $oRadio->GetInput()->AddCSSClass('ibo-input-checkbox'); @@ -222,7 +224,7 @@ EOF break; case 'Combodo\\iTop\\Form\\Field\\DurationField': - $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content"]); + $oValue = UIContentBlockUIBlockFactory::MakeStandard("",["form-field-content","ibo-input-field-wrapper"]); $value = $this->oField->GetCurrentValue(); if ($this->oField->GetReadOnly()) { @@ -233,10 +235,10 @@ EOF $sId = $this->oField->GetGlobalId(); $aVal = AttributeDuration::SplitDuration($value); - $sDays = ""; - $sHours = ""; - $sMinutes = ""; - $sSeconds = ""; + $sDays = ""; + $sHours = ""; + $sMinutes = ""; + $sSeconds = ""; $oTime = UIContentBlockUIBlockFactory::MakeStandard("",["pt-2"]); $oTime->AddSubBlock(new Html(Dict::Format('UI:DurationForm_Days_Hours_Minutes_Seconds', $sDays, $sHours, $sMinutes, $sSeconds))); $oValue->AddSubBlock($oTime); @@ -361,7 +363,6 @@ EOF sortField: 'text', onChange: function(value){ var me = this.\$input; - me.closest(".field_set").trigger("field_change", { id: me.attr("id"), name: me.closest(".form_field").attr("data-field-id"), @@ -411,12 +412,14 @@ EOF if (oResult.is_valid) { oValidationElement.html(''); + $(me.element).find('.ibo-input-field-wrapper').removeClass("is-error"); } else { var sExplain = oResult.error_messages.join(', '); oValidationElement.html(sExplain); oValidationElement.addClass('ibo-field-validation'); + $(me.element).find('.ibo-input-field-wrapper').addClass("is-error"); } } }