From 0f487dc150ef6aa42ac4bd00edff9a02718798fe Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 4 May 2016 17:26:31 +0300 Subject: Add repository location to package version details and repository details pages --- mod/mod-package-details.cxx | 6 +++--- mod/mod-package-version-details.cxx | 8 +++++--- mod/mod-repository-details.cxx | 2 ++ mod/page | 20 +++++++++++++++++--- mod/page.cxx | 19 +++++++++++++++---- www/package-details-body.css | 6 +++--- www/package-version-details-body.css | 6 +++--- 7 files changed, 48 insertions(+), 19 deletions(-) diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx index 2ff93c9..1ee7a7a 100644 --- a/mod/mod-package-details.cxx +++ b/mod/mod-package-details.cxx @@ -225,9 +225,9 @@ handle (request& rq, response& rs) assert (p->internal ()); - // @@ Shouldn't we make package location to be a link to the proper + // @@ Shouldn't we make package repository name to be a link to the proper // place of the About page, describing corresponding repository? - // Yes, I think that's sounds reasonable, once we have about. + // Yes, I think that's sounds reasonable. // Or maybe it can be something more valuable like a link to the // repository package search page ? // @@ -238,7 +238,7 @@ handle (request& rq, response& rs) // // Hm, I am not so sure about this. Consider: stable/testing/unstable. // - s << TR_LOCATION (p->internal_repository.object_id (), root) + s << TR_REPOSITORY (p->internal_repository.object_id (), root) << TR_DEPENDS (p->dependencies, root) << TR_REQUIRES (p->requirements) << ~TBODY diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index 149c8f9..80a87ef 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -162,6 +162,8 @@ handle (request& rq, response& rs) assert (pkg->location && pkg->sha256sum); + const repository_location& rl (pkg->internal_repository.load ()->location); + s << TABLE(CLASS="proplist", ID="version") << TBODY @@ -171,9 +173,9 @@ handle (request& rq, response& rs) << TR_PRIORITY (pkg->priority) << TR_LICENSES (pkg->license_alternatives) - << TR_LOCATION (pkg->internal_repository.object_id (), root) - << TR_DOWNLOAD (pkg->internal_repository.load ()->location.string () + - "/" + pkg->location->string ()) + << TR_REPOSITORY (rl.canonical_name (), root) + << TR_LOCATION (rl) + << TR_DOWNLOAD (rl.string () + "/" + pkg->location->string ()) << TR_SHA256SUM (*pkg->sha256sum) << ~TBODY << ~TABLE diff --git a/mod/mod-repository-details.cxx b/mod/mod-repository-details.cxx index 91f0d1b..dffd0df 100644 --- a/mod/mod-repository-details.cxx +++ b/mod/mod-repository-details.cxx @@ -127,6 +127,8 @@ handle (request& rq, response& rs) s << ~P; } + s << P << A(HREF=r.location.string ()) << r.location << ~A << ~P; + ostringstream o; butl::to_stream (o, max (r.packages_timestamp, r.repositories_timestamp), diff --git a/mod/page b/mod/page index b326d6c..a01307c 100644 --- a/mod/page +++ b/mod/page @@ -264,12 +264,12 @@ namespace brep const priority& priority_; }; - // Generates package location element. + // Generates repository name element. // - class TR_LOCATION + class TR_REPOSITORY { public: - TR_LOCATION (const string& n, const dir_path& r) + TR_REPOSITORY (const string& n, const dir_path& r) : name_ (n), root_ (r) {} void @@ -280,6 +280,20 @@ namespace brep const dir_path& root_; }; + // Generates repository location element. + // + class TR_LOCATION + { + public: + TR_LOCATION (const repository_location& l): location_ (l) {} + + void + operator() (xml::serializer&) const; + + private: + const repository_location& location_; + }; + // Generates package download URL element. // class TR_DOWNLOAD diff --git a/mod/page.cxx b/mod/page.cxx index 7fc2e90..2ebbe7b 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -448,13 +448,13 @@ namespace brep << ~TR; } - // TR_LOCATION + // TR_REPOSITORY // - void TR_LOCATION:: + void TR_REPOSITORY:: operator() (serializer& s) const { - s << TR(CLASS="location") - << TH << "location" << ~TH + s << TR(CLASS="repository") + << TH << "repository" << ~TH << TD << SPAN(CLASS="value") << A @@ -468,6 +468,17 @@ namespace brep << ~TR; } + // TR_LOCATION + // + void TR_LOCATION:: + operator() (serializer& s) const + { + s << TR(CLASS="location") + << TH << "location" << ~TH + << TD << SPAN(CLASS="value") << location_ << ~SPAN << ~TD + << ~TR; + } + // TR_DOWNLOAD // void TR_DOWNLOAD:: diff --git a/www/package-details-body.css b/www/package-details-body.css index 1d5b6f7..a518a05 100644 --- a/www/package-details-body.css +++ b/www/package-details-body.css @@ -66,7 +66,7 @@ h1, h2 margin-top: 1.5em; margin-bottom: 1.5em; } -#package th {width: 6.4em;} +#package th {width: 7.6em;} /* * Search form (based on form-table) @@ -100,11 +100,11 @@ table.version } table.version:nth-child(even) {background-color: rgba(0, 0, 0, 0.07);} -table.version th {width: 6.4em;} +table.version th {width: 7.6em;} table.version tr.version td .value, table.version tr.priority td .value, -table.version tr.location td .value, +table.version tr.repository td .value, table.version tr.depends td .value, table.version tr.requires td .value { diff --git a/www/package-version-details-body.css b/www/package-version-details-body.css index 2b16668..df7889e 100644 --- a/www/package-version-details-body.css +++ b/www/package-version-details-body.css @@ -92,11 +92,11 @@ h1, h2, h3 border: 1px outset rgba(230,230,230,.24); */ } -#version th {width: 6.4em;} +#version th {width: 7.6em;} #version tr.version td .value, #version tr.priority td .value, -#version tr.location td .value +#version tr.repository td .value { /* style. */ font-family: monospace; @@ -117,7 +117,7 @@ h1, h2, h3 margin-top: 1.2em; margin-bottom: 1em; } -#package th {width: 6.4em;} +#package th {width: 7.6em;} /* * Dependencies and requirements tables. -- cgit v1.1