Actualiza nomenclatura en código
This commit is contained in:
parent
d8b2e3089c
commit
c2b69fa539
9 changed files with 23 additions and 24 deletions
|
|
@ -15,7 +15,7 @@ impl ModuleTrait for Admin {
|
||||||
Some(l("module_description"))
|
Some(l("module_description"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_module(&self, cfg: &mut app::web::ServiceConfig) {
|
fn configure_service(&self, cfg: &mut app::web::ServiceConfig) {
|
||||||
cfg.service(
|
cfg.service(
|
||||||
app::web::scope("/admin")
|
app::web::scope("/admin")
|
||||||
.route("", app::web::get().to(summary::summary))
|
.route("", app::web::get().to(summary::summary))
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ impl ModuleTrait for Node {
|
||||||
Some(l("module_description"))
|
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));
|
cfg.route("/node", app::web::get().to(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ impl ModuleTrait for User {
|
||||||
Some(l("module_description"))
|
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));
|
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 {
|
fn form_login() -> Form {
|
||||||
Form::new()
|
Form::new()
|
||||||
.with_id("user-login")
|
.with_id("user-login")
|
||||||
|
|
@ -47,15 +59,3 @@ fn form_login() -> Form {
|
||||||
)
|
)
|
||||||
.add(form::Button::submit(l("login").as_str()))
|
.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()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::html::{Markup, html};
|
use crate::html::{Markup, html};
|
||||||
use super::{PageAssets, ComponentTrait, render_component};
|
use super::{ComponentTrait, PageAssets};
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ impl PageContainer {
|
||||||
components.sort_by_key(|c| c.read().unwrap().weight());
|
components.sort_by_key(|c| c.read().unwrap().weight());
|
||||||
html! {
|
html! {
|
||||||
@for c in components.iter() {
|
@for c in components.iter() {
|
||||||
(render_component(&mut *c.write().unwrap(), assets))
|
(super::render_component(&mut *c.write().unwrap(), assets))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::html::{Markup, html};
|
use crate::html::{Markup, html};
|
||||||
use crate::util;
|
|
||||||
use crate::api::action::{action_ref, run_actions};
|
use crate::api::action::{action_ref, run_actions};
|
||||||
use super::PageAssets;
|
use crate::util;
|
||||||
use super::{ACTION_BEFORE_RENDER_COMPONENT, ActionBeforeRenderComponent};
|
use super::{ACTION_BEFORE_RENDER_COMPONENT, ActionBeforeRenderComponent};
|
||||||
|
use super::PageAssets;
|
||||||
|
|
||||||
pub use std::any::Any as AnyComponent;
|
pub use std::any::Any as AnyComponent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ fn add_to(list: &mut Vec<&dyn ModuleTrait>, module: &'static dyn ModuleTrait) {
|
||||||
|
|
||||||
pub fn modules(cfg: &mut app::web::ServiceConfig) {
|
pub fn modules(cfg: &mut app::web::ServiceConfig) {
|
||||||
for m in MODULES.read().unwrap().iter() {
|
for m in MODULES.read().unwrap().iter() {
|
||||||
m.configure_module(cfg);
|
m.configure_service(cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ pub trait ModuleTrait: BaseModule + Send + Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[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> {
|
fn actions(&self) -> Vec<ActionItem> {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ impl ModuleTrait for Demopage {
|
||||||
Some(l("module_description"))
|
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));
|
cfg.route("/", app::web::get().to(demo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,10 @@ use crate::config::SETTINGS;
|
||||||
use crate::html::*;
|
use crate::html::*;
|
||||||
use crate::api::action::{action_ref, run_actions};
|
use crate::api::action::{action_ref, run_actions};
|
||||||
use crate::api::component::*;
|
use crate::api::component::*;
|
||||||
|
use super::{ACTION_BEFORE_RENDER_PAGE, ActionBeforeRenderPage};
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use super::{ACTION_BEFORE_RENDER_PAGE, ActionBeforeRenderPage};
|
|
||||||
|
|
||||||
static DEFAULT_LANGUAGE: Lazy<Option<String>> = Lazy::new(|| {
|
static DEFAULT_LANGUAGE: Lazy<Option<String>> = Lazy::new(|| {
|
||||||
let language = SETTINGS.app.language[..2].to_lowercase();
|
let language = SETTINGS.app.language[..2].to_lowercase();
|
||||||
if !language.is_empty() {
|
if !language.is_empty() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue