mv edit sitekey into advance edit sitekey

This commit is contained in:
realaravinth
2021-12-18 18:18:08 +05:30
parent ff3f5504dd
commit 784aa26dbb
3 changed files with 9 additions and 7 deletions

View File

@@ -37,17 +37,17 @@ struct Level {
} }
#[derive(TemplateOnce, Clone)] #[derive(TemplateOnce, Clone)]
#[template(path = "panel/sitekey/edit/index.html")] #[template(path = "panel/sitekey/edit/advance.html")]
struct IndexPage { struct AdvanceEditPage {
duration: u32, duration: u32,
name: String, name: String,
key: String, key: String,
levels: Vec<Level>, levels: Vec<Level>,
} }
impl IndexPage { impl AdvanceEditPage {
fn new(config: McaptchaConfig, levels: Vec<Level>, key: String) -> Self { fn new(config: McaptchaConfig, levels: Vec<Level>, key: String) -> Self {
IndexPage { AdvanceEditPage {
duration: config.duration as u32, duration: config.duration as u32,
name: config.name, name: config.name,
levels, levels,
@@ -61,7 +61,7 @@ impl IndexPage {
path = "crate::PAGES.panel.sitekey.edit_advance", path = "crate::PAGES.panel.sitekey.edit_advance",
wrap = "crate::CheckLogin" wrap = "crate::CheckLogin"
)] )]
pub async fn edit_sitekey( pub async fn advance(
path: web::Path<String>, path: web::Path<String>,
data: AppData, data: AppData,
id: Identity, id: Identity,
@@ -92,7 +92,9 @@ pub async fn edit_sitekey(
.fetch_all(&data.db) .fetch_all(&data.db)
.await?; .await?;
let body = IndexPage::new(config, levels, key).render_once().unwrap(); let body = AdvanceEditPage::new(config, levels, key)
.render_once()
.unwrap();
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
.content_type("text/html; charset=utf-8") .content_type("text/html; charset=utf-8")
.body(body)) .body(body))

View File

@@ -72,7 +72,7 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
cfg.service(add::easy); cfg.service(add::easy);
cfg.service(list::list_sitekeys); cfg.service(list::list_sitekeys);
cfg.service(view::view_sitekey); cfg.service(view::view_sitekey);
cfg.service(edit::edit_sitekey); cfg.service(edit::advance);
cfg.service(delete::delete_sitekey); cfg.service(delete::delete_sitekey);
} }