From: Michael Tremer Date: Wed, 22 Jun 2022 16:42:00 +0000 (+0000) Subject: distros: Refactor detail page X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9342fbce4a01b8402d3d6b9a53dabea60f34a55a;p=pbs.git distros: Refactor detail page Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index a118d6cd..1ab37f79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -153,7 +153,6 @@ dist_templates_DATA = \ src/templates/build-state.html \ src/templates/builds-watchers-add.html \ src/templates/builds-watchers-list.html \ - src/templates/distro-detail.html \ src/templates/distro-edit.html \ src/templates/distro-source-commit-detail.html \ src/templates/distro-source-commit-reset.html \ @@ -212,7 +211,8 @@ dist_templates_builds_modules_DATA = \ templates_builds_modulesdir = $(templates_buildsdir)/modules dist_templates_distros_DATA = \ - src/templates/distros/index.html + src/templates/distros/index.html \ + src/templates/distros/show.html templates_distrosdir = $(templatesdir)/distros diff --git a/src/templates/distro-detail.html b/src/templates/distro-detail.html deleted file mode 100644 index a090e5fa..00000000 --- a/src/templates/distro-detail.html +++ /dev/null @@ -1,108 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Distribution") }}: {{ distro.name }}{% end block %} - -{% block body %} - - - -
- {% if current_user and current_user.is_admin() %} -
-

- {{ _("Distribution") }}: {{ distro.name }}
- {{ distro.slogan }} -

-
- - {% else %} -
-

- {{ _("Distribution") }}: {{ distro.name }}
- {{ distro.slogan }} -

-
- {% end %} -
- -
-
-
-

{{ distro.description }}

-
{{ distro.vendor }}
-
-
-
- -
-
-

- {{ _("Supported architectures") }}: - {{ locale.list(distro.arches) or _("None") }} -

-
-
-
- -
-
-

- {{ _("Binary repositories") }} - ({{ len(distro.repositories) }}) -

- -

- {{ _("A binary repository is a composition of packages that are considered stable, unstable or in testing state by the developers.") }} -
- {{ _("Each repository can be enabled individually.") }} -

- - {% module RepositoryTable(distro, distro.repositories) %} - -
-
-
- -
-
-

- {{ _("Source repositories") }} - ({{ len(distro.sources) }}) -

- - {% module SourceTable(distro, distro.sources) %} -
-
- -{% end block %} diff --git a/src/templates/distros/show.html b/src/templates/distros/show.html new file mode 100644 index 00000000..85be1338 --- /dev/null +++ b/src/templates/distros/show.html @@ -0,0 +1,43 @@ +{% extends "../base.html" %} + +{% block title %}{{ _("Distribution") }} - {{ distro }}{% end block %} + +{% block container %} + + +

+ {{ distro }} + + {% if distro.slogan %} + {{ distro.slogan }} + {% end %} +

+ + {% if distro.description %} +
+ {% module Text(distro.description) %} +
+ {% end %} + + {% if distro.arches %} +

+ {{ _("Supported Architectures") }} + + {% for arch in distro.arches %} + {{ arch }} + {% end %} +

+ {% end %} +{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index a5acc31e..54afd9bc 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -149,11 +149,7 @@ class Application(tornado.web.Application): # Distributions (r"/distros", distributions.IndexHandler), - (r"/distro/([A-Za-z0-9\-\.]+)", distributions.DistributionDetailHandler), - - # XXX THOSE URLS ARE DEPRECATED - (r"/distribution/delete/([A-Za-z0-9\-\.]+)", distributions.DistributionDetailHandler), - (r"/distribution/edit/([A-Za-z0-9\-\.]+)", distributions.DistributionEditHandler), + (r"/distros/([A-Za-z0-9\-\.]+)", distributions.ShowHandler), (r"/distro/([A-Za-z0-9\-\.]+)/repo/([A-Za-z0-9\-]+)", RepositoryDetailHandler), diff --git a/src/web/distributions.py b/src/web/distributions.py index aab34cc0..2a0599f0 100644 --- a/src/web/distributions.py +++ b/src/web/distributions.py @@ -9,13 +9,13 @@ class IndexHandler(base.BaseHandler): self.render("distros/index.html", distros=self.backend.distros) -class DistributionDetailHandler(base.BaseHandler): +class ShowHandler(base.BaseHandler): def get(self, slug): distro = self.backend.distros.get_by_slug(slug) if not distro: raise tornado.web.HTTPError(404, "Could not find distro: %s" % slug) - self.render("distro-detail.html", distro=distro) + self.render("distros/show.html", distro=distro) class DistributionEditHandler(base.BaseHandler):