Actualiza textos y formato del código
This commit is contained in:
parent
5e8a1f75fd
commit
3366a6acdc
9 changed files with 17 additions and 20 deletions
|
|
@ -30,11 +30,7 @@ impl ActionsHolder {
|
|||
actions.sort_by_key(|a| a.weight());
|
||||
}
|
||||
|
||||
pub fn iter_map<B, F>(&self, f: F)
|
||||
where
|
||||
Self: Sized,
|
||||
F: FnMut(&ActionItem) -> B,
|
||||
{
|
||||
pub fn iter_map<B, F>(&self, f: F) where Self: Sized, F: FnMut(&ActionItem) -> B {
|
||||
let _: Vec<_> = self.0.read().unwrap().iter().map(f).collect();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{Lazy, base, concat_string};
|
||||
use crate::{Lazy, base, concat_string, util};
|
||||
use crate::config::SETTINGS;
|
||||
use crate::html::{Markup, PreEscaped, html};
|
||||
use crate::api::theme::*;
|
||||
|
|
@ -281,11 +281,14 @@ impl Assets {
|
|||
|
||||
// Assets EXTRAS.
|
||||
|
||||
pub fn serial_id(&mut self, prefix: &str, id: &Option<String>) -> String {
|
||||
pub fn required_id<T>(&mut self, id: &Option<String>) -> String {
|
||||
match id {
|
||||
Some(id) => id.to_string(),
|
||||
None => {
|
||||
let prefix = prefix.trim().replace(" ", "_").to_lowercase();
|
||||
let prefix = util::single_type_name::<T>()
|
||||
.trim()
|
||||
.replace(" ", "_")
|
||||
.to_lowercase();
|
||||
let prefix = if prefix.is_empty() {
|
||||
"prefix".to_owned()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::util;
|
||||
use crate::html::{Markup, html};
|
||||
use crate::api::action::{action_ref, run_actions};
|
||||
use crate::util;
|
||||
use super::{BEFORE_RENDER_COMPONENT_ACTION, BeforeRenderComponentAction};
|
||||
use super::Assets;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pub mod action; // API to define functions that alter the behavior of PageTop core.
|
||||
pub mod component; // API para crear nuevos componentes.
|
||||
pub mod module; // API para añadir módulos con nuevas funcionalidades.
|
||||
pub mod theme; // API para crear temas.
|
||||
pub mod component; // API to build new components.
|
||||
pub mod module; // API to add new features with modules.
|
||||
pub mod theme; // API to create themes.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use crate::app;
|
||||
use crate::{app, util};
|
||||
use crate::api::action::ActionItem;
|
||||
use crate::util;
|
||||
|
||||
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
|
||||
use crate::db::MigrationItem;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use crate::{app, concat_string};
|
||||
use crate::{app, concat_string, util};
|
||||
use crate::config::SETTINGS;
|
||||
use crate::html::{Markup, html};
|
||||
use crate::api::component::{Assets, ComponentTrait, Favicon};
|
||||
use crate::response::page::Page;
|
||||
use crate::base::component::Chunck;
|
||||
use crate::util;
|
||||
|
||||
/// Los temas deben implementar este "trait".
|
||||
pub trait ThemeTrait: Send + Sync {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl ComponentTrait for Block {
|
|||
}
|
||||
|
||||
fn default_render(&self, assets: &mut Assets) -> Markup {
|
||||
let id = assets.serial_id("block", self.id());
|
||||
let id = assets.required_id::<Block>(self.id());
|
||||
html! {
|
||||
div id=(id) class=[self.classes()] {
|
||||
@match self.title() {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ impl ComponentTrait for Menu {
|
|||
))
|
||||
.add_jquery();
|
||||
|
||||
let id = assets.serial_id("menu", self.id());
|
||||
let id = assets.required_id::<Menu>(self.id());
|
||||
html! {
|
||||
ul id=(id) class=[self.classes()] {
|
||||
(self.items().render(assets))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// External.
|
||||
// External re-exports.
|
||||
|
||||
pub use once_cell::sync::Lazy;
|
||||
pub use concat_string::concat_string;
|
||||
|
|
@ -25,6 +25,6 @@ pub mod app; // Aplicación y servidor web.
|
|||
pub mod base; // Base de componentes, módulos y temas.
|
||||
pub mod util; // Macros y funciones útiles.
|
||||
|
||||
// Re-exports.
|
||||
// Internal re-exports.
|
||||
|
||||
pub mod prelude;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue