source: trunk/grails-app/taglib/AssetTreeTagLib.groovy @ 409

Last change on this file since 409 was 322, checked in by gav, 14 years ago

Move JavascriptService to JsUtilService.
Consolidate similar JsUtilService methods.
Create JsUtilTagLib?.
Disable pulsing of asset tree loading image.

File size: 1.9 KB
RevLine 
[286]1/**
2* Asset Tree tags.
[308]3* Specific to gnuMims hence the namespace.
[286]4*/
[278]5class AssetTreeTagLib {
[306]6    static namespace = 'gnuMims'
[278]7
[322]8    def js = new JsUtilService()
[312]9    def ts = new AssetTreeService()
10
11    /**
12    * Include required javascript and do setup here.
13    */
[278]14    def resources = { attrs ->
[312]15        out << g.javascript(src: "assetTree.js")
[278]16    }
17
[312]18    /**
19    * Button that opens the asset tree pane and calls the javascript to populate it.
20    */
21    def assetTreeButton = { attrs ->
[306]22        def mkp = new groovy.xml.MarkupBuilder(out) //this line will be unnecessary in versions of Grails after version 1.2
23
[312]24        mkp.div( class: ts.buttonHtmlClass() ) {
25            a( href: ts.hrefShowPane() ) {
26                img(src: ts.treeRootImg())
[306]27            }
[312]28        } // mkp
29    } // assetTreeButton
[306]30
[312]31    /**
32    * The asset tree pane, ready for populating by an ajax call to AssetTreeSevice.
33    */
34    def assetTreePane = { attrs ->
[278]35        def mkp = new groovy.xml.MarkupBuilder(out) //this line will be unnecessary in versions of Grails after version 1.2
36
[312]37        mkp.div(class: ts.paneHtmlClass(), id: ts.paneHtmlId(), style: 'display:none;') {
38            div(class: ts.paneCloseHtmlClass()) {
[322]39                a( href: js.toggle(ts.paneHtmlId()) ) {
[312]40                    img(src: ts.closeImg())
41                }
42            }
[278]43
[312]44            div(class: ts.tableDivHtmlClass()) {
45                table(id: ts.tableHtmlId()) {
[306]46                    tr() {
[312]47                        td(valign: 'top', class: 'value') {
[278]48                            ul() {
[312]49                                img(src: ts.treeRootImg(), id: ts.tableLoadingImgId(), alt: 'TreeRoot')
50                                li() {
51                                } // li
[306]52                            } // ul
53                        } // td
54                    } // tr
55                } // table
56            } // div
[278]57        } // mkp
[312]58    } // assetTreePane
[278]59
60} // end class
Note: See TracBrowser for help on using the repository browser.