trim html

This commit is contained in:
Adrian Woźniak 2023-07-31 13:16:30 +02:00
parent f79b952f8a
commit 69f294ecf4
3 changed files with 4 additions and 3 deletions

View File

@ -126,6 +126,7 @@ impl error::ResponseError for ActixAdminError {
fn status_code(&self) -> StatusCode {
match *self {
Self::ValidationErrors => StatusCode::BAD_REQUEST,
_ => StatusCode::INTERNAL_SERVER_ERROR,
}
}

View File

@ -71,7 +71,7 @@ async fn create_or_edit_get<E: ActixAdminViewModelTrait>(session: &Session, req:
false => HttpResponse::InternalServerError(),
};
let notifications: Vec<ActixAdminNotification> = errors.into_iter()
.map(|err| ActixAdminNotification::from(err))
.map(ActixAdminNotification::from)
.collect();
let params = web::Query::<Params>::from_query(req.query_string()).unwrap();

View File

@ -7,7 +7,7 @@
model.custom_errors | get(key=model_field.field_name, default="" ) !=""
%}is-danger{% else %}is-success{% endif %}
{% endif %}
" type="{{ model_field | get_html_input_type }}" name="{{ model_field.field_name }}"
" type="{{ model_field | get_html_input_type }}" name="{{ model_field.field_name | trim }}"
placeholder="{{ model_field.field_name }}"
aria-label="{{ model_field.field_name }}">{{ model.values | get(key=model_field.field_name, default="") }}</textarea>
{% elif model_field.field_type == "FileUpload" and model.values | get(key=model_field.field_name, default="") != "" %}