Ignore:
Timestamp:
Jan 14, 2010, 10:51:03 PM (15 years ago)
Author:
gav
Message:

Refactor classes for asset tree refinement.
Regenerate views and controllers to suite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/SectionController.groovy

    r267 r268  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class SystemSectionController extends BaseAppAdminController {
     3class SectionController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
     
    1010    def list = {
    1111        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    12         [ systemSectionInstanceList: SystemSection.list( params ), systemSectionInstanceTotal: SystemSection.count() ]
     12        [ sectionInstanceList: Section.list( params ), sectionInstanceTotal: Section.count() ]
    1313    }
    1414
    1515    def show = {
    16         def systemSectionInstance = SystemSection.get( params.id )
     16        def sectionInstance = Section.get( params.id )
    1717
    18         if(!systemSectionInstance) {
    19             flash.message = "SystemSection not found with id ${params.id}"
     18        if(!sectionInstance) {
     19            flash.message = "Section not found with id ${params.id}"
    2020            redirect(action:list)
    2121        }
    22         else { return [ systemSectionInstance : systemSectionInstance ] }
     22        else { return [ sectionInstance : sectionInstance ] }
    2323    }
    2424
    2525    def delete = {
    26         def systemSectionInstance = SystemSection.get( params.id )
    27         if(systemSectionInstance) {
     26        def sectionInstance = Section.get( params.id )
     27        if(sectionInstance) {
    2828            try {
    29                 systemSectionInstance.delete(flush:true)
    30                 flash.message = "SystemSection ${params.id} deleted"
     29                sectionInstance.delete(flush:true)
     30                flash.message = "Section ${params.id} deleted"
    3131                redirect(action:list)
    3232            }
    3333            catch(org.springframework.dao.DataIntegrityViolationException e) {
    34                 flash.message = "SystemSection ${params.id} could not be deleted"
     34                flash.message = "Section ${params.id} could not be deleted"
    3535                redirect(action:show,id:params.id)
    3636            }
    3737        }
    3838        else {
    39             flash.message = "SystemSection not found with id ${params.id}"
     39            flash.message = "Section not found with id ${params.id}"
    4040            redirect(action:list)
    4141        }
     
    4343
    4444    def edit = {
    45         def systemSectionInstance = SystemSection.get( params.id )
     45        def sectionInstance = Section.get( params.id )
    4646
    47         if(!systemSectionInstance) {
    48             flash.message = "SystemSection not found with id ${params.id}"
     47        if(!sectionInstance) {
     48            flash.message = "Section not found with id ${params.id}"
    4949            redirect(action:list)
    5050        }
    5151        else {
    52             return [ systemSectionInstance : systemSectionInstance ]
     52            return [ sectionInstance : sectionInstance ]
    5353        }
    5454    }
    5555
    5656    def update = {
    57         def systemSectionInstance = SystemSection.get( params.id )
    58         if(systemSectionInstance) {
     57        def sectionInstance = Section.get( params.id )
     58        if(sectionInstance) {
    5959            if(params.version) {
    6060                def version = params.version.toLong()
    61                 if(systemSectionInstance.version > version) {
     61                if(sectionInstance.version > version) {
    6262                   
    63                     systemSectionInstance.errors.rejectValue("version", "systemSection.optimistic.locking.failure", "Another user has updated this SystemSection while you were editing.")
    64                     render(view:'edit',model:[systemSectionInstance:systemSectionInstance])
     63                    sectionInstance.errors.rejectValue("version", "section.optimistic.locking.failure", "Another user has updated this Section while you were editing.")
     64                    render(view:'edit',model:[sectionInstance:sectionInstance])
    6565                    return
    6666                }
    6767            }
    68             systemSectionInstance.properties = params
    69             if(!systemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {
    70                 flash.message = "SystemSection ${params.id} updated"
    71                 redirect(action:show,id:systemSectionInstance.id)
     68            sectionInstance.properties = params
     69            if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) {
     70                flash.message = "Section ${params.id} updated"
     71                redirect(action:show,id:sectionInstance.id)
    7272            }
    7373            else {
    74                 render(view:'edit',model:[systemSectionInstance:systemSectionInstance])
     74                render(view:'edit',model:[sectionInstance:sectionInstance])
    7575            }
    7676        }
    7777        else {
    78             flash.message = "SystemSection not found with id ${params.id}"
     78            flash.message = "Section not found with id ${params.id}"
    7979            redirect(action:list)
    8080        }
     
    8282
    8383    def create = {
    84         def systemSectionInstance = new SystemSection()
    85         systemSectionInstance.properties = params
    86         return ['systemSectionInstance':systemSectionInstance]
     84        def sectionInstance = new Section()
     85        sectionInstance.properties = params
     86        return ['sectionInstance':sectionInstance]
    8787    }
    8888
    8989    def save = {
    90         def systemSectionInstance = new SystemSection(params)
    91         if(!systemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {
    92             flash.message = "SystemSection ${systemSectionInstance.id} created"
    93             redirect(action:show,id:systemSectionInstance.id)
     90        def sectionInstance = new Section(params)
     91        if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) {
     92            flash.message = "Section ${sectionInstance.id} created"
     93            redirect(action:show,id:sectionInstance.id)
    9494        }
    9595        else {
    96             render(view:'create',model:[systemSectionInstance:systemSectionInstance])
     96            render(view:'create',model:[sectionInstance:sectionInstance])
    9797        }
    9898    }
Note: See TracChangeset for help on using the changeset viewer.