Repository: fedora-infra/bodhi

Issue:
No browsing of updates based on releases
Please add one more tab on right upper top "Releases" that will allow to browse updated submitted for that particular release. 
e.g. Like in old interface, In new interface when clicked on "Releases" tab, it should show all active releases like for "Fedora 23" should show https://bodhi.fedoraproject.org/updates/?releases=F23



Discussion:
Let's have it link to https://bodhi.fedoraproject.org/releases/F23

From there you can click the `View all` link and get to the list of all updates for that release.


Resolving patch:
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -12,14 +12,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-import pkg_resources
-
 from collections import defaultdict
 from dogpile.cache import make_region
 from sqlalchemy import engine_from_config
 
 from pyramid.settings import asbool
-from pyramid.decorator import reify
 from pyramid.security import unauthenticated_userid
 from pyramid.config import Configurator
 from pyramid.authentication import AuthTktAuthenticationPolicy
@@ -78,6 +75,10 @@ def get_buildinfo(request):
     return defaultdict(dict)
 
 
+def get_releases(request):
+    from bodhi.models import Release
+    return Release.all_releases()
+
 #
 # Cornice filters
 #
@@ -133,6 +134,7 @@ def main(global_config, testing=None, **settings):
     config.add_request_method(get_dbsession, 'db', reify=True)
     config.add_request_method(get_cacheregion, 'cache', reify=True)
     config.add_request_method(get_buildinfo, 'buildinfo', reify=True)
+    config.add_request_method(get_releases, 'releases', reify=True)
 
     # Templating
     config.add_mako_renderer('.html', settings_prefix='mako.')
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -313,6 +313,17 @@ def collection_name(self):
         """ Return the collection name of this release.  (eg: Fedora EPEL) """
         return ' '.join(self.long_name.split()[:-1])
 
+    @classmethod
+    def all_releases(cls):
+        if cls._all_releases:
+            return cls._all_releases
+        releases = defaultdict(list)
+        for release in DBSession.query(cls).order_by(cls.name).all():
+            releases[release.state.value].append(release.__json__())
+        cls._all_releases = releases
+        return cls._all_releases
+    _all_releases = None
+
     @classmethod
     def get_tags(cls):
         if cls._tag_cache:


Test patch:
diff --git a/bodhi/tests/models/test_models.py b/bodhi/tests/models/test_models.py
--- a/bodhi/tests/models/test_models.py
+++ b/bodhi/tests/models/test_models.py
@@ -59,6 +59,13 @@ class TestRelease(ModelTest):
     def test_version_int(self):
         eq_(self.obj.version_int, 11)
 
+    def test_all_releases(self):
+        releases = model.Release.all_releases()
+        assert 'current' in releases, releases
+        assert releases['current'][0]['name'] == 'F11', releases
+        # Make sure it's the same cached object
+        assert releases is model.Release.all_releases()
+
 
 class MockWiki(object):
     """ Mocked simplemediawiki.MediaWiki class. """