From 675e973bf8e0e24593552f596eb3d81e57e19c94 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 19 Sep 2015 15:12:48 +0200 Subject: Elaborate package search and package version search pages --- brep/package-search.cxx | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'brep/package-search.cxx') diff --git a/brep/package-search.cxx b/brep/package-search.cxx index 02a8547..a840687 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -71,14 +71,12 @@ namespace brep << HEAD << TITLE << title << ~TITLE << CSS_STYLE << ident - << pager_style () << ident - << "a {text-decoration: none;}" << ident - << "a:hover {text-decoration: underline;}" << ident + << A_STYLE () << ident + << PAGER_STYLE () << ident << ".packages {font-size: x-large;}" << ident << ".package {margin: 0.5em 0 0;}" << ident << ".name {font-size: x-large;}" << ident - << ".tags {margin: 0.1em 0 0;}" << ident - << ".tag {padding: 0 0.3em 0 0;}" + << ".dependencies {margin: 0.3em 0 0;}" << ident << ~CSS_STYLE << ~HEAD << BODY; @@ -92,7 +90,7 @@ namespace brep // @@ Query will include search criteria if specified. // - size_t pc (db_->query_value ().count); + size_t pc (db_->query_value ().count); s << DIV(CLASS="packages") << "Packages (" << pc << ")" @@ -102,15 +100,19 @@ namespace brep // and search index structure get implemented. Query will also // include search criteria if specified. // - using query = query; + using query = query; + auto r ( - db_->query ( - "ORDER BY" + query::name + + db_->query ( + "ORDER BY" + query::package::name + "OFFSET" + to_string (pr.page () * rop) + "LIMIT" + to_string (rop))); - for (const auto& p: r) + for (const auto& ip: r) { + const package& p = *ip.package; + const package_version& v = *ip.version; + s << DIV(CLASS="package") << DIV(CLASS="name") << A @@ -127,17 +129,12 @@ namespace brep << ~DIV << DIV(CLASS="summary") << p.summary - << ~DIV; - - if (!p.tags.empty ()) - { - s << DIV(CLASS="tags"); - - for (const auto& t: p.tags) - s << SPAN(CLASS="tag") << t << ~SPAN << " "; - - s << ~DIV; - } + << ~DIV + << DIV(CLASS="dependencies") + << "Dependencies: " << v.dependencies.size () + << ~DIV + << LICENSES (v.license_alternatives) + << TAGS (p.tags); s << ~DIV; } @@ -157,7 +154,7 @@ namespace brep return url; }); - s << pager (pr.page (), pc, rop, options_->pages_in_pager (), u) + s << PAGER (pr.page (), pc, rop, options_->pages_in_pager (), u) << ~BODY << ~HTML; } -- cgit v1.1