diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-05-22 14:15:44 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-05-22 16:40:04 +0300 |
commit | 7e4c92e29954c14f9c1dd51aff95fff25d3ced32 (patch) | |
tree | 2434a56ce3ebc84bbaca5267b5afecda8a523fba /mod | |
parent | aae2024a1bdce3ffcb9e638d4a949a71ecdef4c0 (diff) |
Add support for package manifest upstream-version value
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-package-details.cxx | 2 | ||||
-rw-r--r-- | mod/mod-package-version-details.cxx | 2 | ||||
-rw-r--r-- | mod/page.cxx | 17 | ||||
-rw-r--r-- | mod/page.hxx | 16 |
4 files changed, 24 insertions, 13 deletions
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx index 5074eca..7b75e62 100644 --- a/mod/mod-package-details.cxx +++ b/mod/mod-package-details.cxx @@ -254,7 +254,7 @@ handle (request& rq, response& rs) s << TABLE(CLASS="proplist version") << TBODY - << TR_VERSION (name, p->version, root, tenant) + << TR_VERSION (name, p->version, root, tenant, p->upstream_version) // @@ 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 40cbad6..437bff4 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -210,7 +210,7 @@ handle (request& rq, response& rs) // Repeat version here since it can be cut out in the header. // - << TR_VERSION (pkg->version) + << TR_VERSION (pkg->version, pkg->upstream_version) << TR_PRIORITY (pkg->priority) << TR_LICENSES (pkg->license_alternatives) diff --git a/mod/page.cxx b/mod/page.cxx index 228a137..0c4c257 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -153,8 +153,8 @@ namespace brep if (!value_.empty ()) s << VALUE(value_); - if (!placeholder_.empty ()) - s << PLACEHOLDER(placeholder_); + if (placeholder_ != nullptr) + s << PLACEHOLDER(*placeholder_); if (autofocus_) s << AUTOFOCUS(""); @@ -249,7 +249,9 @@ namespace brep { s << version_; - if (stub_) + if (upstream_version_ != nullptr) + s << " (" << *upstream_version_ << ')'; + else if (stub_) s << " (stub)"; } else @@ -259,12 +261,13 @@ namespace brep s << A(HREF=tenant_dir (*root_, *tenant_) / dir_path (mime_url_encode (package_->string (), false)) / path (version_)) - << version_; + << version_ + << ~A; - if (stub_) + if (upstream_version_ != nullptr) + s << " (" << *upstream_version_ << ')'; + else if (stub_) s << " (stub)"; - - s << ~A; } s << ~SPAN diff --git a/mod/page.hxx b/mod/page.hxx index 7260031..28257c1 100644 --- a/mod/page.hxx +++ b/mod/page.hxx @@ -129,7 +129,11 @@ namespace brep const string& v, const string& p = string (), bool a = false) - : label_ (l), name_ (n), value_ (v), placeholder_ (p), autofocus_ (a) + : label_ (l), + name_ (n), + value_ (v), + placeholder_ (!p.empty () ? &p : nullptr), + autofocus_ (a) { } @@ -140,7 +144,7 @@ namespace brep const string& label_; const string& name_; const string& value_; - const string& placeholder_; + const string* placeholder_; bool autofocus_; }; @@ -222,9 +226,11 @@ namespace brep TR_VERSION (const package_name& p, const version& v, const dir_path& r, - const string& t) + const string& t, + const optional<string>& u = nullopt) : package_ (&p), version_ (v.string ()), + upstream_version_ (u ? &*u : nullptr), stub_ (v.compare (wildcard_version, true) == 0), root_ (&r), tenant_ (&t) @@ -233,9 +239,10 @@ namespace brep // Display the version as a regular text. // - TR_VERSION (const version& v) + TR_VERSION (const version& v, const optional<string>& u = nullopt) : package_ (nullptr), version_ (v.string ()), + upstream_version_ (u ? &*u : nullptr), stub_ (v.compare (wildcard_version, true) == 0), root_ (nullptr), tenant_ (nullptr) @@ -248,6 +255,7 @@ namespace brep private: const package_name* package_; string version_; + const string* upstream_version_; bool stub_; const dir_path* root_; const string* tenant_; |