diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-16 23:27:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-19 11:44:48 +0300 |
commit | 4718a059f842a791c89a1922996bb8f1dbea8f65 (patch) | |
tree | a6dcc621f8287d444a699355f89b4a383eafd283 /mod/page.cxx | |
parent | e2264d6c34de011753913dd9b447b3d38649619c (diff) |
Add filter form to builds page
Diffstat (limited to 'mod/page.cxx')
-rw-r--r-- | mod/page.cxx | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/mod/page.cxx b/mod/page.cxx index de7b5f5..73c56be 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -80,7 +80,7 @@ namespace brep { // The 'action' attribute is optional in HTML5. While the standard doesn't // specify browser behavior explicitly for the case the attribute is - // ommited, the only reasonable behavior is to default it to the current + // omitted, the only reasonable behavior is to default it to the current // document URL. // s << FORM(ID="search") @@ -122,6 +122,56 @@ namespace brep << ~TR; } + // TR_INPUT + // + void TR_INPUT:: + operator() (serializer& s) const + { + s << TR(CLASS=label_) + << TH << label_ << ~TH + << TD + << INPUT(TYPE="text", NAME=name_); + + if (!value_.empty ()) + s << VALUE(value_); + + if (!placeholder_.empty ()) + s << PLACEHOLDER(placeholder_); + + if (autofocus_) + s << AUTOFOCUS("autofocus"); + + s << ~INPUT + << ~TD + << ~TR; + } + + // TR_SELECT + // + void TR_SELECT:: + operator() (serializer& s) const + { + s << TR(CLASS=label_) + << TH << label_ << ~TH + << TD + << SELECT(NAME=name_); + + for (const auto& o: options_) + { + s << OPTION(VALUE=o.first); + + if (o.first == value_) + s << SELECTED("selected"); + + s << o.second + << ~OPTION; + } + + s << ~SELECT + << ~TD + << ~TR; + } + // TR_NAME // void TR_NAME:: |