@@ -30,7 +30,7 @@ pub struct ContentFolderShowTemplate {
3030 /// Global application state
3131 pub state : AppStateContext ,
3232 /// current folder
33- pub current_content_folder : content_folder:: Model ,
33+ pub folder : content_folder:: Model ,
3434 /// Folders with parent_id set to current folder
3535 pub children : Vec < FileSystemEntry > ,
3636 /// Category
@@ -41,6 +41,26 @@ pub struct ContentFolderShowTemplate {
4141 pub flash : Option < OperationStatus > ,
4242}
4343
44+ impl ContentFolderShowTemplate {
45+ fn new ( context : AppStateContext , folder : FolderRequest ) -> Self {
46+ let FolderRequest {
47+ breadcrumbs,
48+ category,
49+ children,
50+ folder,
51+ } = folder;
52+
53+ Self {
54+ breadcrumbs,
55+ category,
56+ children,
57+ flash : None ,
58+ folder,
59+ state : context,
60+ }
61+ }
62+ }
63+
4464impl FallibleTemplate for ContentFolderShowTemplate {
4565 fn with_optional_flash ( & mut self , flash : Option < OperationStatus > ) {
4666 self . flash = flash;
@@ -52,14 +72,7 @@ pub async fn show(
5272 folder : FolderRequest ,
5373 status : StatusCookie ,
5474) -> FlashTemplate < ContentFolderShowTemplate > {
55- status. with_template ( ContentFolderShowTemplate {
56- breadcrumbs : folder. breadcrumbs ,
57- children : folder. children ,
58- current_content_folder : folder. folder ,
59- category : folder. category ,
60- state : context,
61- flash : None ,
62- } )
75+ status. with_template ( ContentFolderShowTemplate :: new ( context, folder) )
6376}
6477
6578pub async fn create (
0 commit comments