🚚 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);
|
||||
|
||||
static_files!(base);
|
||||
new_static_files!(base);
|
||||
|
||||
pub struct Inception;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ impl ModuleTrait for Inception {
|
|||
}
|
||||
|
||||
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>;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! pub_migration {
|
||||
macro_rules! new_migration {
|
||||
( $migration:ident ) => {
|
||||
pub struct $migration;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ pub type Handle = u64;
|
|||
pub type Weight = i8;
|
||||
pub type HashMapResources = std::collections::HashMap<&'static str, StaticResource>;
|
||||
|
||||
static_locales!(LOCALES_PAGETOP);
|
||||
new_static_locales!(LOCALES_PAGETOP);
|
||||
|
||||
// *************************************************************************************************
|
||||
// PUBLIC API.
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@
|
|||
//! # Cómo aplicar la localización en tu código
|
||||
//!
|
||||
//! 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
|
||||
//! recursos se encuentran en el directorio `"src/locale"` bastará con declarar:
|
||||
//! [`new_static_locales!`](crate::new_static_locales) para integrarlos en tu módulo o aplicación.
|
||||
//! si tus recursos se encuentran en el directorio `"src/locale"` bastará con declarar:
|
||||
//!
|
||||
//! ```
|
||||
//! use pagetop::prelude::*;
|
||||
//!
|
||||
//! static_locales!(LOCALES_SAMPLE);
|
||||
//! new_static_locales!(LOCALES_SAMPLE);
|
||||
//! ```
|
||||
//!
|
||||
//! Y si están en otro directorio, entonces puedes usar:
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
//! ```
|
||||
//! 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};
|
||||
|
|
@ -139,7 +139,7 @@ pub fn langid_for(language: impl Into<String>) -> Result<&'static LanguageIdenti
|
|||
|
||||
#[macro_export]
|
||||
/// 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)? ) => {
|
||||
$crate::locale::fluent_templates::static_loader! {
|
||||
static $LOCALES = {
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ pub use crate::{kv, new_handle};
|
|||
// crate::config
|
||||
pub use crate::default_settings;
|
||||
// crate::locale
|
||||
pub use crate::static_locales;
|
||||
pub use crate::new_static_locales;
|
||||
// crate::service
|
||||
pub use crate::{static_files, static_files_service};
|
||||
pub use crate::{new_static_files, service_for_static_files};
|
||||
// crate::core::actions
|
||||
pub use crate::actions;
|
||||
// crate::base::action::component
|
||||
|
|
@ -36,7 +36,7 @@ pub use crate::locale::*;
|
|||
pub use crate::datetime::*;
|
||||
|
||||
#[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::HttpMessage;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub use actix_web_files::Files as ActixFiles;
|
|||
pub use actix_web_static_files::ResourceFiles;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! static_files {
|
||||
macro_rules! new_static_files {
|
||||
( $bundle:ident ) => {
|
||||
$crate::paste! {
|
||||
mod [<static_files_ $bundle>] {
|
||||
|
|
@ -34,7 +34,7 @@ macro_rules! static_files {
|
|||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! static_files_service {
|
||||
macro_rules! service_for_static_files {
|
||||
( $scfg:ident, $path:expr, $bundle:ident ) => {{
|
||||
$crate::paste! {
|
||||
let static_files = &$crate::config::SETTINGS.dev.static_files;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue