Struct ::exo::dom::Card

Overview

Card dom node.

This node is used inside a dom to display a card. A card is just a white area where children can be placed into. When a name is given, a the card shows a headline and the content can be collapsed. Supported fields of this node are:

  • id: The id of this node
  • status: The stati where the node should be shown
  • rights: One of the rights needed to show the node
  • edit: Defines the edit state of the node
  • readonly: Defines the readonly state of the node
  • style: Defines the style state of the node
  • title: The title to display in the header
  • fixed: When set to true, whe card can not be collapsed
  • collapsed: When set to true, is show collapsed initially
  • children: The content to render within the card

Within the layouter this card can be used like this:

<card name="Cool new card">
 <button title="Click Here" icon="link" typ="highlight" />
</card>

Methods

fn new() -> Card

Creates a new Card.

Example

let node = exo::dom::Card::new();
node.fixed = false;
node.collapsed = false;

Protocols

protocol partial_eq
if value == b { }

Allows for partial equality operations to work.

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.

protocol string_display
println("{}", value)

Allows the value to be display printed.

protocol get id
let output = value.id

Get the id of the node as String. A node Id should be unique inside the complete dom.

Example

let node = exo::dom::Card::new();
node.id = "id_123456";
assert_eq!(node.id, "id_123456");
protocol set id
value.id = input

Set the id of the node as String. A node Id should be unique inside the complete dom.

Example

let node = exo::dom::Card::new();
node.id = "id_123456";
assert_eq!(node.id, "id_123456");
protocol get status
let output = value.status

Get the different status of the node as Vec<String>. This node and all it's child will only be displayed, when no status is set or the record has any of the given stati.

Example

let node = exo::dom::Card::new();
node.status = ["new", "released"];
assert!(node.status.iter().any(|s| s == "new"));
protocol set status
value.status = input

Set the status of the node as Vec<String>. This node and all it's child will only be displayed, when no status is set or the record has any of the given stati.

Example

let node = exo::dom::Card::new();
node.status = ["new", "released"];
assert!(node.status.iter().any(|s| s == "new"));
protocol get edit
let output = value.edit

Get the edit status of the node as Option<bool>. The edit mode can be set as true or false. When the edit mode is not set, it takes the system edit state.

Example

let node = exo::dom::Card::new();
node.edit = Some(false);
assert_eq!(node.edit, Some(false));
protocol set edit
value.edit = input

Set the edit status of the node as Option<bool>. The edit mode can be set as true or false. When the edit mode is not set, it takes the system edit state.

Example

let node = exo::dom::Card::new();
node.edit = Some(false);
assert_eq!(node.edit, Some(false));
protocol get style
let output = value.style

Get the style of the node as String.

Example

let node = exo::dom::Card::new();
node.style = "color: red;";
assert_eq!(node.style, "color: red;");
protocol set style
value.style = input

Set the style of the node as String.

Example

let node = exo::dom::Card::new();
node.style = "color: red;";
assert_eq!(node.style, "color: red;");
protocol get rights
let output = value.rights

Get the different rights of the node as Vec<String>. This node and all it's child will only be displayed, when no rights are set or the user has one of the rights.

Example

let node = exo::dom::Card::new();
node.rights = ["user_right", "can_release"];
assert!(node.rights.iter().any(|s| s == "can_release"));
protocol set rights
value.rights = input

Get the different rights of the node as Vec<String>. This node and all it's child will only be displayed, when no rights are set or the user has one of the rights.

Example

let node = exo::dom::Card::new();
node.rights = ["user_right", "can_release"];
assert!(node.rights.iter().any(|s| s == "can_release"));
protocol get readonly
let output = value.readonly

Get the readonly status of the node as Option<bool>. The readonly mode can be set as true or false. When the readonly mode is not set, it takes the parent state.

Example

let node = exo::dom::Card::new();
node.readonly = Some(false);
assert_eq!(node.readonly, Some(false));
protocol set readonly
value.readonly = input

Set the readonly status of the node as Option<bool>. The readonly mode can be set as true or false. When the readonly mode is not set, it takes the parent state.

Example

let node = exo::dom::Card::new();
node.readonly = Some(false);
assert_eq!(node.readonly, Some(false));
protocol get title
let output = value.title

Get title of the node.

Example

let node = exo::dom::Card::new();
node.title = "Beatiful button";
assert_eq!(node.title, "Beatiful button");
protocol set title
value.title = input

Set title of the node.

Example

let node = exo::dom::Card::new();
node.title = "Beatiful button";
assert_eq!(node.title, "Beatiful button");
protocol get fixed
let output = value.fixed

Get the fixed state of the node.

Example

let node = exo::dom::Card::new();
node.fixed = true;
assert_eq!(node.fixed, true);
protocol set fixed
value.fixed = input

Set the fixed state of the node.

Example

let node = exo::dom::Card::new();
node.fixed = true;
assert_eq!(node.fixed, true);
protocol get collapsed
let output = value.collapsed

Get the collapsed state of the card.

Example

let node = exo::dom::Card::new();
node.collapsed = true;
assert_eq!(node.collapsed, true);
protocol set collapsed
value.collapsed = input

Set the collapsed state of the card.

Example

let node = exo::dom::Card::new();
node.collapsed = true;
assert_eq!(node.collapsed, true);
protocol get children
let output = value.children

Get the children.

Example

let node = exo::dom::Card::new();
node.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new()];
assert_eq!(node.children, [exo::dom::NewLine::new(), exo::dom::RawHtml::new()]);
protocol set children
value.children = input

Set the children.

Example

let node = exo::dom::Card::new();
node.children = [exo::dom::NewLine::new(), exo::dom::RawHtml::new()];
assert_eq!(node.children, [exo::dom::NewLine::new(), exo::dom::RawHtml::new()]);