Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add screencasts, websites, and tutorials to site search.

The global site search only included wiki pages and plugins in its results, but this doesn't make a lot of sense when you can search for screencasts etc. through a different interface. So, anything that's searchable can now be searched for via the site search.
  • Loading branch information...
commit 666e22ab8825b4c1d479d2b72e9ee70feb319351 1 parent e4ee81c
@pledbrook pledbrook authored
View
12 grails-app/controllers/org/grails/ContentController.groovy
@@ -16,12 +16,14 @@ import org.grails.content.Content
import org.grails.content.Version
import org.grails.content.WikiImage
import org.grails.content.notifications.ContentAlertStack
-import org.grails.wiki.BaseWikiController
-import org.grails.wiki.WikiPage
import org.grails.plugin.Plugin
import org.grails.plugin.PluginController
import org.grails.plugin.PluginTab
import org.grails.screencasts.Screencast
+import org.grails.tutorials.Tutorial
+import org.grails.websites.WebSite
+import org.grails.wiki.BaseWikiController
+import org.grails.wiki.WikiPage
import org.springframework.web.context.request.RequestContextHolder
import org.springframework.web.multipart.MultipartFile
@@ -81,7 +83,11 @@ class ContentController extends BaseWikiController {
if(params.q) {
def q = "+(${params.q}) -deprecated:true".toString()
try {
- def searchResult = searchableService.search(q, classes: [WikiPage, Plugin], offset: params.offset, escape:false)
+ def searchResult = searchableService.search(
+ q,
+ classes: [WikiPage, Plugin, Screencast, WebSite, Tutorial],
+ offset: params.offset,
+ escape:false)
flash.message = "Found $searchResult.total results!"
flash.next()
render view:"/searchable/index", model: [searchResult: searchResult]
View
15 grails-app/views/searchable/index.gsp
@@ -1,5 +1,6 @@
+<%@ page import="grails.util.GrailsNameUtils" %>
<%@ page import="org.grails.plugin.Plugin" %>
-<%@ page import="org.grails.screencasts.Screencast"%>
+<%@ page import="org.grails.content.Content"%>
<%@ page import="org.springframework.util.ClassUtils" %>
<html>
<head>
@@ -56,13 +57,15 @@
<g:link controller="plugin" action="show" params="${[name:result.name]}">Plugin > ${className}</g:link>
<g:set var="desc" value="${result.summary ?: 'No description'}"/>
</g:if>
- <g:elseif test="${result instanceof Screencast}">
- <g:link controller="screencast" action="show" id="${result.id}">Screencast > ${className}</g:link>
- <g:set var="desc" value="${result.description ?: 'No description'}"/>
- </g:elseif>
- <g:else>
+ <g:elseif test="${result instanceof Content}">
<g:link controller="content" id="${result.title}">Wiki page > ${className}</g:link>
<g:set var="desc" value="${result.body}"/>
+ </g:elseif>
+ <g:else>
+ <g:set var="itemName" value="${GrailsNameUtils.getShortName(result.class.name)}"/>
+ <g:link controller="${GrailsNameUtils.getPropertyName(itemName)}"
+ action="show" id="${result.id}">${itemName} > ${className}</g:link>
+ <g:set var="desc" value="${result.description ?: 'No description'}"/>
</g:else>
</div>

0 comments on commit 666e22a

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