Changeset 987


Ignore:
Timestamp:
Oct 25, 2010, 4:23:39 PM (10 years ago)
Author:
robert@…
Message:

Fixed bug #15

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/PersonAffiliationController.groovy

    r959 r987  
    4848    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
    4949
     50        /**
     51     * Fires after every action and determines the layout of the page
     52     */
     53    def afterInterceptor = { model, modelAndView ->
     54      println( params );
     55
     56      if ( params['dialog'] ) {
     57        model.layout = 'dialog';
     58        model.extraparams = [ 'dialog': 'true' ] ;
     59      } else {
     60        model.layout = 'main';
     61        model.extraparams = [] ;
     62      }
     63    }
     64
    5065    def index = {
    5166        redirect(action: "list", params: params)
     
    6580    def save = {
    6681        def personAffiliationInstance = new PersonAffiliation(params)
     82        def extraparams = new LinkedHashMap();
     83
     84        if( params[ 'dialog' ] ) {
     85          extraparams[ 'dialog' ] = params[ 'dialog' ]
     86        }
     87
    6788        if (personAffiliationInstance.save(flush: true)) {
    6889            flash.message = "${message(code: 'default.created.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), personAffiliationInstance])}"
    69             redirect(action: "show", id: personAffiliationInstance.id)
     90            redirect(action: "show", id: personAffiliationInstance.id, params: extraparams)
    7091        }
    7192        else {
     
    98119    def update = {
    99120        def personAffiliationInstance = PersonAffiliation.get(params.id)
     121
     122        def extraparams = new LinkedHashMap();
     123
     124        if( params[ 'dialog' ] ) {
     125          extraparams[ 'dialog' ] = params[ 'dialog' ]
     126        }
     127
    100128        if (personAffiliationInstance) {
    101129            if (params.version) {
     
    111139            if (!personAffiliationInstance.hasErrors() && personAffiliationInstance.save(flush: true)) {
    112140                flash.message = "${message(code: 'default.updated.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), personAffiliationInstance])}"
    113                 redirect(action: "show", id: personAffiliationInstance.id)
     141                redirect(action: "show", id: personAffiliationInstance.id, params: extraparams)
    114142            }
    115143            else {
     
    119147        else {
    120148            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), params.id])}"
    121             redirect(action: "list")
     149            redirect(action: "list", params: extraparams)
    122150        }
    123151    }
     
    125153    def delete = {
    126154        def personAffiliationInstance = PersonAffiliation.get(params.id)
     155
     156        def extraparams = new LinkedHashMap();
     157
     158        if( params[ 'dialog' ] ) {
     159          extraparams[ 'dialog' ] = params[ 'dialog' ]
     160        }
     161
    127162        if (personAffiliationInstance) {
    128163            def affiliationName = personAffiliationInstance.toString()
     
    130165                personAffiliationInstance.delete(flush: true)
    131166                flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), affiliationName])}"
    132                 redirect(action: "list")
     167                redirect(action: "list", params: extraparams)
    133168            }
    134169            catch (org.springframework.dao.DataIntegrityViolationException e) {
    135170                flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), affiliationName])}"
    136                 redirect(action: "show", id: params.id)
     171                redirect(action: "show", id: params.id, params: extraparams)
    137172            }
    138173        }
    139174        else {
    140175            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'personAffiliation.label', default: 'Affiliation'), params.id])}"
    141             redirect(action: "list")
     176            redirect(action: "list", params: extraparams)
    142177        }
    143178    }
  • trunk/grails-app/views/person/edit.gsp

    r959 r987  
    126126                                <td colspan="3" valign="top" class="value ${hasErrors(bean: personInstance, field: 'affiliations', 'errors')}">
    127127                                    <g:select name="affiliations" from="${dbnp.studycapturing.PersonAffiliation.list()}" multiple="yes" optionKey="id" size="5" value="${personInstance?.affiliations}" />
    128                                 </td>
     128
     129                                                                        <g:link controller="personAffiliation" action="list" params="${extraparams}">Edit Affiliations</g:link>
     130                                                                </td>
    129131                            </tr>
    130132                       
  • trunk/grails-app/views/person/list.gsp

    r959 r987  
    6464            <div class="buttons">
    6565                <span class="button"><g:link class="create" action="create" params="${extraparams}"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
    66             </div>
     66                                <span class="button"><g:link class="otherList" controller="personAffiliation" action="list" params="${extraparams}">Edit Affiliations</g:link></span>
     67                        </div>
    6768            <div class="paginateButtons">
    6869                <g:paginate total="${personInstanceTotal}" prev="&laquo; Previous" next="&raquo; Next" params="${extraparams}" />
  • trunk/grails-app/views/personAffiliation/create.gsp

    r959 r987  
    44    <head>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    6         <meta name="layout" content="main" />
     6        <meta name="layout" content="${layout}" />
    77        <g:set var="entityName" value="${message(code: 'personAffiliation.label', default: 'PersonAffiliation')}" />
    88        <title><g:message code="default.create.label" args="['Affiliation']" /></title>
     
    4545                </div>
    4646                <div class="buttons">
     47                   <g:each in="${extraparams}" var="param">
     48                     <input type="hidden" name="${param.key}" value="${param.value}">
     49                   </g:each>
    4750                   <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
    48                    <span class="button"><g:link class="cancel" action="list">Cancel</g:link></span>
     51                   <span class="button"><g:link class="cancel" action="list" params="${extraparams}">Cancel</g:link></span>
    4952                </div>
    5053            </g:form>
  • trunk/grails-app/views/personAffiliation/edit.gsp

    r959 r987  
    44    <head>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    6         <meta name="layout" content="main" />
     6        <meta name="layout" content="${layout}" />
    77        <g:set var="entityName" value="${message(code: 'personAffiliation.label', default: 'PersonAffiliation')}" />
    88        <title><g:message code="default.edit.label" args="['Affiliation']" /></title>
     
    4646                </div>
    4747                <div class="buttons">
     48                   <g:each in="${extraparams}" var="param">
     49                     <input type="hidden" name="${param.key}" value="${param.value}">
     50                   </g:each>
    4851                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
    4952                    <span class="button"><g:actionSubmit class="cancel" action="show" value="Cancel" /></span>
  • trunk/grails-app/views/personAffiliation/list.gsp

    r959 r987  
    44    <head>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    6         <meta name="layout" content="main" />
     6        <meta name="layout" content="${layout}" />
    77        <g:set var="entityName" value="${message(code: 'personAffiliation.label', default: 'PersonAffiliation')}" />
    88        <title><g:message code="default.list.label" args="['Affiliation']" /></title>
     
    1919                        <tr>
    2020                       
    21                             <g:sortableColumn property="institute" title="${message(code: 'personAffiliation.institute.label', default: 'Institute')}" />
    22                             <g:sortableColumn property="department" title="${message(code: 'personAffiliation.department.label', default: 'Department')}" />
     21                            <g:sortableColumn params="${extraparams}"  property="institute" title="${message(code: 'personAffiliation.institute.label', default: 'Institute')}" />
     22                            <g:sortableColumn params="${extraparams}"  property="department" title="${message(code: 'personAffiliation.department.label', default: 'Department')}" />
    2323                       
    2424                        </tr>
     
    2828                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
    2929                       
    30                             <td><g:link action="show" id="${personAffiliationInstance.id}">${fieldValue(bean: personAffiliationInstance, field: "institute")}</g:link></td>
     30                            <td><g:link params="${extraparams}"  action="show" id="${personAffiliationInstance.id}">${fieldValue(bean: personAffiliationInstance, field: "institute")}</g:link></td>
    3131                            <td>${fieldValue(bean: personAffiliationInstance, field: "department")}</td>
    3232                        </tr>
     
    3636            </div>
    3737            <div class="buttons">
    38                 <span class="button"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
     38                <span class="button"><g:link class="create" params="${extraparams}"  action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
     39                                <span class="button"><g:link class="otherList" controller="person" action="list" params="${extraparams}">Edit Persons</g:link></span>
    3940            </div>
    4041            <div class="paginateButtons">
    41                 <g:paginate total="${personAffiliationInstanceTotal}" prev="&laquo; Previous" next="&raquo; Next" />
     42                <g:paginate params="${extraparams}"  total="${personAffiliationInstanceTotal}" prev="&laquo; Previous" next="&raquo; Next" />
    4243            </div>
    4344        </div>
  • trunk/grails-app/views/personAffiliation/show.gsp

    r959 r987  
    44    <head>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    6         <meta name="layout" content="main" />
     6        <meta name="layout" content="${layout}" />
    77        <g:set var="entityName" value="${message(code: 'personAffiliation.label', default: 'PersonAffiliation')}" />
    88        <title><g:message code="default.show.label" args="['Affiliation']" /></title>
     
    3737                <g:form>
    3838                    <g:hiddenField name="id" value="${personAffiliationInstance?.id}" />
     39                   <g:each in="${extraparams}" var="param">
     40                     <input type="hidden" name="${param.key}" value="${param.value}">
     41                   </g:each>
     42
    3943                    <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
    4044                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
    41                     <span class="button"><g:link class="backToList" action="list">Back to list</g:link></span>
     45                    <span class="button"><g:link class="backToList" action="list" params="${extraparams}">Back to list</g:link></span>
    4246                </g:form>
    4347            </div>
  • trunk/web-app/css/default_style.css

    r980 r987  
    277277        font-weight: normal;
    278278}
     279.buttons input.otherList, .buttons a.otherList {
     280        background: transparent url(../plugins/famfamfam-1.0.1/images/icons/application_view_detail.png) 5px 50% no-repeat;
     281        padding-left: 28px;
     282}
    279283
    280284/* Reset the font weight for buttons occurring within the table */
  • trunk/web-app/css/dialog.css

    r980 r987  
    188188        font-weight: normal;
    189189}
     190.buttons input.otherList, .buttons a.otherList {
     191        background: transparent url(../plugins/famfamfam-1.0.1/images/icons/application_view_detail.png) 5px 50% no-repeat;
     192        padding-left: 28px;
     193}
    190194
    191195/* Reset the font weight for buttons occurring within the table */
Note: See TracChangeset for help on using the changeset viewer.