💥 Integra acciones de páginas en la propia página
This commit is contained in:
parent
8138e15ed7
commit
7ea54060f8
9 changed files with 17 additions and 15 deletions
|
|
@ -30,7 +30,7 @@ impl ModuleTrait for Admin {
|
|||
}
|
||||
|
||||
fn actions(&self) -> Vec<Action> {
|
||||
vec![action!(action::page::ActionBeforePreparePage => before_prepare_page)]
|
||||
vec![action!(ActionBeforePreparePage => before_prepare_page)]
|
||||
}
|
||||
|
||||
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ impl ModuleTrait for JQuery {
|
|||
}
|
||||
|
||||
fn actions(&self) -> Vec<Action> {
|
||||
vec![action!(action::page::ActionBeforeRenderPage => before_render_page)]
|
||||
vec![action!(ActionBeforeRenderPage => before_render_page)]
|
||||
}
|
||||
|
||||
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ impl ModuleTrait for Node {
|
|||
}
|
||||
|
||||
fn actions(&self) -> Vec<Action> {
|
||||
vec![action!(action::page::ActionBeforePreparePage => before_prepare_page, -1)]
|
||||
vec![action!(ActionBeforePreparePage => before_prepare_page, -1)]
|
||||
}
|
||||
|
||||
fn migrations(&self) -> Vec<MigrationItem> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
pub mod page;
|
||||
|
||||
pub mod block {
|
||||
crate::actions_for_component!(Block);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ impl ComponentTrait for Block {
|
|||
PrepareMarkup::With(html! {
|
||||
div id=(id) class=[self.classes().get()] {
|
||||
@if let Some(title) = self.title().get() {
|
||||
h2 class="block-title" { (title) }
|
||||
h2 class="block__title" { (title) }
|
||||
}
|
||||
div class="block-body" {
|
||||
div class="block__body" {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
use crate::base::action;
|
||||
mod action;
|
||||
pub use action::*;
|
||||
|
||||
use crate::base::component::L10n;
|
||||
use crate::core::component::{ComponentTrait, Context, ContextOp, OneComponent};
|
||||
use crate::core::theme::ComponentsRegions;
|
||||
|
|
@ -136,7 +138,7 @@ impl Page {
|
|||
|
||||
pub fn render(&mut self) -> ResultPage<Markup, FatalError> {
|
||||
// Module actions before preparing the page.
|
||||
action::page::run_actions_before_prepare_page(self);
|
||||
run_actions_before_prepare_page(self);
|
||||
|
||||
// Theme actions before preparing the page.
|
||||
self.context.theme().before_prepare_page(self);
|
||||
|
|
@ -145,7 +147,7 @@ impl Page {
|
|||
let body = self.context.theme().prepare_page_body(self);
|
||||
|
||||
// Module actions before rendering the page.
|
||||
action::page::run_actions_before_render_page(self);
|
||||
run_actions_before_render_page(self);
|
||||
|
||||
// Theme actions before rendering the page.
|
||||
self.context.theme().before_render_page(self);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::response::page::Page;
|
||||
use super::Page;
|
||||
|
||||
pub type ActionPage = fn(page: &mut Page);
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
use super::ActionPage;
|
||||
use crate::core::action::{action_ref, run_actions, ActionTrait, AnyAction};
|
||||
use crate::response::page::Page;
|
||||
use crate::{use_handle, Handle};
|
||||
|
||||
use_handle!(ACTION_BEFORE_PREPARE_PAGE for Action);
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
use super::ActionPage;
|
||||
use crate::core::action::{action_ref, run_actions, ActionTrait, AnyAction};
|
||||
use crate::response::page::Page;
|
||||
use crate::{use_handle, Handle};
|
||||
|
||||
use_handle!(ACTION_BEFORE_RENDER_PAGE for Action);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue