Actualiza nomenclatura en código

This commit is contained in:
Manuel Cillero 2022-05-05 23:23:47 +02:00
parent d8b2e3089c
commit c2b69fa539
9 changed files with 23 additions and 24 deletions

View file

@ -15,7 +15,7 @@ impl ModuleTrait for Admin {
Some(l("module_description"))
}
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
cfg.service(
app::web::scope("/admin")
.route("", app::web::get().to(summary::summary))

View file

@ -16,7 +16,7 @@ impl ModuleTrait for Node {
Some(l("module_description"))
}
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
cfg.route("/node", app::web::get().to(node));
}

View file

@ -15,7 +15,7 @@ impl ModuleTrait for User {
Some(l("module_description"))
}
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
cfg.route("/user/login", app::web::get().to(login));
}
@ -29,6 +29,18 @@ impl ModuleTrait for User {
}
}
async fn login() -> app::Result<Markup> {
Page::new()
.with_title(
"Identificación del usuario"
)
.add_to("content", Container::new()
.with_id("welcome")
.add(form_login())
)
.render()
}
fn form_login() -> Form {
Form::new()
.with_id("user-login")
@ -47,15 +59,3 @@ fn form_login() -> Form {
)
.add(form::Button::submit(l("login").as_str()))
}
async fn login() -> app::Result<Markup> {
Page::new()
.with_title(
"Identificación del usuario"
)
.add_to("content", Container::new()
.with_id("welcome")
.add(form_login())
)
.render()
}

View file

@ -1,5 +1,5 @@
use crate::html::{Markup, html};
use super::{PageAssets, ComponentTrait, render_component};
use super::{ComponentTrait, PageAssets};
use std::sync::{Arc, RwLock};
@ -26,7 +26,7 @@ impl PageContainer {
components.sort_by_key(|c| c.read().unwrap().weight());
html! {
@for c in components.iter() {
(render_component(&mut *c.write().unwrap(), assets))
(super::render_component(&mut *c.write().unwrap(), assets))
}
}
}

View file

@ -1,8 +1,8 @@
use crate::html::{Markup, html};
use crate::util;
use crate::api::action::{action_ref, run_actions};
use super::PageAssets;
use crate::util;
use super::{ACTION_BEFORE_RENDER_COMPONENT, ActionBeforeRenderComponent};
use super::PageAssets;
pub use std::any::Any as AnyComponent;

View file

@ -34,7 +34,7 @@ fn add_to(list: &mut Vec<&dyn ModuleTrait>, module: &'static dyn ModuleTrait) {
pub fn modules(cfg: &mut app::web::ServiceConfig) {
for m in MODULES.read().unwrap().iter() {
m.configure_module(cfg);
m.configure_service(cfg);
}
}

View file

@ -23,7 +23,7 @@ pub trait ModuleTrait: BaseModule + Send + Sync {
}
#[allow(unused_variables)]
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
}
fn actions(&self) -> Vec<ActionItem> {

View file

@ -13,7 +13,7 @@ impl ModuleTrait for Demopage {
Some(l("module_description"))
}
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
cfg.route("/", app::web::get().to(demo));
}
}

View file

@ -3,11 +3,10 @@ use crate::config::SETTINGS;
use crate::html::*;
use crate::api::action::{action_ref, run_actions};
use crate::api::component::*;
use super::{ACTION_BEFORE_RENDER_PAGE, ActionBeforeRenderPage};
use std::collections::HashMap;
use super::{ACTION_BEFORE_RENDER_PAGE, ActionBeforeRenderPage};
static DEFAULT_LANGUAGE: Lazy<Option<String>> = Lazy::new(|| {
let language = SETTINGS.app.language[..2].to_lowercase();
if !language.is_empty() {