🏷️ Introduce Weight type for element weights
This commit is contained in:
parent
6df57a0c12
commit
941b7ae57b
28 changed files with 118 additions and 110 deletions
|
|
@ -49,7 +49,7 @@ fn after_prepare_body(page: &mut Page) {
|
||||||
page.context().alter(ContextOp::AddJavaScript(
|
page.context().alter(ContextOp::AddJavaScript(
|
||||||
JavaScript::at("/jquery/jquery.min.js")
|
JavaScript::at("/jquery/jquery.min.js")
|
||||||
.with_version("3.6.0")
|
.with_version("3.6.0")
|
||||||
.with_weight(isize::MIN)
|
.with_weight(-99)
|
||||||
.with_mode(ModeJS::Normal),
|
.with_mode(ModeJS::Normal),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ pub enum MegaMenuItemType {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct MegaMenuItem {
|
pub struct MegaMenuItem {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
item_type : MegaMenuItemType,
|
item_type : MegaMenuItemType,
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ impl ComponentTrait for MegaMenuItem {
|
||||||
COMPONENT_MEGAMENUITEM
|
COMPONENT_MEGAMENUITEM
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,8 +124,8 @@ impl MegaMenuItem {
|
||||||
// MegaMenuItem BUILDER.
|
// MegaMenuItem BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ actions_for_component!(MegaMenu);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct MegaMenu {
|
pub struct MegaMenu {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -172,7 +172,7 @@ impl ComponentTrait for MegaMenu {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,8 +220,8 @@ impl MegaMenu {
|
||||||
// MegaMenu BUILDER.
|
// MegaMenu BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ type AnchorHtml = OneComponent<L10n>;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Anchor {
|
pub struct Anchor {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -54,7 +54,7 @@ impl ComponentTrait for Anchor {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,8 +105,8 @@ impl Anchor {
|
||||||
// Anchor BUILDER.
|
// Anchor BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ actions_for_component!(Block);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -29,7 +29,7 @@ impl ComponentTrait for Block {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,8 +70,8 @@ impl Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ pub enum ContainerType {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Container {
|
pub struct Container {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -42,7 +42,7 @@ impl ComponentTrait for Container {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,8 +125,8 @@ impl Container {
|
||||||
// Container BUILDER.
|
// Container BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ type ButtonValue = OneComponent<L10n>;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Button {
|
pub struct Button {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
button_type: ButtonType,
|
button_type: ButtonType,
|
||||||
|
|
@ -37,7 +37,7 @@ impl ComponentTrait for Button {
|
||||||
COMPONENT_BUTTON
|
COMPONENT_BUTTON
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,8 +93,8 @@ impl Button {
|
||||||
// Button BUILDER.
|
// Button BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ create_handle!(COMPONENT_DATE);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Date {
|
pub struct Date {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
name : AttributeValue,
|
name : AttributeValue,
|
||||||
|
|
@ -32,7 +32,7 @@ impl ComponentTrait for Date {
|
||||||
COMPONENT_DATE
|
COMPONENT_DATE
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,8 +78,8 @@ impl Date {
|
||||||
// Date BUILDER.
|
// Date BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub enum FormMethod {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Form {
|
pub struct Form {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -40,7 +40,7 @@ impl ComponentTrait for Form {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,8 +79,8 @@ impl Form {
|
||||||
// Form BUILDER.
|
// Form BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ create_handle!(COMPONENT_HIDDEN);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Hidden {
|
pub struct Hidden {
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
name : NameValue,
|
name : NameValue,
|
||||||
value : AttributeValue,
|
value : AttributeValue,
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ impl ComponentTrait for Hidden {
|
||||||
COMPONENT_HIDDEN
|
COMPONENT_HIDDEN
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,8 +39,8 @@ impl Hidden {
|
||||||
// Hidden BUILDER.
|
// Hidden BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ type InputHelpText = OneComponent<L10n>;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
input_type : InputType,
|
input_type : InputType,
|
||||||
|
|
@ -52,7 +52,7 @@ impl ComponentTrait for Input {
|
||||||
COMPONENT_INPUT
|
COMPONENT_INPUT
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,8 +166,8 @@ impl Input {
|
||||||
// Input BUILDER.
|
// Input BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ pub enum ColumnSize {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Column {
|
pub struct Column {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -61,7 +61,7 @@ impl ComponentTrait for Column {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,8 +90,8 @@ impl Column {
|
||||||
// Column BUILDER.
|
// Column BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ actions_for_component!(Row);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Row {
|
pub struct Row {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -30,7 +30,7 @@ impl ComponentTrait for Row {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,8 +59,8 @@ impl Row {
|
||||||
// Row BUILDER.
|
// Row BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ type HeadingText = OneComponent<L10n>;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Heading {
|
pub struct Heading {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable : Renderable,
|
renderable : Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -53,7 +53,7 @@ impl ComponentTrait for Heading {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,8 +115,8 @@ impl Heading {
|
||||||
// Heading BUILDER.
|
// Heading BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ create_handle!(COMPONENT_ICON);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Icon {
|
pub struct Icon {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
icon_name : String,
|
icon_name : String,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -20,7 +20,7 @@ impl ComponentTrait for Icon {
|
||||||
COMPONENT_ICON
|
COMPONENT_ICON
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,8 +47,8 @@ impl Icon {
|
||||||
// Icon BUILDER.
|
// Icon BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ create_handle!(COMPONENT_IMAGE);
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -26,7 +26,7 @@ impl ComponentTrait for Image {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,8 +52,8 @@ impl Image {
|
||||||
// Image BUILDER.
|
// Image BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ pub enum ParagraphDisplay {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Paragraph {
|
pub struct Paragraph {
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
renderable: Renderable,
|
renderable: Renderable,
|
||||||
id : IdentifierValue,
|
id : IdentifierValue,
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
|
|
@ -38,7 +38,7 @@ impl ComponentTrait for Paragraph {
|
||||||
self.id.get()
|
self.id.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,8 +66,8 @@ impl Paragraph {
|
||||||
// Paragraph BUILDER.
|
// Paragraph BUILDER.
|
||||||
|
|
||||||
#[fn_builder]
|
#[fn_builder]
|
||||||
pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
|
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::Handle;
|
use crate::{Handle, Weight};
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ pub trait ActionTrait: BaseAction + Send + Sync {
|
||||||
|
|
||||||
fn handle(&self) -> Handle;
|
fn handle(&self) -> Handle;
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ macro_rules! actions_for_component {
|
||||||
|
|
||||||
pub struct [<BeforePrepare $Component>] {
|
pub struct [<BeforePrepare $Component>] {
|
||||||
action: Option<[<Action $Component>]>,
|
action: Option<[<Action $Component>]>,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionTrait for [<BeforePrepare $Component>] {
|
impl ActionTrait for [<BeforePrepare $Component>] {
|
||||||
|
|
@ -47,7 +47,7 @@ macro_rules! actions_for_component {
|
||||||
[<ACTION_BEFORE_PREPARE_ $Component:upper>]
|
[<ACTION_BEFORE_PREPARE_ $Component:upper>]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,8 +60,8 @@ macro_rules! actions_for_component {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ macro_rules! actions_for_component {
|
||||||
|
|
||||||
pub struct [<AfterPrepare $Component>] {
|
pub struct [<AfterPrepare $Component>] {
|
||||||
action: Option<[<Action $Component>]>,
|
action: Option<[<Action $Component>]>,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionTrait for [<AfterPrepare $Component>] {
|
impl ActionTrait for [<AfterPrepare $Component>] {
|
||||||
|
|
@ -106,7 +106,7 @@ macro_rules! actions_for_component {
|
||||||
[<ACTION_AFTER_PREPARE_ $Component:upper>]
|
[<ACTION_AFTER_PREPARE_ $Component:upper>]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,8 +119,8 @@ macro_rules! actions_for_component {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::component::Context;
|
use crate::core::component::Context;
|
||||||
use crate::html::{html, Markup, PrepareMarkup};
|
use crate::html::{html, Markup, PrepareMarkup};
|
||||||
use crate::{util, Handle};
|
use crate::{util, Handle, Weight};
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ pub trait ComponentTrait: BaseComponent + Send + Sync {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ impl ThemeTrait for Basic {
|
||||||
fn before_prepare_body(&self, page: &mut Page) {
|
fn before_prepare_body(&self, page: &mut Page) {
|
||||||
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
||||||
.alter_context(ContextOp::AddStyleSheet(
|
.alter_context(ContextOp::AddStyleSheet(
|
||||||
StyleSheet::at("/theme/css/normalize.min.css").with_version("8.0.1"),
|
StyleSheet::at("/theme/css/normalize.min.css")
|
||||||
|
.with_version("8.0.1")
|
||||||
|
.with_weight(-99),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@ pub mod javascript;
|
||||||
pub mod stylesheet;
|
pub mod stylesheet;
|
||||||
|
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::Weight;
|
||||||
|
|
||||||
pub trait AssetsTrait {
|
pub trait AssetsTrait {
|
||||||
fn path(&self) -> &str;
|
fn path(&self) -> &str;
|
||||||
|
|
||||||
fn weight(&self) -> isize;
|
fn weight(&self) -> Weight;
|
||||||
|
|
||||||
fn prepare(&self) -> Markup;
|
fn prepare(&self) -> Markup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
use crate::html::assets::AssetsTrait;
|
use crate::html::assets::AssetsTrait;
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::Weight;
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct HeadScript {
|
pub struct HeadScript {
|
||||||
path : String,
|
path : String,
|
||||||
code : String,
|
code : String,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetsTrait for HeadScript {
|
impl AssetsTrait for HeadScript {
|
||||||
|
|
@ -14,7 +15,7 @@ impl AssetsTrait for HeadScript {
|
||||||
self.path.as_str()
|
self.path.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,8 +40,8 @@ impl HeadScript {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
use crate::html::assets::AssetsTrait;
|
use crate::html::assets::AssetsTrait;
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::Weight;
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct HeadStyles {
|
pub struct HeadStyles {
|
||||||
path : String,
|
path : String,
|
||||||
styles: String,
|
styles: String,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetsTrait for HeadStyles {
|
impl AssetsTrait for HeadStyles {
|
||||||
|
|
@ -14,7 +15,7 @@ impl AssetsTrait for HeadStyles {
|
||||||
self.path.as_str()
|
self.path.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,8 +40,8 @@ impl HeadStyles {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::html::assets::AssetsTrait;
|
use crate::html::assets::AssetsTrait;
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::Weight;
|
||||||
|
|
||||||
#[derive(Default, Eq, PartialEq)]
|
#[derive(Default, Eq, PartialEq)]
|
||||||
pub enum ModeJS {
|
pub enum ModeJS {
|
||||||
|
|
@ -15,7 +16,7 @@ pub struct JavaScript {
|
||||||
path : String,
|
path : String,
|
||||||
prefix : &'static str,
|
prefix : &'static str,
|
||||||
version: &'static str,
|
version: &'static str,
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
mode : ModeJS,
|
mode : ModeJS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -24,7 +25,7 @@ impl AssetsTrait for JavaScript {
|
||||||
self.path.as_str()
|
self.path.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,8 +60,8 @@ impl JavaScript {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::html::assets::AssetsTrait;
|
use crate::html::assets::AssetsTrait;
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::Weight;
|
||||||
|
|
||||||
pub enum TargetMedia {
|
pub enum TargetMedia {
|
||||||
Default,
|
Default,
|
||||||
|
|
@ -15,7 +16,7 @@ pub struct StyleSheet {
|
||||||
prefix : &'static str,
|
prefix : &'static str,
|
||||||
version: &'static str,
|
version: &'static str,
|
||||||
media : Option<&'static str>,
|
media : Option<&'static str>,
|
||||||
weight : isize,
|
weight : Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssetsTrait for StyleSheet {
|
impl AssetsTrait for StyleSheet {
|
||||||
|
|
@ -23,7 +24,7 @@ impl AssetsTrait for StyleSheet {
|
||||||
self.path.as_str()
|
self.path.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,8 +58,8 @@ impl StyleSheet {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
//! The PageTop Prelude.
|
//! The PageTop Prelude.
|
||||||
|
|
||||||
// Re-exports.
|
// Re-exported macros.
|
||||||
pub use crate::{
|
pub use crate::{concat_string, fn_builder, paste};
|
||||||
concat_string, fn_builder, paste, Handle, HashMapResources, LazyStatic, ResultExt,
|
|
||||||
};
|
// Global.
|
||||||
|
pub use crate::{Handle, HashMapResources, LazyStatic, ResultExt, Weight};
|
||||||
|
|
||||||
// Funciones y macros útiles.
|
// Funciones y macros útiles.
|
||||||
pub use crate::util;
|
pub use crate::util;
|
||||||
|
|
@ -11,7 +12,7 @@ pub use crate::{action, actions_for_component};
|
||||||
pub use crate::{create_handle, default_settings, kv};
|
pub use crate::{create_handle, default_settings, kv};
|
||||||
pub use crate::{serve_static_files, static_files, static_locales};
|
pub use crate::{serve_static_files, static_files, static_locales};
|
||||||
|
|
||||||
// *************************************************************************************************
|
// API.
|
||||||
|
|
||||||
pub use crate::config;
|
pub use crate::config;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use crate::core::action::{action_ref, run_actions, ActionTrait};
|
use crate::core::action::{action_ref, run_actions, ActionTrait};
|
||||||
use crate::response::page::action::ActionPage;
|
use crate::response::page::action::ActionPage;
|
||||||
use crate::response::page::Page;
|
use crate::response::page::Page;
|
||||||
use crate::{create_handle, Handle};
|
use crate::{create_handle, Handle, Weight};
|
||||||
|
|
||||||
create_handle!(ACTION_AFTER_PREPARE_BODY for Action);
|
create_handle!(ACTION_AFTER_PREPARE_BODY for Action);
|
||||||
|
|
||||||
pub struct ActionAfterPrepareBody {
|
pub struct ActionAfterPrepareBody {
|
||||||
action: Option<ActionPage>,
|
action: Option<ActionPage>,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionTrait for ActionAfterPrepareBody {
|
impl ActionTrait for ActionAfterPrepareBody {
|
||||||
|
|
@ -22,7 +22,7 @@ impl ActionTrait for ActionAfterPrepareBody {
|
||||||
ACTION_AFTER_PREPARE_BODY
|
ACTION_AFTER_PREPARE_BODY
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,8 +33,8 @@ impl ActionAfterPrepareBody {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use crate::core::action::{action_ref, run_actions, ActionTrait};
|
use crate::core::action::{action_ref, run_actions, ActionTrait};
|
||||||
use crate::response::page::action::ActionPage;
|
use crate::response::page::action::ActionPage;
|
||||||
use crate::response::page::Page;
|
use crate::response::page::Page;
|
||||||
use crate::{create_handle, Handle};
|
use crate::{create_handle, Handle, Weight};
|
||||||
|
|
||||||
create_handle!(ACTION_BEFORE_PREPARE_BODY for Action);
|
create_handle!(ACTION_BEFORE_PREPARE_BODY for Action);
|
||||||
|
|
||||||
pub struct ActionBeforePrepareBody {
|
pub struct ActionBeforePrepareBody {
|
||||||
action: Option<ActionPage>,
|
action: Option<ActionPage>,
|
||||||
weight: isize,
|
weight: Weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActionTrait for ActionBeforePrepareBody {
|
impl ActionTrait for ActionBeforePrepareBody {
|
||||||
|
|
@ -22,7 +22,7 @@ impl ActionTrait for ActionBeforePrepareBody {
|
||||||
ACTION_BEFORE_PREPARE_BODY
|
ACTION_BEFORE_PREPARE_BODY
|
||||||
}
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> Weight {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,8 +33,8 @@ impl ActionBeforePrepareBody {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: isize) -> Self {
|
pub fn with_weight(mut self, value: Weight) -> Self {
|
||||||
self.weight = weight;
|
self.weight = value;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue