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

Last change on this file since 387 was 322, checked in by gav, 15 years ago

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

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