Changeset 308


Ignore:
Timestamp:
Feb 1, 2010, 10:09:46 AM (14 years ago)
Author:
gav
Message:

Add a create site link to asset tree taglib if there are no sites yet.
Add a create department link to section create and edit views.

Location:
trunk/grails-app
Files:
3 edited

Legend:

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

    r307 r308  
    11/**
    22* Asset Tree tags.
    3 * Specific to gnumims hence the namespace.
     3* Specific to gnuMims hence the namespace.
    44*/
    55class AssetTreeTagLib {
     
    4848
    4949        def mkp = new groovy.xml.MarkupBuilder(out) //this line will be unnecessary in versions of Grails after version 1.2
     50
     51        // Offer a site create link if no sites are found.
     52        if(!sites) {
     53            mkp.div(class: 'overlayPane', id: 'assetTreePane', style: 'display:none;') {
     54                div(class: 'tree', id: 'assetTreeTable') {
     55                    table() {
     56                        tr() {
     57                            td( valign: 'top', class: 'value') {
     58                                ul() {
     59                                    img(src: treeRootImg(), alt: 'TreeRoot')
     60                                    li() {
     61                                        a(href: siteCreateLink()) {
     62                                            img(src: addImg(), alt: 'Add', title: 'Add Site')
     63                                        }
     64                                    } // li
     65                                } // ul
     66                            } // td
     67                        } // tr
     68                    } // table
     69                } // div
     70
     71                div( class: 'buttons') {
     72                    span(class: 'button') {
     73                        input( type: 'button', value: 'Close', onclick: hideAssetTreePane() )
     74                    }
     75                } // button div
     76            } // mkp
     77            return
     78        } // if(!sites)
    5079
    5180
     
    285314    /** Links */
    286315
     316    def siteCreateLink() {
     317        createLink(controller: 'siteDetailed', action: 'create').toString()
     318    }
    287319    def siteShowLink(id) {
    288320        createLink(controller: 'siteDetailed', action: 'show', params: ['id': id] ).toString()
  • trunk/grails-app/views/sectionDetailed/create.gsp

    r273 r308  
    5959                                <td valign="top" class="value ${hasErrors(bean:sectionInstance,field:'department','errors')}">
    6060                                    <g:select optionKey="id" from="${Department.list()}" name="department.id" value="${sectionInstance?.department?.id}" ></g:select>
     61                                    <p>
     62                                        <g:link controller="departmentDetailed" action="create">Add Department</g:link>
     63                                    </p>
    6164                                </td>
    6265                            </tr>
  • trunk/grails-app/views/sectionDetailed/edit.gsp

    r288 r308  
    7878                                <td valign="top" class="value ${hasErrors(bean:sectionInstance,field:'department','errors')}">
    7979                                    <g:select optionKey="id" from="${Department.list()}" name="department.id" value="${sectionInstance?.department?.id}" ></g:select>
     80                                    <p>
     81                                        <g:link controller="departmentDetailed" action="create">Add Department</g:link>
     82                                    </p>
    8083                                </td>
    8184                            </tr>
Note: See TracChangeset for help on using the changeset viewer.