Changeset 568 for trunk/grails-app


Ignore:
Timestamp:
Jun 4, 2010, 11:45:14 PM (14 years ago)
Author:
gav
Message:

JavaScript? util improvements, added toggleWithEffectUtil() and useDiv option to toggleControl taglib.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/JsUtilTagLib.groovy

    r323 r568  
    2525    * @param effect The effect to apply, 'fade' uses the fade/appear effect while the default is to just toggle.
    2626    * @param text The text, if any, to display.
     27    * @param useDiv Whether or not to use a wrapping div, default is 'true'.
    2728    */
    2829    def toggleControl = { attrs ->
     
    3738            toggleJs = js.toggleWithImg(attrs.toggleId, attrs.imageId, attrs.openImgUrl, attrs.closedImgUrl)
    3839
    39         mkp.div() {
    40             a( href: toggleJs ) {
    41                 yieldUnescaped(attrs.text)
    42                 img(id: attrs.imageId, src: attrs.closedImgUrl, alt: "Show")
    43             }
    44         } // mkp
     40        if(attrs.useDiv == 'false') {
     41            mkp.a( href: toggleJs ) {
     42                    yieldUnescaped(attrs.text)
     43                    img(id: attrs.imageId, src: attrs.closedImgUrl, alt: "Show")
     44            } // mkp
     45
     46        }
     47        else {
     48            mkp.div() {
     49                a( href: toggleJs ) {
     50                    yieldUnescaped(attrs.text)
     51                    img(id: attrs.imageId, src: attrs.closedImgUrl, alt: "Show")
     52                }
     53            } // mkp
     54        }
    4555
    4656    } // hideShowControl
Note: See TracChangeset for help on using the changeset viewer.