From d1fae6b26e0820dee76e396c540bb1de90038917 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 22 Sep 2015 12:31:42 +0200 Subject: Implement package version detals page --- brep/package-search.cxx | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'brep/package-search.cxx') diff --git a/brep/package-search.cxx b/brep/package-search.cxx index a840687..9b3fb2c 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -72,11 +73,11 @@ namespace brep << TITLE << title << ~TITLE << CSS_STYLE << ident << A_STYLE () << ident - << PAGER_STYLE () << ident - << ".packages {font-size: x-large;}" << ident + << DIV_PAGER_STYLE () << ident + << "#packages {font-size: x-large;}" << ident << ".package {margin: 0.5em 0 0;}" << ident << ".name {font-size: x-large;}" << ident - << ".dependencies {margin: 0.3em 0 0;}" << ident + << ".tags {margin: 0.3em 0 0;}" << ~CSS_STYLE << ~HEAD << BODY; @@ -92,18 +93,14 @@ namespace brep // size_t pc (db_->query_value ().count); - s << DIV(CLASS="packages") - << "Packages (" << pc << ")" - << ~DIV; + s << DIV(ID="packages") << "Packages (" << pc << ")" << ~DIV; - // @@ Use appropriate view when clarify which package info to be displayed - // and search index structure get implemented. Query will also - // include search criteria if specified. + // @@ Query will also include search criteria if specified. // - using query = query; + using query = query; auto r ( - db_->query ( + db_->query ( "ORDER BY" + query::package::name + "OFFSET" + to_string (pr.page () * rop) + "LIMIT" + to_string (rop))); @@ -127,34 +124,20 @@ namespace brep << p.name << ~A << ~DIV - << DIV(CLASS="summary") - << p.summary - << ~DIV + << DIV(CLASS="summary") << p.summary << ~DIV + << DIV_TAGS (p.tags) + << DIV_LICENSES (v.license_alternatives) << DIV(CLASS="dependencies") << "Dependencies: " << v.dependencies.size () << ~DIV - << LICENSES (v.license_alternatives) - << TAGS (p.tags); - - s << ~DIV; + << ~DIV; } t.commit (); - auto u ( - [&q](size_t p) - { - string url ("/"); - if (p > 0) - url += "?p=" + to_string (p); - - if (!q.empty ()) - url += string (p > 0 ? "&" : "?") + q; - - return url; - }); + string u (q.empty () ? "/" : ("/?" + q)); - s << PAGER (pr.page (), pc, rop, options_->pages_in_pager (), u) + s << DIV_PAGER (pr.page (), pc, rop, options_->pages_in_pager (), u) << ~BODY << ~HTML; } -- cgit v1.1