1 #ifndef __BIAWEBNAVIGATIONBIT__
2 #define __BIAWEBNAVIGATIONBIT__
6 #include <fmt/format.h>
7 #include "biawebutil.hpp"
8 #include "biawebsidebar.hpp"
9 #include "biawebtemplate.hpp"
12 // class to represent a navigation bit like this in html
13 // > Parent > Child > Subchild
17 std::list<GenericLinkItem> items;
19 // add a generic link item - this should add to beginning of the list
20 void add_link_item (GenericLinkItem item) {
21 items.insert (items.cbegin(), item);
24 // render using the given template directory
25 std::string to_html (Template *t) ;
28 // render using the given template
29 std::string NavigationBit::to_html (Template *t) {
30 std::string templ_str = t->get_navigationbit_tpl ();
32 std::string output_html = "";
33 std::string items_str = "";
34 for (GenericLinkItem item : this->items)
35 items_str += item.to_html (t);
37 if (this->items.size () > 0)
38 output_html = fmt::format (templ_str, fmt::arg ("items", items_str));