Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

added latest download to homepage

  • Loading branch information...
commit 26d115fc187e399507a4c58064ee0a216170fc54 1 parent 386dd97
@cavneb cavneb authored
9 grails-app/controllers/org/grails/ContentController.groovy
@@ -31,6 +31,7 @@ class ContentController extends BaseWikiController {
def searchableService
def screencastService
def pluginService
+ def downloadService
def dateService
def textCache
def wikiPageService
@@ -486,6 +487,11 @@ class ContentController extends BaseWikiController {
def homePage() {
// Homepage needs latest plugins
def newestPlugins = pluginService.newestPlugins(4)
+ // Split the downloads into stable and non-stable.
+ def groupedDownloads = downloadService.buildGroupedDownloads()
+ def latestDownload = ((HashMap)groupedDownloads['latest']).values()
def newsItems = BlogEntry.list(max:3, cache:true, order:"desc", sort:"dateCreated")
// make it easy to get the month and day
@@ -498,7 +504,8 @@ class ContentController extends BaseWikiController {
def latestScreencastId = screencastService.latestScreencastId
- return [ newestPlugins: newestPlugins,
+ return [ latestDownload: latestDownload,
+ newestPlugins: newestPlugins,
newsItems: newsItems,
latestScreencastId: latestScreencastId ]
5 grails-app/views/content/homePage.gsp
@@ -7,6 +7,9 @@
<meta content="master" name="layout"/>
<r:require modules="homepage"/>
+ <g:set var="download" value="${latestDownload ? latestDownload['download'][0] : null}"/>
+ <g:set var="binaries" value="${latestDownload ? latestDownload['binary'] : null}"/>
<feed:meta kind="rss" version="2.0" controller="blog" action="feed" params="[format: 'rss']"/>
<feed:meta kind="atom" version="1.0" controller="blog" action="feed" params="[format: 'atom']"/>
@@ -22,7 +25,7 @@
- <a href="/download" class="btn">Download Grails 2.1</a>&nbsp;&nbsp;
+ <a href="${binaries[0].mirrors[0][0].urlString}" class="btn">Download Grails ${download.softwareVersion}</a>&nbsp;&nbsp;
@pledbrook Collaborator

We should think of a better way of doing this, perhaps through a tag. Array indexes obfuscate and tend to be quite fragile too. It probably makes sense to transform the database model into a map that just contains the data the view needs, e.g.

latestDownload: [version: latestDownload['download'][0].softwareVersion, mirrors: ....]

Not sure what the ideal code would be, but I hope you get my drift :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
<a href="/learn" class="btn primary">Start using Grails!</a>

0 comments on commit 26d115f

Please sign in to comment.
Something went wrong with that request. Please try again.