🔥 Remove minimal crate for PageTop integration
This commit is contained in:
parent
156429beb0
commit
7e21ddbf90
42 changed files with 0 additions and 5430 deletions
|
|
@ -8,7 +8,6 @@ members = [
|
|||
"pagetop-jquery",
|
||||
"pagetop-homedemo",
|
||||
# Components.
|
||||
"pagetop-minimal",
|
||||
"pagetop-megamenu",
|
||||
# Modules.
|
||||
"pagetop-admin",
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ El repositorio se organiza en un *workspace* con los siguientes subproyectos:
|
|||
|
||||
## Componentes
|
||||
|
||||
* **[pagetop-minimal](https://github.com/manuelcillero/pagetop/tree/main/pagetop-minimal)**, módulo
|
||||
que proporciona un conjunto básico de componentes para la composición de páginas.
|
||||
|
||||
* **[pagetop-jquery](https://github.com/manuelcillero/pagetop/tree/main/pagetop-jquery)**, módulo
|
||||
que permite añadir jQuery en las páginas que incluyen componentes o temas que usen esta librería
|
||||
JavaScript para interactuar con el documento HTML.
|
||||
|
|
|
|||
|
|
@ -16,5 +16,4 @@ license = "Apache-2.0 OR MIT"
|
|||
|
||||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop" }
|
||||
pagetop-minimal = { version = "0.0", path = "../pagetop-minimal" }
|
||||
pagetop-megamenu = { version = "0.0", path = "../pagetop-megamenu" }
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ impl ModuleTrait for Admin {
|
|||
#[rustfmt::skip]
|
||||
fn dependencies(&self) -> Vec<ModuleRef> {
|
||||
vec![
|
||||
&pagetop_minimal::Minimal,
|
||||
&pagetop_megamenu::MegaMenu,
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use crate::LOCALES_ADMIN;
|
|||
|
||||
use pagetop::prelude::*;
|
||||
use pagetop_megamenu::component::{MegaItem, MegaMenu};
|
||||
use pagetop_minimal::component::*;
|
||||
|
||||
pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, FatalError> {
|
||||
let top_menu = MegaMenu::new()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ license = "Apache-2.0 OR MIT"
|
|||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop" }
|
||||
pagetop-jquery = { version = "0.0", path = "../pagetop-jquery" }
|
||||
pagetop-minimal = { version = "0.0", path = "../pagetop-minimal" }
|
||||
static-files = "0.2.3"
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use pagetop::prelude::*;
|
||||
use pagetop_jquery::JQuery;
|
||||
use pagetop_minimal::component::*;
|
||||
|
||||
new_handle!(THEME_BULMIX);
|
||||
|
||||
|
|
@ -21,7 +20,6 @@ impl ModuleTrait for Bulmix {
|
|||
fn dependencies(&self) -> Vec<ModuleRef> {
|
||||
vec![
|
||||
&pagetop_jquery::JQuery,
|
||||
&pagetop_minimal::Minimal,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ license = "Apache-2.0 OR MIT"
|
|||
|
||||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop" }
|
||||
pagetop-minimal = { version = "0.0", path = "../pagetop-minimal" }
|
||||
static-files = "0.2.3"
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use pagetop_minimal::component::*;
|
||||
use pagetop_minimal::BreakPoint;
|
||||
|
||||
new_handle!(MODULE_HOMEDEMO);
|
||||
|
||||
static_locales!(LOCALES_HOMEDEMO);
|
||||
|
|
@ -24,10 +21,6 @@ impl ModuleTrait for HomeDemo {
|
|||
L10n::t("module_description", &LOCALES_HOMEDEMO)
|
||||
}
|
||||
|
||||
fn dependencies(&self) -> Vec<ModuleRef> {
|
||||
vec![&pagetop_minimal::Minimal]
|
||||
}
|
||||
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
static_files_service!(scfg, "/homedemo", homedemo);
|
||||
scfg.route("/", service::web::get().to(demo));
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
[package]
|
||||
name = "pagetop-minimal"
|
||||
version = "0.0.10"
|
||||
edition = "2021"
|
||||
|
||||
authors = [
|
||||
"Manuel Cillero <manuel@cillero.es>"
|
||||
]
|
||||
description = """\
|
||||
Module for PageTop with a minimal set of components for page composition.\
|
||||
"""
|
||||
homepage = "https://pagetop.cillero.es"
|
||||
repository = "https://github.com/manuelcillero/pagetop"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop" }
|
||||
static-files = "0.2.3"
|
||||
|
||||
[build-dependencies]
|
||||
pagetop-build = { version = "0.0", path = "../pagetop-build" }
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
Módulo que proporciona un conjunto básico de componentes para la composición de páginas en
|
||||
**PageTop**.
|
||||
|
||||
[PageTop](https://github.com/manuelcillero/pagetop/tree/main/pagetop), es un entorno de desarrollo
|
||||
basado en algunos de los *crates* más estables y populares del ecosistema Rust para proporcionar
|
||||
APIs, patrones de desarrollo y buenas prácticas para la creación de soluciones web SSR (*Server-Side
|
||||
Rendering*).
|
||||
|
||||
|
||||
# 🚧 Advertencia
|
||||
|
||||
**PageTop** sólo libera actualmente versiones de desarrollo. La API no es estable y los cambios son
|
||||
constantes. No puede considerarse preparado hasta que se libere la versión **0.1.0**.
|
||||
|
||||
|
||||
# 📜 Licencia
|
||||
|
||||
Este proyecto tiene licencia, de hecho tiene dos, puedes aplicar cualquiera de las siguientes a tu
|
||||
elección:
|
||||
|
||||
* Licencia Apache versión 2.0
|
||||
([LICENSE-APACHE](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-APACHE) o
|
||||
[http://www.apache.org/licenses/LICENSE-2.0]).
|
||||
|
||||
* Licencia MIT
|
||||
([LICENSE-MIT](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-MIT) o
|
||||
[http://opensource.org/licenses/MIT]).
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
use pagetop_build::StaticFilesBundle;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
StaticFilesBundle::from_dir("./static")
|
||||
.with_name("minimal")
|
||||
.build()
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
mod container;
|
||||
pub use container::{Container, ContainerType, COMPONENT_CONTAINER};
|
||||
|
||||
pub mod flex;
|
||||
|
||||
mod icon;
|
||||
pub use icon::{Icon, COMPONENT_ICON};
|
||||
mod heading;
|
||||
pub use heading::{Heading, HeadingDisplay, HeadingType, COMPONENT_HEADING};
|
||||
mod paragraph;
|
||||
pub use paragraph::{Paragraph, ParagraphDisplay, COMPONENT_PARAGRAPH};
|
||||
mod anchor;
|
||||
pub use anchor::{Anchor, AnchorTarget, AnchorType, COMPONENT_ANCHOR};
|
||||
mod image;
|
||||
pub use image::{Image, ImageSize, COMPONENT_IMAGE};
|
||||
mod block;
|
||||
pub use block::{Block, COMPONENT_BLOCK};
|
||||
mod site_branding;
|
||||
pub use site_branding::{SiteBranding, COMPONENT_BRANDING};
|
||||
mod powered_by;
|
||||
pub use powered_by::{PoweredBy, PoweredByLogo, COMPONENT_POWEREDBY};
|
||||
|
||||
pub mod form_element;
|
||||
pub use form_element::{Form, FormMethod, COMPONENT_FORM};
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::component::Icon;
|
||||
|
||||
new_handle!(COMPONENT_ANCHOR);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum AnchorType {
|
||||
#[default]
|
||||
Link,
|
||||
Button,
|
||||
Location,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum AnchorTarget {
|
||||
#[default]
|
||||
Default,
|
||||
Blank,
|
||||
Parent,
|
||||
Top,
|
||||
Context(String),
|
||||
}
|
||||
|
||||
type AnchorIcon = TypedComponent<Icon>;
|
||||
type AnchorHtml = TypedComponent<L10n>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Anchor {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
anchor_type: AnchorType,
|
||||
href : AttributeValue,
|
||||
html : AnchorHtml,
|
||||
left_icon : AnchorIcon,
|
||||
right_icon : AnchorIcon,
|
||||
target : AnchorTarget,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Anchor {
|
||||
fn new() -> Self {
|
||||
Anchor::default()
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_ANCHOR
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let target = match &self.target() {
|
||||
AnchorTarget::Blank => Some("_blank"),
|
||||
AnchorTarget::Parent => Some("_parent"),
|
||||
AnchorTarget::Top => Some("_top"),
|
||||
AnchorTarget::Context(name) => Some(name.as_str()),
|
||||
_ => None,
|
||||
};
|
||||
PrepareMarkup::With(html! {
|
||||
a
|
||||
id=[self.id()]
|
||||
class=[self.classes().get()]
|
||||
href=[self.href().get()]
|
||||
target=[target]
|
||||
{
|
||||
(self.left_icon().prepare(cx))
|
||||
" " span { (self.html().prepare(cx)) } " "
|
||||
(self.right_icon().prepare(cx))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Anchor {
|
||||
pub fn link(href: &str, html: L10n) -> Self {
|
||||
Anchor::new().with_href(href).with_html(html)
|
||||
}
|
||||
|
||||
pub fn button(href: &str, html: L10n) -> Self {
|
||||
Anchor::new()
|
||||
.with_type(AnchorType::Button)
|
||||
.with_href(href)
|
||||
.with_html(html)
|
||||
}
|
||||
|
||||
pub fn location(id: &str) -> Self {
|
||||
Anchor::new().with_type(AnchorType::Location).with_id(id)
|
||||
}
|
||||
|
||||
// Anchor BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_type(&mut self, anchor_type: AnchorType) -> &mut Self {
|
||||
self.alter_classes(
|
||||
ClassesOp::SetDefault,
|
||||
match anchor_type {
|
||||
AnchorType::Button => "btn btn-primary",
|
||||
_ => "",
|
||||
},
|
||||
);
|
||||
self.anchor_type = anchor_type;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_href(&mut self, href: &str) -> &mut Self {
|
||||
self.href.alter_value(href);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_html(&mut self, html: L10n) -> &mut Self {
|
||||
self.html.set(html);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_left_icon(&mut self, icon: Icon) -> &mut Self {
|
||||
self.left_icon.set(icon);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_right_icon(&mut self, icon: Icon) -> &mut Self {
|
||||
self.right_icon.set(icon);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_target(&mut self, target: AnchorTarget) -> &mut Self {
|
||||
self.target = target;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Anchor GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn anchor_type(&self) -> &AnchorType {
|
||||
&self.anchor_type
|
||||
}
|
||||
|
||||
pub fn href(&self) -> &AttributeValue {
|
||||
&self.href
|
||||
}
|
||||
|
||||
pub fn html(&self) -> &AnchorHtml {
|
||||
&self.html
|
||||
}
|
||||
|
||||
pub fn left_icon(&self) -> &AnchorIcon {
|
||||
&self.left_icon
|
||||
}
|
||||
|
||||
pub fn right_icon(&self) -> &AnchorIcon {
|
||||
&self.right_icon
|
||||
}
|
||||
|
||||
pub fn target(&self) -> &AnchorTarget {
|
||||
&self.target
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_BLOCK);
|
||||
|
||||
actions_for_component!(Block);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Block {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
title : AttributeValue,
|
||||
stuff : ArcComponents,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Block {
|
||||
fn new() -> Self {
|
||||
Block::default().with_classes(ClassesOp::SetDefault, "block")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_BLOCK
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_before_prepare_block(self, cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let id = cx.required_id::<Block>(self.id());
|
||||
PrepareMarkup::With(html! {
|
||||
div id=(id) class=[self.classes().get()] {
|
||||
@if let Some(title) = self.title().get() {
|
||||
h2 class="block-title" { (title) }
|
||||
}
|
||||
div class="block-body" {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_after_prepare_block(self, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Block {
|
||||
// Block BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_title(&mut self, title: &str) -> &mut Self {
|
||||
self.title.alter_value(title);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
|
||||
self.stuff.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Block GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &AttributeValue {
|
||||
&self.title
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ArcComponents {
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_CONTAINER);
|
||||
|
||||
actions_for_component!(Container);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ContainerType {
|
||||
#[default]
|
||||
Wrapper,
|
||||
Header,
|
||||
Footer,
|
||||
Main,
|
||||
Section,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Container {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
inner_classes : Classes,
|
||||
container_type: ContainerType,
|
||||
stuff : ArcComponents,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Container {
|
||||
fn new() -> Self {
|
||||
Container::default()
|
||||
.with_classes(ClassesOp::SetDefault, "container")
|
||||
.with_inner_classes(ClassesOp::SetDefault, "container")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_CONTAINER
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_before_prepare_container(self, cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
match self.container_type() {
|
||||
ContainerType::Header => PrepareMarkup::With(html! {
|
||||
header id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
}),
|
||||
ContainerType::Footer => PrepareMarkup::With(html! {
|
||||
footer id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
}),
|
||||
ContainerType::Main => PrepareMarkup::With(html! {
|
||||
main id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
}),
|
||||
ContainerType::Section => PrepareMarkup::With(html! {
|
||||
section id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
}),
|
||||
_ => PrepareMarkup::With(html! {
|
||||
div id=[self.id()] class=[self.classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_after_prepare_container(self, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Container {
|
||||
pub fn header() -> Self {
|
||||
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "header");
|
||||
c.container_type = ContainerType::Header;
|
||||
c
|
||||
}
|
||||
|
||||
pub fn footer() -> Self {
|
||||
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "footer");
|
||||
c.container_type = ContainerType::Footer;
|
||||
c
|
||||
}
|
||||
|
||||
pub fn main() -> Self {
|
||||
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "main");
|
||||
c.container_type = ContainerType::Main;
|
||||
c
|
||||
}
|
||||
|
||||
pub fn section() -> Self {
|
||||
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "section");
|
||||
c.container_type = ContainerType::Section;
|
||||
c
|
||||
}
|
||||
|
||||
// Container BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_inner_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.inner_classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
|
||||
self.stuff.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Container GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn inner_classes(&self) -> &Classes {
|
||||
&self.inner_classes
|
||||
}
|
||||
|
||||
pub fn container_type(&self) -> &ContainerType {
|
||||
&self.container_type
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ArcComponents {
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,325 +0,0 @@
|
|||
mod container;
|
||||
pub use container::{Container, COMPONENT_FLEX_CONTAINER};
|
||||
mod item;
|
||||
pub use item::{Item, COMPONENT_FLEX_ITEM};
|
||||
|
||||
use pagetop::concat_string;
|
||||
use pagetop::html::unit;
|
||||
|
||||
use crate::BreakPoint;
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum Direction {
|
||||
#[default]
|
||||
Default,
|
||||
Row(BreakPoint),
|
||||
RowReverse(BreakPoint),
|
||||
Column(BreakPoint),
|
||||
ColumnReverse(BreakPoint),
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for Direction {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Direction::Default => {
|
||||
concat_string!("flex-container flex-row ", BreakPoint::default().to_string())
|
||||
}
|
||||
Direction::Row(breakpoint) => {
|
||||
concat_string!("flex-container flex-row ", breakpoint.to_string())
|
||||
}
|
||||
Direction::RowReverse(breakpoint) => {
|
||||
concat_string!("flex-container flex-row flex-reverse ", breakpoint.to_string())
|
||||
}
|
||||
Direction::Column(breakpoint) => {
|
||||
concat_string!("flex-container flex-col ", breakpoint.to_string())
|
||||
}
|
||||
Direction::ColumnReverse(breakpoint) => {
|
||||
concat_string!("flex-container flex-col flex-reverse ", breakpoint.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum WrapAlign {
|
||||
#[default]
|
||||
Default,
|
||||
NoWrap,
|
||||
Wrap(ContentAlign),
|
||||
WrapReverse(ContentAlign),
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for WrapAlign {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
WrapAlign::Default => "".to_string(),
|
||||
WrapAlign::NoWrap => "flex-nowrap".to_string(),
|
||||
WrapAlign::Wrap(a) => concat_string!("flex-wrap ", a.to_string()),
|
||||
WrapAlign::WrapReverse(a) => concat_string!("flex-wrap-reverse ", a.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ContentAlign {
|
||||
#[default]
|
||||
Default,
|
||||
Start,
|
||||
End,
|
||||
Center,
|
||||
Stretch,
|
||||
SpaceBetween,
|
||||
SpaceAround,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ContentAlign {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ContentAlign::Default => "".to_string(),
|
||||
ContentAlign::Start => "flex-align-start".to_string(),
|
||||
ContentAlign::End => "flex-align-end".to_string(),
|
||||
ContentAlign::Center => "flex-align-center".to_string(),
|
||||
ContentAlign::Stretch => "flex-align-stretch".to_string(),
|
||||
ContentAlign::SpaceBetween => "flex-align-space-between".to_string(),
|
||||
ContentAlign::SpaceAround => "flex-align-space-around".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ContentJustify {
|
||||
#[default]
|
||||
Default,
|
||||
Start,
|
||||
End,
|
||||
Center,
|
||||
SpaceBetween,
|
||||
SpaceAround,
|
||||
SpaceEvenly,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ContentJustify {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ContentJustify::Default => "".to_string(),
|
||||
ContentJustify::Start => "flex-justify-start".to_string(),
|
||||
ContentJustify::End => "flex-justify-end".to_string(),
|
||||
ContentJustify::Center => "flex-justify-center".to_string(),
|
||||
ContentJustify::SpaceBetween => "flex-justify-space-between".to_string(),
|
||||
ContentJustify::SpaceAround => "flex-justify-space-around".to_string(),
|
||||
ContentJustify::SpaceEvenly => "flex-justify-space-evenly".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ItemAlign {
|
||||
#[default]
|
||||
Default,
|
||||
Top,
|
||||
Bottom,
|
||||
Middle,
|
||||
Stretch,
|
||||
Baseline,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ItemAlign {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ItemAlign::Default => "".to_string(),
|
||||
ItemAlign::Top => "flex-item-top".to_string(),
|
||||
ItemAlign::Bottom => "flex-item-bottom".to_string(),
|
||||
ItemAlign::Middle => "flex-item-middle".to_string(),
|
||||
ItemAlign::Stretch => "flex-item-stretch".to_string(),
|
||||
ItemAlign::Baseline => "flex-item-baseline".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum Gap {
|
||||
#[default]
|
||||
Default,
|
||||
Row(unit::Value),
|
||||
Column(unit::Value),
|
||||
Distinct(unit::Value, unit::Value),
|
||||
Both(unit::Value),
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for Gap {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Gap::Default => "".to_string(),
|
||||
Gap::Row(r) => concat_string!("row-gap: ", r.to_string(), ";"),
|
||||
Gap::Column(c) => concat_string!("column-gap: ", c.to_string(), ";"),
|
||||
Gap::Distinct(r, c) => concat_string!("gap: ", r.to_string(), " ", c.to_string(), ";"),
|
||||
Gap::Both(v) => concat_string!("gap: ", v.to_string(), ";"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ItemGrow {
|
||||
#[default]
|
||||
Default,
|
||||
Is1,
|
||||
Is2,
|
||||
Is3,
|
||||
Is4,
|
||||
Is5,
|
||||
Is6,
|
||||
Is7,
|
||||
Is8,
|
||||
Is9,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ItemGrow {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ItemGrow::Default => "".to_string(),
|
||||
ItemGrow::Is1 => "flex-grow-1".to_string(),
|
||||
ItemGrow::Is2 => "flex-grow-2".to_string(),
|
||||
ItemGrow::Is3 => "flex-grow-3".to_string(),
|
||||
ItemGrow::Is4 => "flex-grow-4".to_string(),
|
||||
ItemGrow::Is5 => "flex-grow-5".to_string(),
|
||||
ItemGrow::Is6 => "flex-grow-6".to_string(),
|
||||
ItemGrow::Is7 => "flex-grow-7".to_string(),
|
||||
ItemGrow::Is8 => "flex-grow-8".to_string(),
|
||||
ItemGrow::Is9 => "flex-grow-9".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ItemShrink {
|
||||
#[default]
|
||||
Default,
|
||||
Is1,
|
||||
Is2,
|
||||
Is3,
|
||||
Is4,
|
||||
Is5,
|
||||
Is6,
|
||||
Is7,
|
||||
Is8,
|
||||
Is9,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ItemShrink {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ItemShrink::Default => "".to_string(),
|
||||
ItemShrink::Is1 => "flex-shrink-1".to_string(),
|
||||
ItemShrink::Is2 => "flex-shrink-2".to_string(),
|
||||
ItemShrink::Is3 => "flex-shrink-3".to_string(),
|
||||
ItemShrink::Is4 => "flex-shrink-4".to_string(),
|
||||
ItemShrink::Is5 => "flex-shrink-5".to_string(),
|
||||
ItemShrink::Is6 => "flex-shrink-6".to_string(),
|
||||
ItemShrink::Is7 => "flex-shrink-7".to_string(),
|
||||
ItemShrink::Is8 => "flex-shrink-8".to_string(),
|
||||
ItemShrink::Is9 => "flex-shrink-9".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ItemSize {
|
||||
#[default]
|
||||
Default,
|
||||
Percent10,
|
||||
Percent20,
|
||||
Percent25,
|
||||
Percent33,
|
||||
Percent40,
|
||||
Percent50,
|
||||
Percent60,
|
||||
Percent66,
|
||||
Percent75,
|
||||
Percent80,
|
||||
Percent90,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ItemSize {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ItemSize::Default => "".to_string(),
|
||||
ItemSize::Percent10 => "flex-width-10".to_string(),
|
||||
ItemSize::Percent20 => "flex-width-20".to_string(),
|
||||
ItemSize::Percent25 => "flex-width-25".to_string(),
|
||||
ItemSize::Percent33 => "flex-width-33".to_string(),
|
||||
ItemSize::Percent40 => "flex-width-40".to_string(),
|
||||
ItemSize::Percent50 => "flex-width-50".to_string(),
|
||||
ItemSize::Percent60 => "flex-width-60".to_string(),
|
||||
ItemSize::Percent66 => "flex-width-66".to_string(),
|
||||
ItemSize::Percent75 => "flex-width-75".to_string(),
|
||||
ItemSize::Percent80 => "flex-width-80".to_string(),
|
||||
ItemSize::Percent90 => "flex-width-90".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ItemOffset {
|
||||
#[default]
|
||||
Default,
|
||||
Offset10,
|
||||
Offset20,
|
||||
Offset25,
|
||||
Offset33,
|
||||
Offset40,
|
||||
Offset50,
|
||||
Offset60,
|
||||
Offset66,
|
||||
Offset75,
|
||||
Offset80,
|
||||
Offset90,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for ItemOffset {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ItemOffset::Default => "".to_string(),
|
||||
ItemOffset::Offset10 => "flex-offset-10".to_string(),
|
||||
ItemOffset::Offset20 => "flex-offset-20".to_string(),
|
||||
ItemOffset::Offset25 => "flex-offset-25".to_string(),
|
||||
ItemOffset::Offset33 => "flex-offset-33".to_string(),
|
||||
ItemOffset::Offset40 => "flex-offset-40".to_string(),
|
||||
ItemOffset::Offset50 => "flex-offset-50".to_string(),
|
||||
ItemOffset::Offset60 => "flex-offset-60".to_string(),
|
||||
ItemOffset::Offset66 => "flex-offset-66".to_string(),
|
||||
ItemOffset::Offset75 => "flex-offset-75".to_string(),
|
||||
ItemOffset::Offset80 => "flex-offset-80".to_string(),
|
||||
ItemOffset::Offset90 => "flex-offset-90".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::component::flex;
|
||||
|
||||
new_handle!(COMPONENT_FLEX_CONTAINER);
|
||||
|
||||
actions_for_component!(Container);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Container {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
items : TypedComponents<flex::Item>,
|
||||
direction : flex::Direction,
|
||||
wrap_align : flex::WrapAlign,
|
||||
content_justify: flex::ContentJustify,
|
||||
items_align : flex::ItemAlign,
|
||||
gap : flex::Gap,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Container {
|
||||
fn new() -> Self {
|
||||
Container::default()
|
||||
.with_classes(ClassesOp::SetDefault, flex::Direction::Default.to_string())
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_FLEX_CONTAINER
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_before_prepare_container(self, cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
cx.set_param::<bool>(crate::PARAM_MINIMAL_FLEX, true);
|
||||
|
||||
let gap = match self.gap() {
|
||||
flex::Gap::Default => None,
|
||||
_ => Some(self.gap().to_string()),
|
||||
};
|
||||
|
||||
PrepareMarkup::With(html! {
|
||||
div id=[self.id()] class=[self.classes().get()] style=[gap] {
|
||||
(self.items().prepare(cx))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_after_prepare_container(self, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Container {
|
||||
// Container BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_item(mut self, item: flex::Item) -> Self {
|
||||
self.items.alter(TypedOp::Add(TypedComponent::with(item)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_items(&mut self, op: TypedOp<flex::Item>) -> &mut Self {
|
||||
self.items.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_direction(&mut self, direction: flex::Direction) -> &mut Self {
|
||||
self.classes.alter_value(
|
||||
ClassesOp::Replace(self.direction.to_string()),
|
||||
direction.to_string(),
|
||||
);
|
||||
self.direction = direction;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_wrap_align(&mut self, wrap: flex::WrapAlign) -> &mut Self {
|
||||
self.classes.alter_value(
|
||||
ClassesOp::Replace(self.wrap_align.to_string()),
|
||||
wrap.to_string(),
|
||||
);
|
||||
self.wrap_align = wrap;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_content_justify(&mut self, justify: flex::ContentJustify) -> &mut Self {
|
||||
self.classes.alter_value(
|
||||
ClassesOp::Replace(self.content_justify.to_string()),
|
||||
justify.to_string(),
|
||||
);
|
||||
self.content_justify = justify;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_items_align(&mut self, align: flex::ItemAlign) -> &mut Self {
|
||||
self.classes.alter_value(
|
||||
ClassesOp::Replace(self.items_align.to_string()),
|
||||
align.to_string(),
|
||||
);
|
||||
self.items_align = align;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_gap(&mut self, gap: flex::Gap) -> &mut Self {
|
||||
self.gap = gap;
|
||||
self
|
||||
}
|
||||
|
||||
// Container GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &TypedComponents<flex::Item> {
|
||||
&self.items
|
||||
}
|
||||
|
||||
pub fn direction(&self) -> &flex::Direction {
|
||||
&self.direction
|
||||
}
|
||||
|
||||
pub fn wrap_align(&self) -> &flex::WrapAlign {
|
||||
&self.wrap_align
|
||||
}
|
||||
|
||||
pub fn content_justify(&self) -> &flex::ContentJustify {
|
||||
&self.content_justify
|
||||
}
|
||||
|
||||
pub fn items_align(&self) -> &flex::ItemAlign {
|
||||
&self.items_align
|
||||
}
|
||||
|
||||
pub fn gap(&self) -> &flex::Gap {
|
||||
&self.gap
|
||||
}
|
||||
}
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::component::flex;
|
||||
|
||||
new_handle!(COMPONENT_FLEX_ITEM);
|
||||
|
||||
actions_for_component!(Item);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Item {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
id : IdentifierValue,
|
||||
item_classes : Classes,
|
||||
inner_classes: Classes,
|
||||
item_grow : flex::ItemGrow,
|
||||
item_shrink : flex::ItemShrink,
|
||||
item_size : flex::ItemSize,
|
||||
item_offset : flex::ItemOffset,
|
||||
item_align : flex::ItemAlign,
|
||||
stuff : ArcComponents,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Item {
|
||||
fn new() -> Self {
|
||||
Item::default()
|
||||
.with_item_classes(ClassesOp::SetDefault, "flex-item")
|
||||
.with_inner_classes(ClassesOp::SetDefault, "flex-item-inner")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_FLEX_ITEM
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_before_prepare_item(self, cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let order = match self.weight() {
|
||||
0 => None,
|
||||
_ => Some(concat_string!("order: ", self.weight().to_string(), ";")),
|
||||
};
|
||||
PrepareMarkup::With(html! {
|
||||
div id=[self.id()] class=[self.item_classes().get()] style=[order] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_after_prepare_item(self, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Item {
|
||||
// Item BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_item_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.item_classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_inner_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.inner_classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_grow(&mut self, grow: flex::ItemGrow) -> &mut Self {
|
||||
self.item_classes.alter_value(
|
||||
ClassesOp::Replace(self.item_grow.to_string()),
|
||||
grow.to_string(),
|
||||
);
|
||||
self.item_grow = grow;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_shrink(&mut self, shrink: flex::ItemShrink) -> &mut Self {
|
||||
self.item_classes.alter_value(
|
||||
ClassesOp::Replace(self.item_shrink.to_string()),
|
||||
shrink.to_string(),
|
||||
);
|
||||
self.item_shrink = shrink;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_size(&mut self, size: flex::ItemSize) -> &mut Self {
|
||||
self.item_classes.alter_value(
|
||||
ClassesOp::Replace(self.item_size.to_string()),
|
||||
size.to_string(),
|
||||
);
|
||||
self.item_size = size;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_offset(&mut self, offset: flex::ItemOffset) -> &mut Self {
|
||||
self.item_classes.alter_value(
|
||||
ClassesOp::Replace(self.item_offset.to_string()),
|
||||
offset.to_string(),
|
||||
);
|
||||
self.item_offset = offset;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_align(&mut self, align: flex::ItemAlign) -> &mut Self {
|
||||
self.item_classes.alter_value(
|
||||
ClassesOp::Replace(self.item_align.to_string()),
|
||||
align.to_string(),
|
||||
);
|
||||
self.item_align = align;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
|
||||
self.stuff.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
// Item GETTERS.
|
||||
|
||||
pub fn item_classes(&self) -> &Classes {
|
||||
&self.item_classes
|
||||
}
|
||||
|
||||
pub fn inner_classes(&self) -> &Classes {
|
||||
&self.inner_classes
|
||||
}
|
||||
|
||||
pub fn grow(&self) -> &flex::ItemGrow {
|
||||
&self.item_grow
|
||||
}
|
||||
|
||||
pub fn shrink(&self) -> &flex::ItemShrink {
|
||||
&self.item_shrink
|
||||
}
|
||||
|
||||
pub fn size(&self) -> &flex::ItemSize {
|
||||
&self.item_size
|
||||
}
|
||||
|
||||
pub fn offset(&self) -> &flex::ItemOffset {
|
||||
&self.item_offset
|
||||
}
|
||||
|
||||
pub fn align(&self) -> &flex::ItemAlign {
|
||||
&self.item_align
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ArcComponents {
|
||||
&self.stuff
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
mod form;
|
||||
pub use form::{Form, FormMethod, COMPONENT_FORM};
|
||||
|
||||
mod input;
|
||||
pub use input::{Input, InputType, COMPONENT_INPUT};
|
||||
mod hidden;
|
||||
pub use hidden::{Hidden, COMPONENT_HIDDEN};
|
||||
mod date;
|
||||
pub use date::{Date, COMPONENT_DATE};
|
||||
mod button;
|
||||
pub use button::{Button, ButtonType, COMPONENT_BUTTON};
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_BUTTON);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ButtonType {
|
||||
#[default]
|
||||
Button,
|
||||
Submit,
|
||||
Reset,
|
||||
}
|
||||
|
||||
type ButtonValue = TypedComponent<L10n>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Button {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
classes : Classes,
|
||||
button_type: ButtonType,
|
||||
name : AttributeValue,
|
||||
value : ButtonValue,
|
||||
autofocus : AttributeValue,
|
||||
disabled : AttributeValue,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Button {
|
||||
fn new() -> Self {
|
||||
Button::default().with_classes(ClassesOp::SetDefault, "btn btn-primary form-button")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_BUTTON
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let button_type = match self.button_type() {
|
||||
ButtonType::Button => "button",
|
||||
ButtonType::Submit => "submit",
|
||||
ButtonType::Reset => "reset",
|
||||
};
|
||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
let value = self.value().prepare(cx);
|
||||
PrepareMarkup::With(html! {
|
||||
button
|
||||
type=(button_type)
|
||||
id=[id]
|
||||
class=[self.classes().get()]
|
||||
name=[self.name().get()]
|
||||
value=(value)
|
||||
autofocus=[self.autofocus().get()]
|
||||
disabled=[self.disabled().get()]
|
||||
{
|
||||
(value)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Button {
|
||||
pub fn with(value: L10n) -> Self {
|
||||
Button::new().with_value(value)
|
||||
}
|
||||
|
||||
pub fn submit(value: L10n) -> Self {
|
||||
let mut button = Button::new()
|
||||
.with_classes(ClassesOp::Replace("form-button".to_owned()), "form-submit")
|
||||
.with_value(value);
|
||||
button.button_type = ButtonType::Submit;
|
||||
button
|
||||
}
|
||||
|
||||
pub fn reset(value: L10n) -> Self {
|
||||
let mut button = Button::new()
|
||||
.with_classes(ClassesOp::Replace("form-button".to_owned()), "form-reset")
|
||||
.with_value(value);
|
||||
button.button_type = ButtonType::Reset;
|
||||
button
|
||||
}
|
||||
|
||||
// Button BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: L10n) -> &mut Self {
|
||||
self.value.set(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Button GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn button_type(&self) -> &ButtonType {
|
||||
&self.button_type
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &AttributeValue {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &ButtonValue {
|
||||
&self.value
|
||||
}
|
||||
|
||||
pub fn autofocus(&self) -> &AttributeValue {
|
||||
&self.autofocus
|
||||
}
|
||||
|
||||
pub fn disabled(&self) -> &AttributeValue {
|
||||
&self.disabled
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_DATE);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Date {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
classes : Classes,
|
||||
name : AttributeValue,
|
||||
value : AttributeValue,
|
||||
label : AttributeValue,
|
||||
placeholder : AttributeValue,
|
||||
autofocus : AttributeValue,
|
||||
autocomplete: AttributeValue,
|
||||
disabled : AttributeValue,
|
||||
readonly : AttributeValue,
|
||||
required : AttributeValue,
|
||||
help_text : AttributeValue,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Date {
|
||||
fn new() -> Self {
|
||||
Date::default().with_classes(ClassesOp::SetDefault, "form-item form-type-date")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_DATE
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
PrepareMarkup::With(html! {
|
||||
div class=[self.classes().get()] {
|
||||
@if let Some(label) = self.label().get() {
|
||||
label class="form-label" for=[&id] {
|
||||
(label) " "
|
||||
@if self.required().get().is_some() {
|
||||
span
|
||||
class="form-required"
|
||||
title="Este campo es obligatorio." { "*" } " "
|
||||
}
|
||||
}
|
||||
}
|
||||
input
|
||||
type="date"
|
||||
id=[id]
|
||||
class="form-control"
|
||||
name=[self.name().get()]
|
||||
value=[self.value().get()]
|
||||
placeholder=[self.placeholder().get()]
|
||||
autofocus=[self.autofocus().get()]
|
||||
autocomplete=[self.autocomplete().get()]
|
||||
readonly=[self.readonly().get()]
|
||||
required=[self.required().get()]
|
||||
disabled=[self.disabled().get()] {}
|
||||
@if let Some(help_text) = self.help_text().get() {
|
||||
div class="form-text" { (help_text) }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Date {
|
||||
// Date BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_label(&mut self, label: &str) -> &mut Self {
|
||||
self.label.alter_value(label);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_placeholder(&mut self, placeholder: &str) -> &mut Self {
|
||||
self.placeholder.alter_value(placeholder);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_autocomplete(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autocomplete.alter_value(match toggle {
|
||||
true => "",
|
||||
false => "off",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_readonly(&mut self, toggle: bool) -> &mut Self {
|
||||
self.readonly.alter_value(match toggle {
|
||||
true => "readonly",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_required(&mut self, toggle: bool) -> &mut Self {
|
||||
self.required.alter_value(match toggle {
|
||||
true => "required",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_help_text(&mut self, help_text: &str) -> &mut Self {
|
||||
self.help_text.alter_value(help_text);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Date GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &AttributeValue {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &AttributeValue {
|
||||
&self.value
|
||||
}
|
||||
|
||||
pub fn label(&self) -> &AttributeValue {
|
||||
&self.label
|
||||
}
|
||||
|
||||
pub fn placeholder(&self) -> &AttributeValue {
|
||||
&self.placeholder
|
||||
}
|
||||
|
||||
pub fn autofocus(&self) -> &AttributeValue {
|
||||
&self.autofocus
|
||||
}
|
||||
|
||||
pub fn autocomplete(&self) -> &AttributeValue {
|
||||
&self.autocomplete
|
||||
}
|
||||
|
||||
pub fn disabled(&self) -> &AttributeValue {
|
||||
&self.disabled
|
||||
}
|
||||
|
||||
pub fn readonly(&self) -> &AttributeValue {
|
||||
&self.readonly
|
||||
}
|
||||
|
||||
pub fn required(&self) -> &AttributeValue {
|
||||
&self.required
|
||||
}
|
||||
|
||||
pub fn help_text(&self) -> &AttributeValue {
|
||||
&self.help_text
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_FORM);
|
||||
|
||||
actions_for_component!(Form);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum FormMethod {
|
||||
#[default]
|
||||
Post,
|
||||
Get,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Form {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
action : AttributeValue,
|
||||
charset : AttributeValue,
|
||||
method : FormMethod,
|
||||
stuff : ArcComponents,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Form {
|
||||
fn new() -> Self {
|
||||
Form::default()
|
||||
.with_classes(ClassesOp::SetDefault, "form")
|
||||
.with_charset("UTF-8")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_FORM
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_before_prepare_form(self, cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let method = match self.method() {
|
||||
FormMethod::Post => Some("post".to_owned()),
|
||||
FormMethod::Get => None,
|
||||
};
|
||||
PrepareMarkup::With(html! {
|
||||
form
|
||||
id=[self.id()]
|
||||
class=[self.classes().get()]
|
||||
action=[self.action().get()]
|
||||
method=[method]
|
||||
accept-charset=[self.charset().get()]
|
||||
{
|
||||
div { (self.elements().prepare(cx)) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||
run_actions_after_prepare_form(self, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Form {
|
||||
// Form BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_action(&mut self, action: &str) -> &mut Self {
|
||||
self.action.alter_value(action);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_charset(&mut self, charset: &str) -> &mut Self {
|
||||
self.charset.alter_value(charset);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_method(&mut self, method: FormMethod) -> &mut Self {
|
||||
self.method = method;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_element(mut self, element: impl ComponentTrait) -> Self {
|
||||
self.stuff.alter(ArcOp::Add(ArcComponent::with(element)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_elements(&mut self, op: ArcOp) -> &mut Self {
|
||||
self.stuff.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Form GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn action(&self) -> &AttributeValue {
|
||||
&self.action
|
||||
}
|
||||
|
||||
pub fn charset(&self) -> &AttributeValue {
|
||||
&self.charset
|
||||
}
|
||||
|
||||
pub fn method(&self) -> &FormMethod {
|
||||
&self.method
|
||||
}
|
||||
|
||||
pub fn elements(&self) -> &ArcComponents {
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_HIDDEN);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Hidden {
|
||||
weight: Weight,
|
||||
name : NameValue,
|
||||
value : AttributeValue,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Hidden {
|
||||
fn new() -> Self {
|
||||
Hidden::default()
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_HIDDEN
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
let id = self.name().get().map(|name| concat_string!("value-", name));
|
||||
PrepareMarkup::With(html! {
|
||||
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()] {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Hidden {
|
||||
pub fn set(name: &str, value: &str) -> Self {
|
||||
Hidden::new().with_name(name).with_value(value)
|
||||
}
|
||||
|
||||
// Hidden BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
// Hidden GETTERS.
|
||||
|
||||
pub fn name(&self) -> &NameValue {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &AttributeValue {
|
||||
&self.value
|
||||
}
|
||||
}
|
||||
|
|
@ -1,348 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_INPUT);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum InputType {
|
||||
#[default]
|
||||
Textfield,
|
||||
Password,
|
||||
Search,
|
||||
Email,
|
||||
Telephone,
|
||||
Url,
|
||||
}
|
||||
|
||||
type InputLabel = TypedComponent<L10n>;
|
||||
type InputHelpText = TypedComponent<L10n>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Input {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
classes : Classes,
|
||||
input_type : InputType,
|
||||
name : NameValue,
|
||||
value : AttributeValue,
|
||||
label : InputLabel,
|
||||
size : Option<u16>,
|
||||
minlength : Option<u16>,
|
||||
maxlength : Option<u16>,
|
||||
placeholder : AttributeValue,
|
||||
autofocus : AttributeValue,
|
||||
autocomplete: AttributeValue,
|
||||
disabled : AttributeValue,
|
||||
readonly : AttributeValue,
|
||||
required : AttributeValue,
|
||||
help_text : InputHelpText,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Input {
|
||||
fn new() -> Self {
|
||||
Input::default()
|
||||
.with_classes(ClassesOp::SetDefault, "form-item form-type-textfield")
|
||||
.with_size(Some(60))
|
||||
.with_maxlength(Some(128))
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_INPUT
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let type_input = match self.input_type() {
|
||||
InputType::Textfield => "text",
|
||||
InputType::Password => "password",
|
||||
InputType::Search => "search",
|
||||
InputType::Email => "email",
|
||||
InputType::Telephone => "tel",
|
||||
InputType::Url => "url",
|
||||
};
|
||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
let label = self.label().prepare(cx);
|
||||
let description = self.help_text().prepare(cx);
|
||||
PrepareMarkup::With(html! {
|
||||
div class=[self.classes().get()] {
|
||||
@if !label.is_empty() {
|
||||
label class="form-label" for=[&id] {
|
||||
(label) " "
|
||||
@if self.required().get().is_some() {
|
||||
span
|
||||
class="form-required"
|
||||
title="Este campo es obligatorio." { "*" } " "
|
||||
}
|
||||
}
|
||||
}
|
||||
input
|
||||
type=(type_input)
|
||||
id=[id]
|
||||
class="form-control"
|
||||
name=[self.name().get()]
|
||||
value=[self.value().get()]
|
||||
size=[self.size()]
|
||||
minlength=[self.minlength()]
|
||||
maxlength=[self.maxlength()]
|
||||
placeholder=[self.placeholder().get()]
|
||||
autofocus=[self.autofocus().get()]
|
||||
autocomplete=[self.autocomplete().get()]
|
||||
readonly=[self.readonly().get()]
|
||||
required=[self.required().get()]
|
||||
disabled=[self.disabled().get()] {}
|
||||
@if !description.is_empty() {
|
||||
div class="form-text" { (description) }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Input {
|
||||
pub fn textfield() -> Self {
|
||||
Input::new()
|
||||
}
|
||||
|
||||
pub fn password() -> Self {
|
||||
let mut input = Input::new().with_classes(
|
||||
ClassesOp::Replace("form-type-textfield".to_owned()),
|
||||
"form-type-password",
|
||||
);
|
||||
input.input_type = InputType::Password;
|
||||
input
|
||||
}
|
||||
|
||||
pub fn search() -> Self {
|
||||
let mut input = Input::new().with_classes(
|
||||
ClassesOp::Replace("form-type-textfield".to_owned()),
|
||||
"form-type-search",
|
||||
);
|
||||
input.input_type = InputType::Search;
|
||||
input
|
||||
}
|
||||
|
||||
pub fn email() -> Self {
|
||||
let mut input = Input::new().with_classes(
|
||||
ClassesOp::Replace("form-type-textfield".to_owned()),
|
||||
"form-type-email",
|
||||
);
|
||||
input.input_type = InputType::Email;
|
||||
input
|
||||
}
|
||||
|
||||
pub fn telephone() -> Self {
|
||||
let mut input = Input::new().with_classes(
|
||||
ClassesOp::Replace("form-type-textfield".to_owned()),
|
||||
"form-type-telephone",
|
||||
);
|
||||
input.input_type = InputType::Telephone;
|
||||
input
|
||||
}
|
||||
|
||||
pub fn url() -> Self {
|
||||
let mut input = Input::new().with_classes(
|
||||
ClassesOp::Replace("form-type-textfield".to_owned()),
|
||||
"form-type-url",
|
||||
);
|
||||
input.input_type = InputType::Url;
|
||||
input
|
||||
}
|
||||
|
||||
// Input BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||
if let Some(previous) = self.name.get() {
|
||||
self.alter_classes(ClassesOp::Remove, concat_string!("form-item-", previous));
|
||||
}
|
||||
self.alter_classes(ClassesOp::AddDefault, concat_string!("form-item-", name));
|
||||
self.name.alter_value(name);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_value(&mut self, value: &str) -> &mut Self {
|
||||
self.value.alter_value(value);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_label(&mut self, label: L10n) -> &mut Self {
|
||||
self.label.set(label);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_size(&mut self, size: Option<u16>) -> &mut Self {
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_minlength(&mut self, minlength: Option<u16>) -> &mut Self {
|
||||
self.minlength = minlength;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_maxlength(&mut self, maxlength: Option<u16>) -> &mut Self {
|
||||
self.maxlength = maxlength;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_placeholder(&mut self, placeholder: &str) -> &mut Self {
|
||||
self.placeholder.alter_value(placeholder);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_autofocus(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autofocus.alter_value(match toggle {
|
||||
true => "autofocus",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_autocomplete(&mut self, toggle: bool) -> &mut Self {
|
||||
self.autocomplete.alter_value(match toggle {
|
||||
true => "",
|
||||
false => "off",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_disabled(&mut self, toggle: bool) -> &mut Self {
|
||||
self.disabled.alter_value(match toggle {
|
||||
true => "disabled",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_readonly(&mut self, toggle: bool) -> &mut Self {
|
||||
self.readonly.alter_value(match toggle {
|
||||
true => "readonly",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_required(&mut self, toggle: bool) -> &mut Self {
|
||||
self.required.alter_value(match toggle {
|
||||
true => "required",
|
||||
false => "",
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_help_text(&mut self, help_text: L10n) -> &mut Self {
|
||||
self.help_text.set(help_text);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Input GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn input_type(&self) -> &InputType {
|
||||
&self.input_type
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &NameValue {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &AttributeValue {
|
||||
&self.value
|
||||
}
|
||||
|
||||
pub fn label(&self) -> &InputLabel {
|
||||
&self.label
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Option<u16> {
|
||||
self.size
|
||||
}
|
||||
|
||||
pub fn minlength(&self) -> Option<u16> {
|
||||
self.minlength
|
||||
}
|
||||
|
||||
pub fn maxlength(&self) -> Option<u16> {
|
||||
self.maxlength
|
||||
}
|
||||
|
||||
pub fn placeholder(&self) -> &AttributeValue {
|
||||
&self.placeholder
|
||||
}
|
||||
|
||||
pub fn autofocus(&self) -> &AttributeValue {
|
||||
&self.autofocus
|
||||
}
|
||||
|
||||
pub fn autocomplete(&self) -> &AttributeValue {
|
||||
&self.autocomplete
|
||||
}
|
||||
|
||||
pub fn disabled(&self) -> &AttributeValue {
|
||||
&self.disabled
|
||||
}
|
||||
|
||||
pub fn readonly(&self) -> &AttributeValue {
|
||||
&self.readonly
|
||||
}
|
||||
|
||||
pub fn required(&self) -> &AttributeValue {
|
||||
&self.required
|
||||
}
|
||||
|
||||
pub fn help_text(&self) -> &InputHelpText {
|
||||
&self.help_text
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_HEADING);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum HeadingType {
|
||||
#[default]
|
||||
H1,
|
||||
H2,
|
||||
H3,
|
||||
H4,
|
||||
H5,
|
||||
H6,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum HeadingDisplay {
|
||||
#[default]
|
||||
Normal,
|
||||
XxLarge,
|
||||
Large,
|
||||
Medium,
|
||||
Small,
|
||||
XxSmall,
|
||||
Subtitle,
|
||||
}
|
||||
|
||||
type HeadingText = TypedComponent<L10n>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Heading {
|
||||
weight : Weight,
|
||||
renderable : Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
heading_type: HeadingType,
|
||||
text : HeadingText,
|
||||
display : HeadingDisplay,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Heading {
|
||||
fn new() -> Self {
|
||||
Heading::default()
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_HEADING
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let id = self.id();
|
||||
let classes = self.classes().get();
|
||||
PrepareMarkup::With(html! { @match &self.heading_type() {
|
||||
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||
}})
|
||||
}
|
||||
}
|
||||
|
||||
impl Heading {
|
||||
pub fn h1(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H1)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
pub fn h2(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H2)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
pub fn h3(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H3)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
pub fn h4(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H4)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
pub fn h5(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H5)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
pub fn h6(text: L10n) -> Self {
|
||||
Heading::new()
|
||||
.with_heading_type(HeadingType::H6)
|
||||
.with_text(text)
|
||||
}
|
||||
|
||||
// Heading BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_heading_type(&mut self, heading_type: HeadingType) -> &mut Self {
|
||||
self.heading_type = heading_type;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_text(&mut self, text: L10n) -> &mut Self {
|
||||
self.text.set(text);
|
||||
self
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[fn_builder]
|
||||
pub fn alter_display(&mut self, display: HeadingDisplay) -> &mut Self {
|
||||
self.alter_classes(
|
||||
ClassesOp::SetDefault,
|
||||
match display {
|
||||
HeadingDisplay::XxLarge => "display-2",
|
||||
HeadingDisplay::Large => "display-3",
|
||||
HeadingDisplay::Medium => "display-4",
|
||||
HeadingDisplay::Small => "display-5",
|
||||
HeadingDisplay::XxSmall => "display-6",
|
||||
HeadingDisplay::Normal => "",
|
||||
HeadingDisplay::Subtitle => "",
|
||||
},
|
||||
);
|
||||
self.display = display;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Paragraph GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn heading_type(&self) -> &HeadingType {
|
||||
&self.heading_type
|
||||
}
|
||||
|
||||
pub fn text(&self) -> &HeadingText {
|
||||
&self.text
|
||||
}
|
||||
|
||||
pub fn display(&self) -> &HeadingDisplay {
|
||||
&self.display
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_ICON);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Icon {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
icon_name : String,
|
||||
classes : Classes,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Icon {
|
||||
fn new() -> Self {
|
||||
Icon::default().with_classes(ClassesOp::SetDefault, "bi-question-circle-fill")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_ICON
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
cx.alter(ContextOp::AddStyleSheet(
|
||||
StyleSheet::at("/minimal/icons/bootstrap-icons.css").with_version("1.8.2"),
|
||||
));
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
PrepareMarkup::With(html! { i class=[self.classes().get()] {} })
|
||||
}
|
||||
}
|
||||
|
||||
impl Icon {
|
||||
pub fn with(icon_name: &str) -> Self {
|
||||
Icon::new().with_icon_name(icon_name)
|
||||
}
|
||||
|
||||
// Icon BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_icon_name(&mut self, name: &str) -> &mut Self {
|
||||
self.alter_classes(ClassesOp::SetDefault, concat_string!("bi-", name));
|
||||
self.icon_name = name.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
// Icon GETTERS.
|
||||
|
||||
pub fn icon_name(&self) -> &str {
|
||||
self.icon_name.as_str()
|
||||
}
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_IMAGE);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ImageSize {
|
||||
#[default]
|
||||
Auto,
|
||||
Size(u16, u16),
|
||||
Width(u16),
|
||||
Height(u16),
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Image {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
source : AttributeValue,
|
||||
size : ImageSize,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Image {
|
||||
fn new() -> Self {
|
||||
Image::default().with_classes(ClassesOp::SetDefault, "img-fluid")
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_IMAGE
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||
let (width, height) = match self.size() {
|
||||
ImageSize::Auto => (None, None),
|
||||
ImageSize::Size(width, height) => (Some(width), Some(height)),
|
||||
ImageSize::Width(width) => (Some(width), None),
|
||||
ImageSize::Height(height) => (None, Some(height)),
|
||||
};
|
||||
PrepareMarkup::With(html! {
|
||||
img
|
||||
src=[self.source().get()]
|
||||
id=[self.id()]
|
||||
class=[self.classes().get()]
|
||||
width=[width]
|
||||
height=[height] {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Image {
|
||||
pub fn with(source: &str) -> Self {
|
||||
Image::new().with_source(source)
|
||||
}
|
||||
|
||||
pub fn pagetop() -> Self {
|
||||
Image::new()
|
||||
.with_source("/minimal/pagetop-logo.svg")
|
||||
.with_size(ImageSize::Size(64, 64))
|
||||
}
|
||||
|
||||
// Image BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_source(&mut self, source: &str) -> &mut Self {
|
||||
self.source.alter_value(source);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_size(&mut self, size: ImageSize) -> &mut Self {
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
|
||||
// Image GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn source(&self) -> &AttributeValue {
|
||||
&self.source
|
||||
}
|
||||
|
||||
pub fn size(&self) -> &ImageSize {
|
||||
&self.size
|
||||
}
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
new_handle!(COMPONENT_PARAGRAPH);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ParagraphDisplay {
|
||||
#[default]
|
||||
Normal,
|
||||
XxLarge,
|
||||
Large,
|
||||
Medium,
|
||||
Small,
|
||||
XxSmall,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct Paragraph {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
stuff : ArcComponents,
|
||||
display : ParagraphDisplay,
|
||||
template : String,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Paragraph {
|
||||
fn new() -> Self {
|
||||
Paragraph::default()
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_PARAGRAPH
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
self.id.get()
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
PrepareMarkup::With(html! {
|
||||
p
|
||||
id=[self.id()]
|
||||
class=[self.classes().get()]
|
||||
{
|
||||
(self.components().prepare(cx))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Paragraph {
|
||||
pub fn with(component: impl ComponentTrait) -> Self {
|
||||
Paragraph::new().with_component(component)
|
||||
}
|
||||
|
||||
// Paragraph BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_id(&mut self, id: &str) -> &mut Self {
|
||||
self.id.alter_value(id);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.stuff.alter(ArcOp::Add(ArcComponent::with(component)));
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_components(&mut self, op: ArcOp) -> &mut Self {
|
||||
self.stuff.alter(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[fn_builder]
|
||||
pub fn alter_display(&mut self, display: ParagraphDisplay) -> &mut Self {
|
||||
self.alter_classes(
|
||||
ClassesOp::SetDefault,
|
||||
match display {
|
||||
ParagraphDisplay::XxLarge => "fs-2",
|
||||
ParagraphDisplay::Large => "fs-3",
|
||||
ParagraphDisplay::Medium => "fs-4",
|
||||
ParagraphDisplay::Small => "fs-5",
|
||||
ParagraphDisplay::XxSmall => "fs-6",
|
||||
ParagraphDisplay::Normal => "",
|
||||
},
|
||||
);
|
||||
self.display = display;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_template(&mut self, template: &str) -> &mut Self {
|
||||
self.template = template.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
// Paragraph GETTERS.
|
||||
|
||||
pub fn classes(&self) -> &Classes {
|
||||
&self.classes
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ArcComponents {
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn display(&self) -> &ParagraphDisplay {
|
||||
&self.display
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
self.template.as_str()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::{Minimal, LOCALES_MINIMAL};
|
||||
|
||||
new_handle!(COMPONENT_POWEREDBY);
|
||||
|
||||
#[derive(Default, Eq, PartialEq)]
|
||||
pub enum PoweredByLogo {
|
||||
#[default]
|
||||
None,
|
||||
Color,
|
||||
LineDark,
|
||||
LineLight,
|
||||
LineRGB(u8, u8, u8),
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub struct PoweredBy {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
copyright : Option<String>,
|
||||
logo : PoweredByLogo,
|
||||
}
|
||||
|
||||
impl ComponentTrait for PoweredBy {
|
||||
fn new() -> Self {
|
||||
let year = Utc::now().format("%Y").to_string();
|
||||
let c = concat_string!(year, " © ", config::SETTINGS.app.name);
|
||||
PoweredBy {
|
||||
copyright: Some(c),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_POWEREDBY
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
Some("powered-by".to_owned())
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
Minimal.load_assets(cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let logo = match self.logo() {
|
||||
PoweredByLogo::Color => {
|
||||
let logo_txt = L10n::t("pagetop_logo", &LOCALES_MINIMAL);
|
||||
html! {
|
||||
span class="pagetop-logo" aria-label=[logo_txt.into_string(cx)] {
|
||||
img src="/minimal/pagetop-logo.svg" alt=[logo_txt.into_string(cx)] {}
|
||||
}
|
||||
}
|
||||
}
|
||||
PoweredByLogo::LineDark => self.logo_line(10, 11, 9, cx),
|
||||
PoweredByLogo::LineLight => self.logo_line(255, 255, 255, cx),
|
||||
PoweredByLogo::LineRGB(r, g, b) => self.logo_line(*r, *g, *b, cx),
|
||||
_ => html! {},
|
||||
};
|
||||
|
||||
let mut credits = L10n::e("poweredby_pagetop", &LOCALES_MINIMAL).with_arg(
|
||||
"pagetop_link",
|
||||
"<a href=\"https://crates.io/crates/pagetop\">PageTop</a>",
|
||||
);
|
||||
|
||||
PrepareMarkup::With(html! {
|
||||
div id=[self.id()] {
|
||||
@if let Some(c) = self.copyright() {
|
||||
span class="copyright" { (c) "." } " "
|
||||
}
|
||||
span class="powered" { (credits.prepare(cx)) " " (logo) }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl PoweredBy {
|
||||
// PoweredBy BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_copyright(&mut self, copyright: Option<impl Into<String>>) -> &mut Self {
|
||||
self.copyright = copyright.map(|c| c.into());
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_logo(&mut self, logo: PoweredByLogo) -> &mut Self {
|
||||
self.logo = logo;
|
||||
self
|
||||
}
|
||||
|
||||
// PoweredBy GETTERS.
|
||||
|
||||
pub fn copyright(&self) -> &Option<String> {
|
||||
&self.copyright
|
||||
}
|
||||
|
||||
pub fn logo(&self) -> &PoweredByLogo {
|
||||
&self.logo
|
||||
}
|
||||
|
||||
// PoweredBy PRIVATE.
|
||||
|
||||
fn logo_line(&self, r: u8, g: u8, b: u8, cx: &mut Context) -> Markup {
|
||||
let logo_txt = L10n::t("pagetop_logo", &LOCALES_MINIMAL);
|
||||
let logo_rgb = format!("rgb({},{},{})", r, g, b);
|
||||
html! {
|
||||
span class="pagetop-logo" aria-label=[logo_txt.into_string(cx)] {
|
||||
svg viewBox="0 0 1614 1614" xmlns="http://www.w3.org/2000/svg" role="img" {
|
||||
path fill=(logo_rgb) d="M 1573,357 L 1415,357 C 1400,357 1388,369 1388,383 L 1388,410 1335,410 1335,357 C 1335,167 1181,13 992,13 L 621,13 C 432,13 278,167 278,357 L 278,410 225,410 225,383 C 225,369 213,357 198,357 L 40,357 C 25,357 13,369 13,383 L 13,648 C 13,662 25,674 40,674 L 198,674 C 213,674 225,662 225,648 L 225,621 278,621 278,1256 C 278,1446 432,1600 621,1600 L 992,1600 C 1181,1600 1335,1446 1335,1256 L 1335,621 1388,621 1388,648 C 1388,662 1400,674 1415,674 L 1573,674 C 1588,674 1600,662 1600,648 L 1600,383 C 1600,369 1588,357 1573,357 L 1573,357 1573,357 Z M 66,410 L 172,410 172,621 66,621 66,410 66,410 Z M 1282,357 L 1282,488 C 1247,485 1213,477 1181,464 L 1196,437 C 1203,425 1199,409 1186,401 1174,394 1158,398 1150,411 L 1133,440 C 1105,423 1079,401 1056,376 L 1075,361 C 1087,352 1089,335 1079,324 1070,313 1054,311 1042,320 L 1023,335 C 1000,301 981,263 967,221 L 1011,196 C 1023,189 1028,172 1021,160 1013,147 997,143 984,150 L 953,168 C 945,136 941,102 940,66 L 992,66 C 1152,66 1282,197 1282,357 L 1282,357 1282,357 Z M 621,66 L 674,66 674,225 648,225 C 633,225 621,237 621,251 621,266 633,278 648,278 L 674,278 674,357 648,357 C 633,357 621,369 621,383 621,398 633,410 648,410 L 674,410 674,489 648,489 C 633,489 621,501 621,516 621,530 633,542 648,542 L 664,542 C 651,582 626,623 600,662 583,653 563,648 542,648 469,648 410,707 410,780 410,787 411,794 412,801 388,805 361,806 331,806 L 331,357 C 331,197 461,66 621,66 L 621,66 621,66 Z M 621,780 C 621,824 586,859 542,859 498,859 463,824 463,780 463,736 498,701 542,701 586,701 621,736 621,780 L 621,780 621,780 Z M 225,463 L 278,463 278,569 225,569 225,463 225,463 Z M 992,1547 L 621,1547 C 461,1547 331,1416 331,1256 L 331,859 C 367,859 400,858 431,851 454,888 495,912 542,912 615,912 674,853 674,780 674,747 662,718 642,695 675,645 706,594 720,542 L 780,542 C 795,542 807,530 807,516 807,501 795,489 780,489 L 727,489 727,410 780,410 C 795,410 807,398 807,383 807,369 795,357 780,357 L 727,357 727,278 780,278 C 795,278 807,266 807,251 807,237 795,225 780,225 L 727,225 727,66 887,66 C 889,111 895,155 905,196 L 869,217 C 856,224 852,240 859,253 864,261 873,266 882,266 887,266 891,265 895,263 L 921,248 C 937,291 958,331 983,367 L 938,403 C 926,412 925,429 934,440 939,447 947,450 954,450 960,450 966,448 971,444 L 1016,408 C 1043,438 1074,465 1108,485 L 1084,527 C 1076,539 1081,555 1093,563 1098,565 1102,566 1107,566 1116,566 1125,561 1129,553 L 1155,509 C 1194,527 1237,538 1282,541 L 1282,1256 C 1282,1416 1152,1547 992,1547 L 992,1547 992,1547 Z M 1335,463 L 1388,463 1388,569 1335,569 1335,463 1335,463 Z M 1441,410 L 1547,410 1547,621 1441,621 1441,410 1441,410 Z" {}
|
||||
path fill=(logo_rgb) d="M 1150,1018 L 463,1018 C 448,1018 436,1030 436,1044 L 436,1177 C 436,1348 545,1468 701,1468 L 912,1468 C 1068,1468 1177,1348 1177,1177 L 1177,1044 C 1177,1030 1165,1018 1150,1018 L 1150,1018 1150,1018 Z M 912,1071 L 1018,1071 1018,1124 912,1124 912,1071 912,1071 Z M 489,1071 L 542,1071 542,1124 489,1124 489,1071 489,1071 Z M 701,1415 L 700,1415 C 701,1385 704,1352 718,1343 731,1335 759,1341 795,1359 802,1363 811,1363 818,1359 854,1341 882,1335 895,1343 909,1352 912,1385 913,1415 L 912,1415 701,1415 701,1415 701,1415 Z M 1124,1177 C 1124,1296 1061,1384 966,1408 964,1365 958,1320 922,1298 894,1281 856,1283 807,1306 757,1283 719,1281 691,1298 655,1320 649,1365 647,1408 552,1384 489,1296 489,1177 L 569,1177 C 583,1177 595,1165 595,1150 L 595,1071 859,1071 859,1150 C 859,1165 871,1177 886,1177 L 1044,1177 C 1059,1177 1071,1165 1071,1150 L 1071,1071 1124,1071 1124,1177 1124,1177 1124,1177 Z" {}
|
||||
path fill=(logo_rgb) d="M 1071,648 C 998,648 939,707 939,780 939,853 998,912 1071,912 1144,912 1203,853 1203,780 1203,707 1144,648 1071,648 L 1071,648 1071,648 Z M 1071,859 C 1027,859 992,824 992,780 992,736 1027,701 1071,701 1115,701 1150,736 1150,780 1150,824 1115,859 1071,859 L 1071,859 1071,859 Z" {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::component::Image;
|
||||
use crate::Minimal;
|
||||
use crate::LOCALES_MINIMAL;
|
||||
|
||||
new_handle!(COMPONENT_BRANDING);
|
||||
|
||||
type SiteSlogan = TypedComponent<L10n>;
|
||||
type SiteLogo = TypedComponent<Image>;
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub struct SiteBranding {
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
name : String,
|
||||
slogan : SiteSlogan,
|
||||
logo : SiteLogo,
|
||||
frontpage : FnContextualPath,
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl Default for SiteBranding {
|
||||
fn default() -> Self {
|
||||
SiteBranding {
|
||||
weight : Weight::default(),
|
||||
renderable: Renderable::default(),
|
||||
name : config::SETTINGS.app.name.to_owned(),
|
||||
slogan : SiteSlogan::default(),
|
||||
logo : SiteLogo::default(),
|
||||
frontpage : |_| "/",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ComponentTrait for SiteBranding {
|
||||
fn new() -> Self {
|
||||
SiteBranding::default()
|
||||
}
|
||||
|
||||
fn handle(&self) -> Handle {
|
||||
COMPONENT_BRANDING
|
||||
}
|
||||
|
||||
fn id(&self) -> Option<String> {
|
||||
Some("site-branding".to_owned())
|
||||
}
|
||||
|
||||
fn weight(&self) -> Weight {
|
||||
self.weight
|
||||
}
|
||||
|
||||
fn is_renderable(&self, cx: &Context) -> bool {
|
||||
(self.renderable.check)(cx)
|
||||
}
|
||||
|
||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||
Minimal.load_assets(cx);
|
||||
}
|
||||
|
||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||
let title = L10n::t("site_home", &LOCALES_MINIMAL).prepare(cx);
|
||||
let slogan = self.slogan().prepare(cx);
|
||||
PrepareMarkup::With(html! {
|
||||
div id=[self.id()] {
|
||||
div class="site-branding-wrapper" {
|
||||
div class="site-branding-logo" {
|
||||
(self.logo().prepare(cx))
|
||||
}
|
||||
div class="site-branding-text" {
|
||||
div class="site-branding-name" {
|
||||
a href=(self.frontpage()(cx)) title=(title) rel="home" { (self.name()) }
|
||||
}
|
||||
@if !slogan.is_empty() {
|
||||
div class="site-branding-slogan" {
|
||||
(slogan)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl SiteBranding {
|
||||
// SiteBranding BUILDER.
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_weight(&mut self, value: Weight) -> &mut Self {
|
||||
self.weight = value;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
|
||||
self.renderable.check = check;
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_name(&mut self, name: impl Into<String>) -> &mut Self {
|
||||
self.name = name.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_slogan(&mut self, slogan: L10n) -> &mut Self {
|
||||
self.slogan = SiteSlogan::with(slogan);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_logo(&mut self, logo: Image) -> &mut Self {
|
||||
self.logo.set(logo);
|
||||
self
|
||||
}
|
||||
|
||||
#[fn_builder]
|
||||
pub fn alter_frontpage(&mut self, frontpage: FnContextualPath) -> &mut Self {
|
||||
self.frontpage = frontpage;
|
||||
self
|
||||
}
|
||||
|
||||
// SiteBranding GETTERS.
|
||||
|
||||
pub fn name(&self) -> &String {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn slogan(&self) -> &SiteSlogan {
|
||||
&self.slogan
|
||||
}
|
||||
|
||||
pub fn logo(&self) -> &SiteLogo {
|
||||
&self.logo
|
||||
}
|
||||
|
||||
pub fn frontpage(&self) -> &FnContextualPath {
|
||||
&self.frontpage
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
pub mod component;
|
||||
|
||||
new_handle!(MODULE_MINIMAL);
|
||||
|
||||
static_locales!(LOCALES_MINIMAL);
|
||||
|
||||
static_files!(minimal);
|
||||
|
||||
// Library version.
|
||||
const VERSION_MINIMAL: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
// Context parameter.
|
||||
const PARAM_MINIMAL_FLEX: &str = "minimal.flex";
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
pub enum BreakPoint {
|
||||
#[default]
|
||||
None, /* Does not apply */
|
||||
SM, /* @media screen and (max-width: 35.5em) - Applies <= 568px */
|
||||
MD, /* @media screen and (max-width: 48em) - Applies <= 768px */
|
||||
LG, /* @media screen and (max-width: 64em) - Applies <= 1024px */
|
||||
XL, /* @media screen and (max-width: 80em) - Applies <= 1280px */
|
||||
X2L, /* @media screen and (max-width: 120em) - Applies <= 1920px */
|
||||
X3L, /* @media screen and (max-width: 160em) - Applies <= 2560px */
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
impl ToString for BreakPoint {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
BreakPoint::None => "bp-no".to_string(),
|
||||
BreakPoint::SM => "bp-sm".to_string(),
|
||||
BreakPoint::MD => "bp-md".to_string(),
|
||||
BreakPoint::LG => "bp-lg".to_string(),
|
||||
BreakPoint::XL => "bp-xl".to_string(),
|
||||
BreakPoint::X2L => "bp-x2l".to_string(),
|
||||
BreakPoint::X3L => "bp-x3l".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Minimal;
|
||||
|
||||
impl ModuleTrait for Minimal {
|
||||
fn handle(&self) -> Handle {
|
||||
MODULE_MINIMAL
|
||||
}
|
||||
|
||||
fn name(&self) -> L10n {
|
||||
L10n::t("module_name", &LOCALES_MINIMAL)
|
||||
}
|
||||
|
||||
fn description(&self) -> L10n {
|
||||
L10n::t("module_description", &LOCALES_MINIMAL)
|
||||
}
|
||||
|
||||
fn actions(&self) -> Vec<Action> {
|
||||
actions![ActionAfterPrepareBody::with(after_prepare_body).with_weight(99)]
|
||||
}
|
||||
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
static_files_service!(scfg, "/minimal", minimal);
|
||||
}
|
||||
}
|
||||
|
||||
impl Minimal {
|
||||
pub(crate) fn load_assets(&self, cx: &mut Context) -> &Self {
|
||||
cx.set_param::<bool>(PARAM_MINIMAL_ASSETS, true);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn after_prepare_body(page: &mut Page) {
|
||||
if let Some(true) = page.context().get_param::<bool>(PARAM_MINIMAL_ASSETS) {
|
||||
page.context().alter(ContextOp::AddStyleSheet(
|
||||
StyleSheet::at("/minimal/css/minimal.css").with_version(VERSION_MINIMAL),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
module_name = Minimal components
|
||||
module_description = Minimal set of components for page composition.
|
||||
|
||||
# SiteBranding component.
|
||||
site_home = Home
|
||||
|
||||
# PoweredBy component.
|
||||
poweredby_pagetop = Powered by {$pagetop_link}
|
||||
pagetop_logo = PageTop logo
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
module_name = Componentes Minimal
|
||||
module_description = Conjunto mínimo de componentes para la composición de páginas.
|
||||
|
||||
# SiteBranding component.
|
||||
site_home = Inicio
|
||||
|
||||
# PoweredBy component.
|
||||
poweredby_pagetop = Funciona con {$pagetop_link}
|
||||
pagetop_logo = Logotipo de PageTop
|
||||
|
|
@ -1,361 +0,0 @@
|
|||
/* CONTAINERS */
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
position: relative;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
.flex-row,
|
||||
.flex-col.bp-no {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-row.flex-reverse,
|
||||
.flex-col.flex-reverse.bp-no {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col,
|
||||
.flex.row.bp-no {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-col.flex-reverse,
|
||||
.flex-row.flex-reverse.bp-no {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.flex-container.flex-wrap {
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.flex-container.flex-wrap-reverse {
|
||||
flex-wrap: wrap-reverse;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
.flex-container.flex-align-end {
|
||||
align-content: flex-end;
|
||||
}
|
||||
.flex-container.flex-align-center {
|
||||
align-content: center;
|
||||
}
|
||||
.flex-container.flex-align-stretch {
|
||||
align-content: stretch;
|
||||
}
|
||||
.flex-container.flex-align-space-between {
|
||||
align-content: space-between;
|
||||
}
|
||||
.flex-container.flex-align-space-around {
|
||||
align-content: space-around;
|
||||
}
|
||||
|
||||
.flex-container.flex-justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.flex-container.flex-justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.flex-container.flex-justify-space-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-container.flex-justify-space-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.flex-container.flex-justify-space-evenly {
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.flex-container.flex-item-bottom {
|
||||
align-items: flex-end;
|
||||
}
|
||||
.flex-container.flex-item-middle {
|
||||
align-items: center;
|
||||
}
|
||||
.flex-container.flex-item-stretch {
|
||||
align-items: stretch;
|
||||
}
|
||||
.flex-container.flex-item-baseline {
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
/* ITEMS */
|
||||
|
||||
.flex-item {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.flex-item.flex-grow-1 {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.flex-item.flex-grow-2 {
|
||||
flex-grow: 2;
|
||||
}
|
||||
.flex-item.flex-grow-3 {
|
||||
flex-grow: 3;
|
||||
}
|
||||
.flex-item.flex-grow-4 {
|
||||
flex-grow: 4;
|
||||
}
|
||||
.flex-item.flex-grow-5 {
|
||||
flex-grow: 5;
|
||||
}
|
||||
.flex-item.flex-grow-6 {
|
||||
flex-grow: 6;
|
||||
}
|
||||
.flex-item.flex-grow-7 {
|
||||
flex-grow: 7;
|
||||
}
|
||||
.flex-item.flex-grow-8 {
|
||||
flex-grow: 8;
|
||||
}
|
||||
.flex-item.flex-grow-9 {
|
||||
flex-grow: 9;
|
||||
}
|
||||
|
||||
.flex-item.flex-shrink-1 {
|
||||
flex-shrink: 1;
|
||||
}
|
||||
.flex-item.flex-shrink-2 {
|
||||
flex-shrink: 2;
|
||||
}
|
||||
.flex-item.flex-shrink-3 {
|
||||
flex-shrink: 3;
|
||||
}
|
||||
.flex-item.flex-shrink-4 {
|
||||
flex-shrink: 4;
|
||||
}
|
||||
.flex-item.flex-shrink-5 {
|
||||
flex-shrink: 5;
|
||||
}
|
||||
.flex-item.flex-shrink-6 {
|
||||
flex-shrink: 6;
|
||||
}
|
||||
.flex-item.flex-shrink-7 {
|
||||
flex-shrink: 7;
|
||||
}
|
||||
.flex-item.flex-shrink-8 {
|
||||
flex-shrink: 8;
|
||||
}
|
||||
.flex-item.flex-shrink-9 {
|
||||
flex-shrink: 9;
|
||||
}
|
||||
|
||||
.flex-item.flex-width-10 {
|
||||
flex: 0 0 10%;
|
||||
max-width: 10%;
|
||||
}
|
||||
.flex-item.flex-width-20 {
|
||||
flex: 0 0 20%;
|
||||
max-width: 20%;
|
||||
}
|
||||
.flex-item.flex-width-25 {
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
.flex-item.flex-width-33 {
|
||||
flex: 0 0 33.3333%;
|
||||
max-width: 33.3333%;
|
||||
}
|
||||
.flex-item.flex-width-40 {
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
}
|
||||
.flex-item.flex-width-50 {
|
||||
flex: 0 0 60%;
|
||||
max-width: 50%;
|
||||
}
|
||||
.flex-item.flex-width-60 {
|
||||
flex: 0 0 60%;
|
||||
max-width: 60%;
|
||||
}
|
||||
.flex-item.flex-width-66 {
|
||||
flex: 0 0 66.6666%;
|
||||
max-width: 66.6666%;
|
||||
}
|
||||
.flex-item.flex-width-75 {
|
||||
flex: 0 0 75%;
|
||||
max-width: 75%;
|
||||
}
|
||||
.flex-item.flex-width-80 {
|
||||
flex: 0 0 80%;
|
||||
max-width: 80%;
|
||||
}
|
||||
.flex-item.flex-width-90 {
|
||||
flex: 0 0 90%;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.flex-item.flex-offset-10 {
|
||||
margin-left: 10%;
|
||||
}
|
||||
.flex-item.flex-offset-20 {
|
||||
margin-left: 20%;
|
||||
}
|
||||
.flex-item.flex-offset-25 {
|
||||
margin-left: 25%;
|
||||
}
|
||||
.flex-item.flex-offset-33 {
|
||||
margin-left: 33.3333%;
|
||||
}
|
||||
.flex-item.flex-offset-40 {
|
||||
margin-left: 40%;
|
||||
}
|
||||
.flex-item.flex-offset-50 {
|
||||
margin-left: 50%;
|
||||
}
|
||||
.flex-item.flex-offset-60 {
|
||||
margin-left: 60%;
|
||||
}
|
||||
.flex-item.flex-offset-66 {
|
||||
margin-left: 66.6666%;
|
||||
}
|
||||
.flex-item.flex-offset-75 {
|
||||
margin-left: 75%;
|
||||
}
|
||||
.flex-item.flex-offset-80 {
|
||||
margin-left: 80%;
|
||||
}
|
||||
.flex-item.flex-offset-90 {
|
||||
margin-left: 90%;
|
||||
}
|
||||
|
||||
.flex-item.flex-item-top {
|
||||
align-self: flex-start;
|
||||
}
|
||||
.flex-item.flex-item-bottom {
|
||||
align-self: flex-end;
|
||||
}
|
||||
.flex-item.flex-item-middle {
|
||||
align-self: center;
|
||||
}
|
||||
.flex-item.flex-item-stretch {
|
||||
align-self: stretch;
|
||||
}
|
||||
.flex-item.flex-item-baseline {
|
||||
align-self: baseline;
|
||||
}
|
||||
|
||||
/* BREAKPOINTS */
|
||||
|
||||
/* SM - Applies <= 568px */
|
||||
@media screen and (max-width: 35.5em) {
|
||||
.flex-row.bp-sm {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-sm {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-sm {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-sm {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-sm .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
/* MD - Applies <= 768px */
|
||||
@media screen and (max-width: 48em) {
|
||||
.flex-row.bp-md {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-md {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-md {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-md {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-md .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
/* LG - Applies <= 1024px */
|
||||
@media screen and (max-width: 64em) {
|
||||
.flex-row.bp-lg {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-lg {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-lg {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-lg {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-lg .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
/* XL - Applies <= 1280px */
|
||||
@media screen and (max-width: 80em) {
|
||||
.flex-row.bp-xl {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-xl {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-xl {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-xl {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-xl .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
/* X2L - Applies <= 1920px */
|
||||
@media screen and (max-width: 120em) {
|
||||
.flex-row.bp-x2l {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-x2l {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-x2l {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-x2l {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-x2l .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
/* X3L - Applies <= 2560px */
|
||||
@media screen and (max-width: 160em) {
|
||||
.flex-row.bp-x3l {
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex-row.flex-reverse.bp-x3l {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.flex-col.bp-x3l {
|
||||
flex-direction: column;
|
||||
}
|
||||
.flex-col.flex-reverse.bp-x3l {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.flex-col.bp-x3l .flex-item {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/* Flex components */
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.flex {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
/* Grid components */
|
||||
.row .row {
|
||||
margin: 0 -1.5em;
|
||||
}
|
||||
.col {
|
||||
padding: 0 1.5em;
|
||||
}
|
||||
.row:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
@media only screen {
|
||||
.col {
|
||||
float: left;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
/* SiteBranding component */ /*
|
||||
#site-branding {
|
||||
float: left;
|
||||
}
|
||||
.site-branding-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
.site-branding-logo {
|
||||
display: none;
|
||||
}
|
||||
.site-branding-text {
|
||||
display: inline-block;
|
||||
margin: 10px 0 0 10px;
|
||||
}
|
||||
.site-branding-slogan {
|
||||
display: none;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
#site-branding {
|
||||
display: inline-block;
|
||||
}
|
||||
.site-branding-logo {
|
||||
display: inline-block;
|
||||
margin: 10px 0 0 10px;
|
||||
}
|
||||
.site-branding-text {
|
||||
position: absolute;
|
||||
width: max-content;
|
||||
bottom: 0;
|
||||
}
|
||||
.site-branding-slogan {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* PoweredBy component */
|
||||
#powered-by {
|
||||
text-align: center;
|
||||
}
|
||||
#powered-by .pagetop-logo img,
|
||||
#powered-by .pagetop-logo svg {
|
||||
margin-left: .275em;
|
||||
height: 1.275em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
1705
pagetop-minimal/static/icons/bootstrap-icons.css
vendored
1705
pagetop-minimal/static/icons/bootstrap-icons.css
vendored
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
|
|
@ -1,14 +0,0 @@
|
|||
<svg width="16.14mm" height="16.14mm" viewBox="0 0 1614 1614" xmlns="http://www.w3.org/2000/svg" aria-label="PageTop Logo" role="img">
|
||||
<path fill="rgb(255,184,75)" d="M 633,61 L 633,61 C 579,61 527,75 480,102 433,129 395,167 368,214 341,261 327,313 327,367 L 327,1244 327,1245 C 327,1299 341,1351 368,1398 395,1445 433,1483 480,1510 527,1537 579,1551 633,1551 L 982,1550 982,1551 C 1036,1551 1088,1537 1135,1510 1182,1483 1220,1445 1247,1398 1274,1351 1288,1299 1288,1245 L 1288,367 1288,367 1288,367 C 1288,313 1274,261 1247,214 1220,167 1182,129 1135,102 1088,75 1036,61 982,61 L 633,61 Z" />
|
||||
<path fill="rgb(158,96,0)" d="M 1389,573 L 1328,573 1328,460 1449,460 1449,573 1389,573 Z M 1491,627 L 1430,627 1430,404 1551,404 1551,627 1491,627 Z M 222,573 L 161,573 161,460 282,460 282,573 222,573 Z M 120,627 L 59,627 59,404 180,404 180,627 120,627 Z" />
|
||||
<path fill="rgb(150,0,184)" d="M 678,1040 L 678,1040 C 645,1040 612,1049 583,1065 554,1082 530,1106 513,1135 497,1164 488,1197 488,1230 L 488,1230 488,1230 C 488,1263 497,1296 513,1325 530,1354 554,1378 583,1395 612,1411 645,1420 678,1420 L 940,1420 940,1420 C 973,1420 1006,1411 1035,1395 1064,1378 1088,1354 1105,1325 1121,1296 1130,1263 1130,1230 L 1130,1230 1130,1230 1130,1230 C 1130,1197 1121,1164 1105,1135 1088,1106 1064,1082 1035,1065 1006,1049 973,1040 940,1040 L 678,1040 Z M 488,1040 L 488,1040 488,1040 488,1040 488,1040 488,1040 488,1238 488,1238 488,1238 488,1238 488,1238 1130,1238 1130,1238 1130,1238 1130,1238 1130,1238 1130,1238 1130,1040 1130,1040 1130,1040 1130,1040 1130,1040 488,1040 Z" />
|
||||
<path fill="rgb(255,255,255)" d="M 518,1128 L 488,1128 488,1066 547,1066 547,1128 518,1128 Z M 966,1128 L 908,1128 908,1066 1024,1066 1024,1128 966,1128 Z" />
|
||||
<path fill="rgb(221,255,149)" d="M 898,71 C 940,48 987,36 1035,36 1086,36 1137,50 1181,77 1226,104 1263,142 1289,189 1314,236 1328,288 1328,342 1328,396 1314,448 1289,495 1281,509 1272,522 1262,535 L 898,71 Z M 1337,429 C 1307,460 1272,480 1233,488 1192,496 1148,490 1107,470 1066,451 1029,418 999,375 969,332 948,281 938,227 927,173 928,117 940,66 943,51 948,36 953,22 L 1337,429 Z" />
|
||||
<path fill="rgb(146,128,99)" d="M 703,99 C 717,121 722,149 719,178 715,208 702,238 682,267 661,295 634,320 602,340 571,360 536,373 501,379 467,385 434,383 405,373 377,363 355,346 341,323 327,301 322,273 325,244 329,214 342,184 362,155 383,127 410,102 442,82 473,62 508,49 543,43 577,37 610,39 639,49 667,59 689,76 703,99 L 703,99 Z" />
|
||||
<path fill="rgb(146,128,99)" d="M 672,550 C 683,568 685,590 678,615 671,640 655,668 632,694 609,720 580,745 547,765 514,785 479,801 446,810 412,819 381,821 355,816 329,811 310,799 299,782 288,765 286,742 293,717 301,692 316,665 339,638 362,612 391,588 424,567 457,547 492,531 526,523 559,514 591,511 616,516 642,521 661,533 672,550 L 672,550 Z" />
|
||||
<path fill="rgb(146,128,99)" d="M 455,160 L 456,160 C 430,160 404,167 381,180 359,193 340,212 327,234 314,257 307,283 307,309 L 307,580 307,580 C 307,606 314,632 327,655 340,677 359,696 381,709 404,722 430,729 456,729 L 529,729 529,729 C 555,729 581,722 604,709 626,696 645,677 658,655 671,632 678,606 678,580 L 677,308 678,309 678,309 C 678,283 671,257 658,234 645,212 626,193 604,180 581,167 555,160 529,160 L 455,160 Z" />
|
||||
<path fill="rgb(240,0,0)" d="M 698,1332 L 699,1332 C 696,1332 694,1333 691,1334 689,1335 687,1337 686,1339 685,1342 684,1344 684,1347 L 684,1405 684,1405 C 684,1408 685,1410 686,1413 687,1415 689,1417 691,1418 694,1419 696,1420 699,1420 L 914,1419 914,1420 C 917,1420 919,1419 922,1418 924,1417 926,1415 927,1413 928,1410 929,1408 929,1405 L 929,1346 929,1347 929,1347 C 929,1344 928,1342 927,1339 926,1337 924,1335 922,1334 919,1333 917,1332 914,1332 L 698,1332 Z M 643,780 C 643,797 638,814 630,830 621,845 608,858 593,867 577,875 560,880 543,880 525,880 508,875 492,867 477,858 464,845 455,830 447,814 442,797 442,780 442,762 447,745 455,729 464,714 477,701 492,692 508,684 525,679 542,679 560,679 577,684 593,692 608,701 621,714 630,729 638,745 643,762 643,779 L 643,780 Z M 1171,780 C 1171,797 1166,814 1158,830 1149,845 1136,858 1121,867 1105,875 1088,880 1071,880 1053,880 1036,875 1020,867 1005,858 992,845 983,830 975,814 970,797 970,780 970,762 975,745 983,729 992,714 1005,701 1020,692 1036,684 1053,679 1071,679 1088,679 1105,684 1121,692 1136,701 1149,714 1158,729 1166,745 1171,762 1171,779 L 1171,780 Z" />
|
||||
<path fill="rgb(10,11,9)" d="M 1573,357 L 1415,357 C 1400,357 1388,369 1388,383 L 1388,410 1335,410 1335,357 C 1335,167 1181,13 992,13 L 621,13 C 432,13 278,167 278,357 L 278,410 225,410 225,383 C 225,369 213,357 198,357 L 40,357 C 25,357 13,369 13,383 L 13,648 C 13,662 25,674 40,674 L 198,674 C 213,674 225,662 225,648 L 225,621 278,621 278,1256 C 278,1446 432,1600 621,1600 L 992,1600 C 1181,1600 1335,1446 1335,1256 L 1335,621 1388,621 1388,648 C 1388,662 1400,674 1415,674 L 1573,674 C 1588,674 1600,662 1600,648 L 1600,383 C 1600,369 1588,357 1573,357 L 1573,357 1573,357 Z M 66,410 L 172,410 172,621 66,621 66,410 66,410 Z M 1282,357 L 1282,488 C 1247,485 1213,477 1181,464 L 1196,437 C 1203,425 1199,409 1186,401 1174,394 1158,398 1150,411 L 1133,440 C 1105,423 1079,401 1056,376 L 1075,361 C 1087,352 1089,335 1079,324 1070,313 1054,311 1042,320 L 1023,335 C 1000,301 981,263 967,221 L 1011,196 C 1023,189 1028,172 1021,160 1013,147 997,143 984,150 L 953,168 C 945,136 941,102 940,66 L 992,66 C 1152,66 1282,197 1282,357 L 1282,357 1282,357 Z M 621,66 L 674,66 674,225 648,225 C 633,225 621,237 621,251 621,266 633,278 648,278 L 674,278 674,357 648,357 C 633,357 621,369 621,383 621,398 633,410 648,410 L 674,410 674,489 648,489 C 633,489 621,501 621,516 621,530 633,542 648,542 L 664,542 C 651,582 626,623 600,662 583,653 563,648 542,648 469,648 410,707 410,780 410,787 411,794 412,801 388,805 361,806 331,806 L 331,357 C 331,197 461,66 621,66 L 621,66 621,66 Z M 621,780 C 621,824 586,859 542,859 498,859 463,824 463,780 463,736 498,701 542,701 586,701 621,736 621,780 L 621,780 621,780 Z M 225,463 L 278,463 278,569 225,569 225,463 225,463 Z M 992,1547 L 621,1547 C 461,1547 331,1416 331,1256 L 331,859 C 367,859 400,858 431,851 454,888 495,912 542,912 615,912 674,853 674,780 674,747 662,718 642,695 675,645 706,594 720,542 L 780,542 C 795,542 807,530 807,516 807,501 795,489 780,489 L 727,489 727,410 780,410 C 795,410 807,398 807,383 807,369 795,357 780,357 L 727,357 727,278 780,278 C 795,278 807,266 807,251 807,237 795,225 780,225 L 727,225 727,66 887,66 C 889,111 895,155 905,196 L 869,217 C 856,224 852,240 859,253 864,261 873,266 882,266 887,266 891,265 895,263 L 921,248 C 937,291 958,331 983,367 L 938,403 C 926,412 925,429 934,440 939,447 947,450 954,450 960,450 966,448 971,444 L 1016,408 C 1043,438 1074,465 1108,485 L 1084,527 C 1076,539 1081,555 1093,563 1098,565 1102,566 1107,566 1116,566 1125,561 1129,553 L 1155,509 C 1194,527 1237,538 1282,541 L 1282,1256 C 1282,1416 1152,1547 992,1547 L 992,1547 992,1547 Z M 1335,463 L 1388,463 1388,569 1335,569 1335,463 1335,463 Z M 1441,410 L 1547,410 1547,621 1441,621 1441,410 1441,410 Z" />
|
||||
<path fill="rgb(10,11,9)" d="M 1150,1018 L 463,1018 C 448,1018 436,1030 436,1044 L 436,1177 C 436,1348 545,1468 701,1468 L 912,1468 C 1068,1468 1177,1348 1177,1177 L 1177,1044 C 1177,1030 1165,1018 1150,1018 L 1150,1018 1150,1018 Z M 912,1071 L 1018,1071 1018,1124 912,1124 912,1071 912,1071 Z M 489,1071 L 542,1071 542,1124 489,1124 489,1071 489,1071 Z M 701,1415 L 700,1415 C 701,1385 704,1352 718,1343 731,1335 759,1341 795,1359 802,1363 811,1363 818,1359 854,1341 882,1335 895,1343 909,1352 912,1385 913,1415 L 912,1415 701,1415 701,1415 701,1415 Z M 1124,1177 C 1124,1296 1061,1384 966,1408 964,1365 958,1320 922,1298 894,1281 856,1283 807,1306 757,1283 719,1281 691,1298 655,1320 649,1365 647,1408 552,1384 489,1296 489,1177 L 569,1177 C 583,1177 595,1165 595,1150 L 595,1071 859,1071 859,1150 C 859,1165 871,1177 886,1177 L 1044,1177 C 1059,1177 1071,1165 1071,1150 L 1071,1071 1124,1071 1124,1177 1124,1177 1124,1177 Z" />
|
||||
<path fill="rgb(10,11,9)" d="M 1071,648 C 998,648 939,707 939,780 939,853 998,912 1071,912 1144,912 1203,853 1203,780 1203,707 1144,648 1071,648 L 1071,648 1071,648 Z M 1071,859 C 1027,859 992,824 992,780 992,736 1027,701 1071,701 1115,701 1150,736 1150,780 1150,824 1115,859 1071,859 L 1071,859 1071,859 Z" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 8.1 KiB |
|
|
@ -16,5 +16,4 @@ license = "Apache-2.0 OR MIT"
|
|||
|
||||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop", features = ["database"], default-features = false }
|
||||
pagetop-minimal = { version = "0.0", path = "../pagetop-minimal" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use pagetop::prelude::*;
|
||||
use pagetop_minimal::component::*;
|
||||
|
||||
new_handle!(MODULE_USER);
|
||||
|
||||
|
|
@ -22,10 +21,6 @@ impl ModuleTrait for User {
|
|||
L10n::t("module_description", &LOCALES_USER)
|
||||
}
|
||||
|
||||
fn dependencies(&self) -> Vec<ModuleRef> {
|
||||
vec![&pagetop_minimal::Minimal]
|
||||
}
|
||||
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
scfg.route("/user/login", service::web::get().to(login));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue