// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ // ┃ Copyright: (c) 2023, Mike 'PhiSyX' S. (https://github.com/PhiSyX) ┃ // ┃ SPDX-License-Identifier: MPL-2.0 ┃ // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ // ┃ ┃ // ┃ This Source Code Form is subject to the terms of the Mozilla Public ┃ // ┃ License, v. 2.0. If a copy of the MPL was not distributed with this ┃ // ┃ file, You can obtain one at https://mozilla.org/MPL/2.0/. ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ use lexa_framework::html; use lexa_framework::view::Node; use crate::crud_site::models::entities::Article; use crate::crud_site::routes::ArticlesRouteId; use crate::crud_site::views::BaseHTMLLayout; // --------- // // Structure // // --------- // #[derive(lexa_framework::View)] pub struct ArticlesShowView { pub article: Article, } // -------------- // // Implémentation // // -------------- // impl ArticlesShowView { fn route_to_edit(&self) -> ArticlesRouteId<'_> { ArticlesRouteId::ArticlesEdit { id: self.article.id.simple().to_string(), } } fn route_to_delete(&self) -> ArticlesRouteId<'_> { ArticlesRouteId::ArticlesDelete { id: self.article.id.simple().to_string(), } } } // -------------- // // Implémentation // -> Interface // -------------- // impl lexa_framework::view::ViewInterface for ArticlesShowView { type Layout = BaseHTMLLayout; type Metadata = Node; type Scripts = Node; type Styles = Node; type View = Node; fn title(&self) -> String { format!("Article « {} »", &self.article.title) } fn view(&self) -> Self::View { html!(
) } }