update
This commit is contained in:
parent
79f08fd202
commit
11e1bd975f
4 changed files with 41 additions and 6 deletions
|
@ -12,6 +12,8 @@ pub trait ColorCircle {
|
||||||
fn next(&self) -> Self;
|
fn next(&self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo : specific colors rgb
|
||||||
|
|
||||||
macro_rules! color_map {
|
macro_rules! color_map {
|
||||||
($name:ident, $id:literal) => {
|
($name:ident, $id:literal) => {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use components::Shell;
|
use components::Shell;
|
||||||
use maud::{Markup, PreEscaped, Render};
|
use maud::{Markup, PreEscaped, Render};
|
||||||
|
use prelude::Text;
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
|
|
||||||
|
@ -133,6 +134,42 @@ impl UIWidget for PreEscaped<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl UIWidget for String {
|
||||||
|
fn can_inherit(&self) -> bool {
|
||||||
|
Text(&self).can_inherit()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn base_class(&self) -> Vec<String> {
|
||||||
|
Text(&self).base_class()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extended_class(&self) -> Vec<String> {
|
||||||
|
Text(&self).extended_class()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_with_class(&self, class: &str) -> Markup {
|
||||||
|
Text(&self).render_with_class(class)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UIWidget for &str {
|
||||||
|
fn can_inherit(&self) -> bool {
|
||||||
|
Text(&self).can_inherit()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn base_class(&self) -> Vec<String> {
|
||||||
|
Text(&self).base_class()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extended_class(&self) -> Vec<String> {
|
||||||
|
Text(&self).extended_class()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render_with_class(&self, class: &str) -> Markup {
|
||||||
|
Text(&self).render_with_class(class)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Trait for an element which can add new `attrs`
|
/// Trait for an element which can add new `attrs`
|
||||||
pub trait AttrExtendable {
|
pub trait AttrExtendable {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
|
@ -116,11 +116,7 @@ impl UIWidget for DivWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extended_class(&self) -> Vec<String> {
|
fn extended_class(&self) -> Vec<String> {
|
||||||
if self.1 {
|
vec![]
|
||||||
self.extended_class_()
|
|
||||||
} else {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_with_class(&self, class: &str) -> Markup {
|
fn render_with_class(&self, class: &str) -> Markup {
|
||||||
|
|
|
@ -348,7 +348,7 @@ impl TextWidget {
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn title(mut self, title: &str) -> Self {
|
pub fn title(mut self, title: &str) -> Self {
|
||||||
self.title = Some(title.to_string());
|
self.title = Some(title.replace('\'', "\\'"));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue