🚚 Rename main macros
This commit is contained in:
parent
54d216437a
commit
5f366d3617
6 changed files with 14 additions and 14 deletions
|
|
@ -2,7 +2,7 @@ use crate::prelude::*;
|
||||||
|
|
||||||
new_handle!(THEME_INCEPTION);
|
new_handle!(THEME_INCEPTION);
|
||||||
|
|
||||||
static_files!(base);
|
new_static_files!(base);
|
||||||
|
|
||||||
pub struct Inception;
|
pub struct Inception;
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ impl ModuleTrait for Inception {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||||
static_files_service!(scfg, "/base", base);
|
service_for_static_files!(scfg, "/base", base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ pub use migration::prelude::*;
|
||||||
pub type MigrationItem = Box<dyn MigrationTrait>;
|
pub type MigrationItem = Box<dyn MigrationTrait>;
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! pub_migration {
|
macro_rules! new_migration {
|
||||||
( $migration:ident ) => {
|
( $migration:ident ) => {
|
||||||
pub struct $migration;
|
pub struct $migration;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ pub type Handle = u64;
|
||||||
pub type Weight = i8;
|
pub type Weight = i8;
|
||||||
pub type HashMapResources = std::collections::HashMap<&'static str, StaticResource>;
|
pub type HashMapResources = std::collections::HashMap<&'static str, StaticResource>;
|
||||||
|
|
||||||
static_locales!(LOCALES_PAGETOP);
|
new_static_locales!(LOCALES_PAGETOP);
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// PUBLIC API.
|
// PUBLIC API.
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,13 @@
|
||||||
//! # Cómo aplicar la localización en tu código
|
//! # Cómo aplicar la localización en tu código
|
||||||
//!
|
//!
|
||||||
//! Una vez hayas creado tu directorio de recursos FTL usa la macro
|
//! Una vez hayas creado tu directorio de recursos FTL usa la macro
|
||||||
//! [`static_locales!`](crate::static_locales) para integrarlos en tu módulo o aplicación. Si tus
|
//! [`new_static_locales!`](crate::new_static_locales) para integrarlos en tu módulo o aplicación.
|
||||||
//! recursos se encuentran en el directorio `"src/locale"` bastará con declarar:
|
//! si tus recursos se encuentran en el directorio `"src/locale"` bastará con declarar:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! use pagetop::prelude::*;
|
//! use pagetop::prelude::*;
|
||||||
//!
|
//!
|
||||||
//! static_locales!(LOCALES_SAMPLE);
|
//! new_static_locales!(LOCALES_SAMPLE);
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Y si están en otro directorio, entonces puedes usar:
|
//! Y si están en otro directorio, entonces puedes usar:
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! use pagetop::prelude::*;
|
//! use pagetop::prelude::*;
|
||||||
//!
|
//!
|
||||||
//! static_locales!(LOCALES_SAMPLE in "path/to/locale");
|
//! new_static_locales!(LOCALES_SAMPLE in "path/to/locale");
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use crate::html::{Markup, PreEscaped};
|
use crate::html::{Markup, PreEscaped};
|
||||||
|
|
@ -139,7 +139,7 @@ pub fn langid_for(language: impl Into<String>) -> Result<&'static LanguageIdenti
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
/// Define un conjunto de elementos de localización y textos locales de traducción.
|
/// Define un conjunto de elementos de localización y textos locales de traducción.
|
||||||
macro_rules! static_locales {
|
macro_rules! new_static_locales {
|
||||||
( $LOCALES:ident $(, $core_locales:literal)? ) => {
|
( $LOCALES:ident $(, $core_locales:literal)? ) => {
|
||||||
$crate::locale::fluent_templates::static_loader! {
|
$crate::locale::fluent_templates::static_loader! {
|
||||||
static $LOCALES = {
|
static $LOCALES = {
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ pub use crate::{kv, new_handle};
|
||||||
// crate::config
|
// crate::config
|
||||||
pub use crate::default_settings;
|
pub use crate::default_settings;
|
||||||
// crate::locale
|
// crate::locale
|
||||||
pub use crate::static_locales;
|
pub use crate::new_static_locales;
|
||||||
// crate::service
|
// crate::service
|
||||||
pub use crate::{static_files, static_files_service};
|
pub use crate::{new_static_files, service_for_static_files};
|
||||||
// crate::core::actions
|
// crate::core::actions
|
||||||
pub use crate::actions;
|
pub use crate::actions;
|
||||||
// crate::base::action::component
|
// crate::base::action::component
|
||||||
|
|
@ -36,7 +36,7 @@ pub use crate::locale::*;
|
||||||
pub use crate::datetime::*;
|
pub use crate::datetime::*;
|
||||||
|
|
||||||
#[cfg(feature = "database")]
|
#[cfg(feature = "database")]
|
||||||
pub use crate::{db, db::*, migrations, pub_migration};
|
pub use crate::{db, db::*, migrations, new_migration};
|
||||||
|
|
||||||
pub use crate::service;
|
pub use crate::service;
|
||||||
pub use crate::service::HttpMessage;
|
pub use crate::service::HttpMessage;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ pub use actix_web_files::Files as ActixFiles;
|
||||||
pub use actix_web_static_files::ResourceFiles;
|
pub use actix_web_static_files::ResourceFiles;
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! static_files {
|
macro_rules! new_static_files {
|
||||||
( $bundle:ident ) => {
|
( $bundle:ident ) => {
|
||||||
$crate::paste! {
|
$crate::paste! {
|
||||||
mod [<static_files_ $bundle>] {
|
mod [<static_files_ $bundle>] {
|
||||||
|
|
@ -34,7 +34,7 @@ macro_rules! static_files {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! static_files_service {
|
macro_rules! service_for_static_files {
|
||||||
( $scfg:ident, $path:expr, $bundle:ident ) => {{
|
( $scfg:ident, $path:expr, $bundle:ident ) => {{
|
||||||
$crate::paste! {
|
$crate::paste! {
|
||||||
let static_files = &$crate::config::SETTINGS.dev.static_files;
|
let static_files = &$crate::config::SETTINGS.dev.static_files;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue