Shlomi Fish avatar Shlomi Fish committed 77f238c

Add a fully_expanded option to MyNavData.

This will better allow the dual-expanded and non-expanded tree.

Comments (0)

Files changed (1)

 
 sub get_params
 {
+    my ($args) = @_;
+
+    my $is_fully_expanded = (
+        exists($args->{fully_expanded})
+        ? $args->{fully_expanded}
+        : 1
+    );
+
+    my $get_sub_tree = sub {
+        my ($sect_name) = @_;
+
+        return $is_fully_expanded
+            ? Shlomif::Homepage::SectionMenu->get_modified_sub_tree($sect_name)
+            : $reduced_sub_trees{$sect_name}
+            ;
+    };
+
     my $tree_contents =
     {
         host => "t2",
                     },
                 ],
             },
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Humour'),
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Puzzles'),
+            $get_sub_tree->('Humour'),
+            $get_sub_tree->('Puzzles'),
             {
                 text => "Computer Art",
                 url => "art/",
                     },
                 ],
             },
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Software'),
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Lectures'),
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Essays'),
+            $get_sub_tree->('Software'),
+            $get_sub_tree->('Lectures'),
+            $get_sub_tree->('Essays'),
             {
                 text => "Work",
                 url => "work/",
                 separator => 1,
                 skip => 1,
             },
-            Shlomif::Homepage::SectionMenu->get_modified_sub_tree('Meta'),
+            $get_sub_tree->('Meta'),
         ],
     };
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.