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 { fn status_code(&self) -> StatusCode {
match *self { match *self {
Self::ValidationErrors => StatusCode::BAD_REQUEST,
_ => StatusCode::INTERNAL_SERVER_ERROR, _ => StatusCode::INTERNAL_SERVER_ERROR,
} }
} }

View File

@ -71,7 +71,7 @@ async fn create_or_edit_get<E: ActixAdminViewModelTrait>(session: &Session, req:
false => HttpResponse::InternalServerError(), false => HttpResponse::InternalServerError(),
}; };
let notifications: Vec<ActixAdminNotification> = errors.into_iter() let notifications: Vec<ActixAdminNotification> = errors.into_iter()
.map(|err| ActixAdminNotification::from(err)) .map(ActixAdminNotification::from)
.collect(); .collect();
let params = web::Query::<Params>::from_query(req.query_string()).unwrap(); 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="" ) !="" model.custom_errors | get(key=model_field.field_name, default="" ) !=""
%}is-danger{% else %}is-success{% endif %} %}is-danger{% else %}is-success{% endif %}
{% 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 }}" placeholder="{{ model_field.field_name }}"
aria-label="{{ model_field.field_name }}">{{ model.values | get(key=model_field.field_name, default="") }}</textarea> 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="") != "" %} {% elif model_field.field_type == "FileUpload" and model.values | get(key=model_field.field_name, default="") != "" %}
@ -29,4 +29,4 @@
" type="{{ model_field | get_html_input_type }}" " type="{{ model_field | get_html_input_type }}"
value="{{ model.values | get(key=model_field.field_name, default="") }}" name="{{ model_field.field_name }}" value="{{ model.values | get(key=model_field.field_name, default="") }}" name="{{ model_field.field_name }}"
placeholder="{{ model_field.field_name }}" aria-label="{{ model_field.field_name }}"> placeholder="{{ model_field.field_name }}" aria-label="{{ model_field.field_name }}">
{% endif %} {% endif %}