Index: /trunk/grails-app/i18n/messages.properties =================================================================== --- /trunk/grails-app/i18n/messages.properties (revision 322) +++ /trunk/grails-app/i18n/messages.properties (revision 323) @@ -116,4 +116,5 @@ default.close.text=Close +default.options.text=Options default.list.failure=Could not generate list for class {0}. Index: /trunk/grails-app/services/JsUtilService.groovy =================================================================== --- /trunk/grails-app/services/JsUtilService.groovy (revision 322) +++ /trunk/grails-app/services/JsUtilService.groovy (revision 323) @@ -70,3 +70,22 @@ } + /** + * Toggle the visibility of an html element and update an image. + * @param toggleId The html id of the element to toggle. + * @param imageid The html id of the image to update. + * @param openImgUrl The url to apply as the image src when toggled element is visible. + * @param closedImgUrl The url to apply as the image src when toggled element is hidden. + * @param type The type of html action the javascript will be applied to e.g 'onclick', defaults to 'href'. + * @returns A javascript string that can be assigned for example to an anchor href or onclick action. + */ + def toggleWithImgAndEffect(toggleId, imageid, openImgUrl, closedImgUrl, type="href") { + + def s = 'toggleWithImgAndEffectUtil(\"' + toggleId +'\", \"' + imageid +'\", \"' + openImgUrl +'\", \"' + closedImgUrl +'\");' + if(type == "onclick") + s + ' return false;' + else + 'javascript: ' + s + + } + } // end class Index: /trunk/grails-app/taglib/JsUtilTagLib.groovy =================================================================== --- /trunk/grails-app/taglib/JsUtilTagLib.groovy (revision 322) +++ /trunk/grails-app/taglib/JsUtilTagLib.groovy (revision 323) @@ -23,4 +23,5 @@ * @param openImgUrl The url to apply as the image src when toggled element is visible. * @param closedImgUrl The url to apply as the image src when toggled element is hidden. + * @param effect The effect to apply, 'fade' uses the fade/appear effect while the default is to just toggle. * @param text The text, if any, to display. */ @@ -28,6 +29,14 @@ def mkp = new groovy.xml.MarkupBuilder(out) //this line will be unnecessary in versions of Grails after version 1.2 + def toggleJs + + // Do we want to fade/appear or just toggle. + if(attrs.effect == "fade") + toggleJs = js.toggleWithImgAndEffect(attrs.toggleId, attrs.imageId, attrs.openImgUrl, attrs.closedImgUrl) + else + toggleJs = js.toggleWithImg(attrs.toggleId, attrs.imageId, attrs.openImgUrl, attrs.closedImgUrl) + mkp.div() { - a( href: js.toggleWithImg(attrs.toggleId, attrs.imageId, attrs.openImgUrl, attrs.closedImgUrl) ) { + a( href: toggleJs ) { yieldUnescaped(attrs.text) img(id: attrs.imageId, src: attrs.closedImgUrl, alt: "Show") Index: /trunk/grails-app/views/taskDetailed/search.gsp =================================================================== --- /trunk/grails-app/views/taskDetailed/search.gsp (revision 322) +++ /trunk/grails-app/views/taskDetailed/search.gsp (revision 323) @@ -43,24 +43,12 @@ -