Changeset 568


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

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

Location:
trunk
Files:
2 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
  • trunk/web-app/js/jsUtil.js

    r358 r568  
    2424}
    2525
     26function toggleWithEffectUtil(id) {
     27    if( $(id).visible() ) {
     28        Effect.Fade(id,{duration:0.4,queue:'end'});
     29    }
     30    else {
     31        Effect.Appear(id,{duration:0.4,queue:'end'});
     32    }
     33}
     34
    2635function toggleWithImgAndEffectUtil(id, imageId, openImgUrl, closedImgUrl) {
    2736
Note: See TracChangeset for help on using the changeset viewer.