From 4718a059f842a791c89a1922996bb8f1dbea8f65 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 16 May 2017 23:27:53 +0300 Subject: Add filter form to builds page --- mod/page.cxx | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'mod/page.cxx') 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:: -- cgit v1.1