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
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
3 changed files with 9 additions and 7 deletions

View file

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

View file

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