launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30878
[Merge] ~ines-almeida/launchpad:frontpage-revamp-remove-top-project into launchpad:master
Ines Almeida has proposed merging ~ines-almeida/launchpad:frontpage-revamp-remove-top-project into launchpad:master.
Commit message:
Remove top featured project from homepage
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/460809
The plan is to make all featured projects more prominent instead of just one.
This is just an intermediary step to make the next merge proposals cleaner. It can be merged with the remaining changes if we so choose to, or it can be merged before.
Here is the before, after and end-goal: https://pasteboard.co/DxhkktVntx2m.png
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:frontpage-revamp-remove-top-project into launchpad:master.
diff --git a/lib/lp/app/browser/doc/root-views.rst b/lib/lp/app/browser/doc/root-views.rst
index 8782f3f..f5c996e 100644
--- a/lib/lp/app/browser/doc/root-views.rst
+++ b/lib/lp/app/browser/doc/root-views.rst
@@ -12,7 +12,7 @@ special data needed for the layout.
...
>>> LaunchpadRootIndexView._get_day_of_year = staticmethod(day)
-The view has a provides a list of featured projects and a top project.
+The view has a provides a list of featured projects.
>>> from lp.services.webapp.interfaces import ILaunchpadRoot
@@ -21,36 +21,15 @@ The view has a provides a list of featured projects and a top project.
>>> for project in view.featured_projects:
... print(project.name)
...
- applets bazaar firefox gentoo gnome-terminal mozilla thunderbird ubuntu
-
- >>> print(view.featured_projects_top.name)
+ applets
+ bazaar
+ firefox
+ gentoo
gnome
-
-The featured_projects_top property is set by a helper method that pops the
-project from the list of featured_projects.
-
- >>> featured_projects = list(view.featured_projects)
- >>> featured_projects_top = view.featured_projects_top
- >>> view._setFeaturedProjectsTop()
- >>> print(view.featured_projects_top.name)
gnome-terminal
-
- >>> for project in view.featured_projects:
- ... print(project.name)
- ...
- applets bazaar firefox gentoo mozilla thunderbird ubuntu
-
-If there are no featured projects, the top featured project is None.
-
- >>> view.featured_projects = []
- >>> view.featured_projects_top = None
- >>> view._setFeaturedProjectsTop()
- >>> print(view.featured_projects_top)
- None
-
- # Put the projects back as they were.
- >>> view.featured_projects = featured_projects
- >>> view.featured_projects_top = featured_projects_top
+ mozilla
+ thunderbird
+ ubuntu
The view provides the counts of branches, Git repositories, bugs,
projects, translations, blueprints, and answers registered in Launchpad.
diff --git a/lib/lp/app/browser/root.py b/lib/lp/app/browser/root.py
index 2a87d2b..154b6a5 100644
--- a/lib/lp/app/browser/root.py
+++ b/lib/lp/app/browser/root.py
@@ -57,21 +57,11 @@ class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
page_title = "Launchpad"
featured_projects: List[Any] = []
- featured_projects_top = None
# Used by the footer to display the lp-arcana section.
is_root_page = True
has_watermark = False
- @staticmethod
- def _get_day_of_year():
- """Calculate the number of the current day.
-
- This method gets overridden in tests to make the selection of the
- top featured project deterministic.
- """
- return time.gmtime()[7]
-
def initialize(self):
"""Set up featured projects list and the top featured project."""
super().initialize()
@@ -80,16 +70,6 @@ class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
self.featured_projects = list(
getUtility(IPillarNameSet).featured_projects
)
- self._setFeaturedProjectsTop()
-
- def _setFeaturedProjectsTop(self):
- """Set the top featured project and remove it from the list."""
- project_count = len(self.featured_projects)
- if project_count > 0:
- top_project = self._get_day_of_year() % project_count
- self.featured_projects_top = self.featured_projects.pop(
- top_project
- )
@cachedproperty
def apphomes(self):
diff --git a/lib/lp/app/stories/launchpad-root/xx-featuredprojects.rst b/lib/lp/app/stories/launchpad-root/xx-featuredprojects.rst
index e0ff0f6..79c90bd 100644
--- a/lib/lp/app/stories/launchpad-root/xx-featuredprojects.rst
+++ b/lib/lp/app/stories/launchpad-root/xx-featuredprojects.rst
@@ -11,31 +11,14 @@ page and managed via a special admin-only page.
The home page listing
---------------------
-Featured projects are visible to everyone on the home page. One project is
-featured as "project of the day" depending on the current day. As we do not
-know the current day, we replace that selection method in the view with a
-constant value.
-
- >>> def fake_get_day_of_year():
- ... return 4
- ...
- >>> from lp.app.browser.root import LaunchpadRootIndexView
- >>> LaunchpadRootIndexView._get_day_of_year = staticmethod(
- ... fake_get_day_of_year
- ... )
-
Anonymous users will see the list of featured projects with links to the
-projects' pages in Launchpad. The "project of the day" is listed separately.
+projects' pages in Launchpad.
>>> anon_browser.open("http://launchpad.test/")
>>> featured = find_tag_by_id(anon_browser.contents, "homepage-featured")
>>> print(extract_text(featured.h2))
Featured projects
- >>> top_project = featured.find("", "featured-project-top")
- >>> print(extract_text(top_project.h3))
- GNOME
-
>>> featured_list = featured.find("", "featured-projects-list")
>>> for link in featured_list.find_all("a"):
... print(extract_text(link))
@@ -44,6 +27,7 @@ projects' pages in Launchpad. The "project of the day" is listed separately.
Bazaar
Mozilla Firefox
Gentoo
+ GNOME
GNOME Terminal
The Mozilla Project
Mozilla Thunderbird
@@ -98,10 +82,6 @@ is now at index '4' and is therefore displayed as the top project:
>>> anon_browser.open("http://launchpad.test/")
>>> featured = find_tag_by_id(anon_browser.contents, "homepage-featured")
- >>> top_project = featured.find("", "featured-project-top")
- >>> print(extract_text(top_project.h3))
- Gentoo
-
>>> featured_list = featured.find("", "featured-projects-list")
>>> for link in featured_list.find_all("a"):
... print(extract_text(link))
@@ -110,6 +90,7 @@ is now at index '4' and is therefore displayed as the top project:
Gnome Applets
Bazaar
Mozilla Firefox
+ Gentoo
GNOME
GNOME Terminal
The Mozilla Project
@@ -136,11 +117,11 @@ that Apache has been removed:
>>> for link in featured.find_all("a"):
... print(extract_text(link))
...
- GNOME
Gnome Applets
Bazaar
Mozilla Firefox
Gentoo
+ GNOME
GNOME Terminal
The Mozilla Project
Mozilla Thunderbird
diff --git a/lib/lp/app/templates/root-index.pt b/lib/lp/app/templates/root-index.pt
index 75084b9..87a1e65 100644
--- a/lib/lp/app/templates/root-index.pt
+++ b/lib/lp/app/templates/root-index.pt
@@ -220,21 +220,6 @@
<div id="homepage-featured" class="homepage-portlet">
<h2>Featured projects</h2>
-
- <div class="featured-project-top"
- tal:define="topproject view/featured_projects_top"
- tal:condition="topproject">
- <h3>
- <a tal:attributes="href topproject/fmt:url"
- tal:content="structure topproject/image:logo"><img /></a>
- <a tal:attributes="href topproject/fmt:url"
- tal:content="topproject/displayname">Foo project</a>
- </h3>
- <p tal:content="structure view/featured_projects_top/summary/fmt:shorten/200">
- Foo project is great...
- </p>
- </div>
-
<div class="two-column-list">
<ul class="featured-projects-list">
<li tal:repeat="project view/featured_projects">