From 665057a9c4bb0d2ea5ca35d81cb1c22244fa7002 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 30 Aug 2016 00:50:08 +0300 Subject: Support stubs on package and package version details pages --- mod/mod-package-details.cxx | 2 +- mod/mod-package-version-details.cxx | 2 +- mod/page | 21 ++++++++++++++++----- mod/page.cxx | 13 +++++++++++-- 4 files changed, 29 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx index 1ee7a7a..7821b69 100644 --- a/mod/mod-package-details.cxx +++ b/mod/mod-package-details.cxx @@ -211,7 +211,7 @@ handle (request& rq, response& rs) s << TABLE(CLASS="proplist version") << TBODY - << TR_VERSION (name, p->version.string (), root) + << TR_VERSION (name, p->version, root) // @@ Shouldn't we skip low priority row ? Don't think so, why? // diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index ccd81c5..b2172ce 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -169,7 +169,7 @@ handle (request& rq, response& rs) // Repeat version here since it can be cut out in the header. // - << TR_VERSION (pkg->version.string ()) + << TR_VERSION (pkg->version) << TR_PRIORITY (pkg->priority) << TR_LICENSES (pkg->license_alternatives) diff --git a/mod/page b/mod/page index a01307c..f693e7c 100644 --- a/mod/page +++ b/mod/page @@ -114,20 +114,31 @@ namespace brep public: // Display the version as a link to the package version details page. // - TR_VERSION (const string& p, const string& v, const dir_path& r) - : package_ (&p), version_ (v), root_ (&r) {} + TR_VERSION (const string& p, const version& v, const dir_path& r) + : package_ (&p), + version_ (v.string ()), + stub_ (v.compare (wildcard_version, true) == 0), + root_ (&r) + { + } // Display the version as a regular text. // - TR_VERSION (const string& v) - : package_ (nullptr), version_ (v), root_ (nullptr) {} + TR_VERSION (const version& v) + : package_ (nullptr), + version_ (v.string ()), + stub_ (v.compare (wildcard_version, true) == 0), + root_ (nullptr) + { + } void operator() (xml::serializer&) const; private: const string* package_; - const string& version_; + string version_; + bool stub_; const dir_path* root_; }; diff --git a/mod/page.cxx b/mod/page.cxx index 79b5da5..aba7581 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -144,14 +144,23 @@ namespace brep << SPAN(CLASS="value"); if (package_ == nullptr) + { s << version_; + + if (stub_) + s << " (stub)"; + } else { assert (root_ != nullptr); s << A(HREF=*root_ / dir_path (mime_url_encode (*package_)) / path (version_)) - << version_ - << ~A; + << version_; + + if (stub_) + s << " (stub)"; + + s << ~A; } s << ~SPAN -- cgit v1.1