diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-02-28 16:49:17 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-03-02 17:34:10 +0300 |
commit | 4fec7e73201ed50e4a4157cb1ea1f1c63566dd89 (patch) | |
tree | 93ca4fc57d2ba8bf077ac021cf96fa6335c8bfcc /brep/page.cxx | |
parent | cfdbf0f9c52288efaa57eba3a9c913790f034cf2 (diff) |
Menu customization
Diffstat (limited to 'brep/page.cxx')
-rw-r--r-- | brep/page.cxx | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/brep/page.cxx b/brep/page.cxx index a6c7da2..27e1b2a 100644 --- a/brep/page.cxx +++ b/brep/page.cxx @@ -40,18 +40,35 @@ namespace brep void DIV_HEADER:: operator() (serializer& s) const { - s << DIV(ID="header-bar") - << DIV(ID="header") - << DIV(ID="header-logo") - << ~DIV - << DIV(ID="header-menu") - << DIV(ID="header-menu-body") - << A(HREF=root_) << "Packages" << ~A - << A(HREF=root_.string () + "?about") << "About" << ~A - << ~DIV - << ~DIV - << ~DIV - << ~DIV; + if (!logo_.empty () || !menu_.empty ()) + { + s << DIV(ID="header-bar") + << DIV(ID="header"); + + if (!logo_.empty ()) + s << DIV(ID="header-logo") << logo_ << ~DIV; + + if (!menu_.empty ()) + { + s << DIV(ID="header-menu") + << DIV(ID="header-menu-body"); + + for (const auto& m: menu_) + { + const string& l (m.link[0] == '/' || m.link.find (':') != string::npos + ? m.link + : root_.string () + m.link); + + s << A(HREF=l) << m.label << ~A; + } + + s << ~DIV + << ~DIV; + } + + s << ~DIV + << ~DIV; + } } // FORM_SEARCH |