add correct backlink
This commit is contained in:
parent
76809ddc46
commit
5194febe9b
@ -23,6 +23,7 @@ pub async fn create_get<T: ActixAdminAppDataTrait, E: ActixAdminViewModelTrait>(
|
|||||||
ctx.insert("entity_names", &entity_names);
|
ctx.insert("entity_names", &entity_names);
|
||||||
ctx.insert("view_model", &view_model);
|
ctx.insert("view_model", &view_model);
|
||||||
ctx.insert("select_lists", &E::get_select_lists(_db).await);
|
ctx.insert("select_lists", &E::get_select_lists(_db).await);
|
||||||
|
ctx.insert("list_link", E::get_list_link());
|
||||||
|
|
||||||
let body = TERA
|
let body = TERA
|
||||||
.render("create.html", &ctx)
|
.render("create.html", &ctx)
|
||||||
|
@ -27,6 +27,7 @@ pub async fn edit_get<T: ActixAdminAppDataTrait, E: ActixAdminViewModelTrait>(
|
|||||||
ctx.insert("view_model", &view_model);
|
ctx.insert("view_model", &view_model);
|
||||||
ctx.insert("model", &model);
|
ctx.insert("model", &model);
|
||||||
ctx.insert("select_lists", &E::get_select_lists(db).await);
|
ctx.insert("select_lists", &E::get_select_lists(db).await);
|
||||||
|
ctx.insert("list_link", E::get_list_link());
|
||||||
|
|
||||||
let body = TERA
|
let body = TERA
|
||||||
.render("edit.html", &ctx)
|
.render("edit.html", &ctx)
|
||||||
|
@ -20,6 +20,10 @@ pub trait ActixAdminViewModelTrait {
|
|||||||
async fn get_select_lists(db: &DatabaseConnection) -> HashMap<String, Vec<(String, String)>>;
|
async fn get_select_lists(db: &DatabaseConnection) -> HashMap<String, Vec<(String, String)>>;
|
||||||
|
|
||||||
fn get_entity_name() -> String;
|
fn get_entity_name() -> String;
|
||||||
|
|
||||||
|
fn get_list_link() -> &'static str {
|
||||||
|
"list"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="grid">
|
<div>
|
||||||
{% for model_field in view_model.fields -%}
|
{% for model_field in view_model.fields -%}
|
||||||
{% if model_field.select_list != "" %}
|
{% if model_field.select_list != "" %}
|
||||||
<select name="{{ model_field.field_name }}">
|
<select name="{{ model_field.field_name }}">
|
||||||
@ -16,7 +16,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
<button type="submit">Save</button>
|
<button type="submit">Save</button>
|
||||||
<button onclick="history.back()">Cancel</button>
|
<a href="{{ list_link }}" role="button">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="grid">
|
<div>
|
||||||
{% for model_field in view_model.fields -%}
|
{% for model_field in view_model.fields -%}
|
||||||
{% if model_field.select_list != "" %}
|
{% if model_field.select_list != "" %}
|
||||||
<select name="{{ model_field.field_name }}">
|
<select name="{{ model_field.field_name }}">
|
||||||
@ -16,7 +16,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
<button type="submit">Save</button>
|
<button type="submit">Save</button>
|
||||||
<button onclick="history.back()">Cancel</button>
|
<a href="{{ list_link }}" role="button">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
Loading…
Reference in New Issue
Block a user