pub struct ImageColumn<M, T> { /* private fields */ }Expand description
A column of a String field holding an uploaded image’s path, rendered as a thumbnail.
tablo_core::ImageColumn::new(tablo_core::lens!(Product.image)).circular();A rooted path, such as an upload’s, shows as a 40px square thumbnail; an empty value shows
the table’s dash, and any other value its text. An absolute http(s) URL shows as an image
only once remote allows it.
Implementations§
Source§impl<M, T> ImageColumn<M, T>where
M: Model,
impl<M, T> ImageColumn<M, T>where
M: Model,
Sourcepub fn new(lens: Lens<M, T>) -> ImageColumn<M, T>where
T: Field<Inner = String>,
pub fn new(lens: Lens<M, T>) -> ImageColumn<M, T>where
T: Field<Inner = String>,
Bind the column to the String or Option<String> field lens reads.
Sourcepub fn size(self, pixels: u16) -> ImageColumn<M, T>
pub fn size(self, pixels: u16) -> ImageColumn<M, T>
Show the thumbnail pixels wide and tall.
Sourcepub fn circular(self) -> ImageColumn<M, T>
pub fn circular(self) -> ImageColumn<M, T>
Crop the thumbnail to a circle, for an avatar.
Sourcepub fn remote(self) -> ImageColumn<M, T>
pub fn remote(self) -> ImageColumn<M, T>
Also show an absolute http(s) URL as an image. Every browser that renders the table
then loads it from that host as the page opens, so whoever can write the field learns who
views the list, and when: allow it for a field only trusted users write.
Sourcepub fn label(self, label: impl Into<Text>) -> ImageColumn<M, T>
pub fn label(self, label: impl Into<Text>) -> ImageColumn<M, T>
Replace the label the field’s name gives it.
Sourcepub fn width(self, width: ColumnWidth) -> ImageColumn<M, T>
pub fn width(self, width: ColumnWidth) -> ImageColumn<M, T>
Declare this column’s width.
Sourcepub fn toggleable(self) -> ImageColumn<M, T>
pub fn toggleable(self) -> ImageColumn<M, T>
Let each reader hide this column from their list; it starts shown.
Let each reader show this column in their list; it starts hidden.
Trait Implementations§
Source§impl<M, T> Clone for ImageColumn<M, T>
impl<M, T> Clone for ImageColumn<M, T>
Source§fn clone(&self) -> ImageColumn<M, T>
fn clone(&self) -> ImageColumn<M, T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<M, T> Column<M> for ImageColumn<M, T>
impl<M, T> Column<M> for ImageColumn<M, T>
Source§fn column_width(&self) -> ColumnWidth
fn column_width(&self) -> ColumnWidth
Source§fn toggle(&self) -> ColumnToggle
fn toggle(&self) -> ColumnToggle
Source§fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
term adds, or None when the column does not join the table’s
search. A column that joins it answers Some for every non-empty, trimmed term.