diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-05-04 17:26:31 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2016-05-04 21:26:51 +0300 |
commit | 0f487dc150ef6aa42ac4bd00edff9a02718798fe (patch) | |
tree | d97c44d845b0c3ac06abcac72613b5ed5fb8ad1a /mod | |
parent | 907ba04425800ca5404c0b7c778dffe8fed38f2f (diff) |
Add repository location to package version details and repository details pages
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-package-details.cxx | 6 | ||||
-rw-r--r-- | mod/mod-package-version-details.cxx | 8 | ||||
-rw-r--r-- | mod/mod-repository-details.cxx | 2 | ||||
-rw-r--r-- | mod/page | 20 | ||||
-rw-r--r-- | mod/page.cxx | 19 |
5 files changed, 42 insertions, 13 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), @@ -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:: |