Ignore:
Timestamp:
Mar 24, 2009, 3:30:12 AM (16 years ago)
Author:
gav
Message:

Start creating 'Detail views for Task. Add to BootStrap?. Small change to css.

Location:
branches/TaskRewrite/src
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/TaskRewrite/src/grails-app/conf/BootStrap.groovy

    r73 r84  
    227227        subTaskInstance.parentTask = Task.get(1)
    228228
     229        subTaskInstance = new Task(taskGroup:TaskGroup.findByName("Engineering Activites"),
     230                 taskStatus:TaskStatus.findByName("Not Started"),
     231                 taskPriority:TaskPriority.get(2),
     232                 taskType:TaskType.get(1),
     233                 leadPerson:Person.get(3),
     234                 description:"Replace sensor at next opportunity.",
     235                 comment:"Nothing else has worked.")
     236        BootStrapSaveAndTest(subTaskInstance)
     237        subTaskInstance.addToAssignedPersons(Person.get(1))
     238
     239        //Add task 3 as a subTask of task 1.
     240        taskInstance.addToSubTasks(Task.get(3))
     241        subTaskInstance.parentTask = Task.get(1)
     242
    229243        taskInstance = new Task(taskGroup:TaskGroup.findByName("Production Activites"),
    230244                 taskStatus:TaskStatus.findByName("Not Started"),
     
    259273        entryTypeInstance = new EntryType(name:"Work Request")
    260274        BootStrapSaveAndTest(entryTypeInstance)
     275
     276        //Entry
     277        def entryInstance
     278
     279        entryInstance = new Entry(enteredBy: Person.get(6),
     280                                                    task: Task.get(1),
     281                                                    entryType: EntryType.findByName("Fault"),
     282                                                    comment: "This level sensor is causing us trouble.",
     283                                                    durationMinute: 20)
     284        BootStrapSaveAndTest(entryInstance)
     285
     286        entryInstance = new Entry(enteredBy: Person.get(4),
     287                                                    task: Task.get(1),
     288                                                    entryType: EntryType.findByName("WorkDone"),
     289                                                    comment: "Cleaned sensor, see how it goes.",
     290                                                    durationMinute: 30)
     291        BootStrapSaveAndTest(entryInstance)
     292
     293        entryInstance = new Entry(enteredBy: Person.get(4),
     294                                                    task: Task.get(1),
     295                                                    entryType: EntryType.findByName("WorkDone"),
     296                                                    comment: "Checked up on it later and sensor is dropping out intermittently, created subTask to replace sensor.",
     297                                                    durationMinute: 20)
     298        BootStrapSaveAndTest(entryInstance)
    261299
    262300        //ModificationType
  • branches/TaskRewrite/src/grails-app/controllers/TaskController.groovy

    r74 r84  
    66
    77    // the delete, save and update actions only accept POST requests
    8     static allowedMethods = [delete:'POST', save:'POST', update:'POST']
     8    static allowedMethods = [delete:'POST', deleteDetailed:'POST', save:'POST', saveDetailed:'POST', updateDetailed:'POST']
    99
     10    @Secured(['ROLE_AppAdmin'])
    1011    def list = {
    1112        if(!params.max) params.max = 10
     
    1314    }
    1415
     16    def listDetailed = {
     17        if(!params.max) params.max = 10
     18        [ taskInstanceList: Task.list( params ) ]
     19    }
     20
     21    @Secured(['ROLE_AppAdmin'])
    1522    def show = {
    1623        def taskInstance = Task.get( params.id )
     
    2330    }
    2431
     32    def showDetailed = {
     33        def taskInstance = Task.get( params.id )
     34
     35        if(!taskInstance) {
     36            flash.message = "Task not found with id ${params.id}"
     37            redirect(action:list)
     38        }
     39        else { return [ taskInstance : taskInstance ] }
     40    }
     41
     42    @Secured(['ROLE_AppAdmin'])     
    2543    def delete = {
    2644        def taskInstance = Task.get( params.id )
     
    3654    }
    3755
     56    def deleteDetailed = {
     57        def taskInstance = Task.get( params.id )
     58        if(taskInstance) {
     59            taskInstance.delete()
     60            flash.message = "Task ${params.id} deleted"
     61            redirect(action:list)
     62        }
     63        else {
     64            flash.message = "Task not found with id ${params.id}"
     65            redirect(action:list)
     66        }
     67    }
     68
     69    @Secured(['ROLE_AppAdmin'])
    3870    def edit = {
    3971        def taskInstance = Task.get( params.id )
     
    4880    }
    4981
     82    def editDetailed = {
     83        def taskInstance = Task.get( params.id )
     84
     85        if(!taskInstance) {
     86            flash.message = "Task not found with id ${params.id}"
     87            redirect(action:list)
     88        }
     89        else {
     90            def criteria = taskInstance.createCriteria()
     91            def results = criteria {
     92                and {
     93                    notEqual('id', taskInstance.id)
     94                    }
     95            }
     96            return [ taskInstance : taskInstance, possibleParentList: results ]
     97        }
     98    }
     99
     100    @Secured(['ROLE_AppAdmin'])
    50101    def update = {
    51102        def taskInstance = Task.get( params.id )
     
    66117    }
    67118
     119    def updateDetailed = {
     120        def taskInstance = Task.get( params.id )
     121        if(taskInstance) {
     122            taskInstance.properties = params
     123            if(!taskInstance.hasErrors() && taskInstance.save()) {
     124                flash.message = "Task ${params.id} updated"
     125                redirect(action:show,id:taskInstance.id)
     126            }
     127            else {
     128                render(view:'edit',model:[taskInstance:taskInstance])
     129            }
     130        }
     131        else {
     132            flash.message = "Task not found with id ${params.id}"
     133            redirect(action:edit,id:params.id)
     134        }
     135    }
     136
     137    @Secured(['ROLE_AppAdmin'])
    68138    def create = {
    69139        def taskInstance = new Task()
     
    72142    }
    73143
     144    def createDetailed = {
     145        def taskInstance = new Task()
     146        taskInstance.properties = params
     147        return ['taskInstance':taskInstance]
     148    }
     149
     150    @Secured(['ROLE_AppAdmin'])
    74151    def save = {
    75152        def taskInstance = new Task(params)
     
    82159        }
    83160    }
     161
     162    def saveDetailed = {
     163        def taskInstance = new Task(params)
     164        if(!taskInstance.hasErrors() && taskInstance.save()) {
     165            flash.message = "Task ${taskInstance.id} created"
     166            redirect(action:showDetailed,id:taskInstance.id)
     167        }
     168        else {
     169            render(view:'createDetailed',model:[taskInstance:taskInstance])
     170        }
     171    }
    84172}
  • branches/TaskRewrite/src/grails-app/views/appCore/admin.gsp

    r71 r84  
    1212        <div class="body">
    1313            <h1>Welcome to Admin</h1>
     14            <div class="errors">
     15                "Warning these pages are for use by the application admin only and not for daily use." <br />
     16                "They allow direct administration of the back-end data, cascade deletion and updates may occur."
     17            </div>
    1418            <br/>
    1519            <div class="dialog">
  • branches/TaskRewrite/src/grails-app/views/appCore/home.gsp

    r73 r84  
    88    <body>
    99        <div class="nav">
    10             <span class="menuButton"><g:link class="list" controller="task" action="list">Tasks</g:link></span>
     10            <span class="menuButton"><g:link class="list" controller="task" action="listDetailed">Tasks</g:link></span>
    1111
    1212        </div>
  • branches/TaskRewrite/src/web-app/css/main.css

    r80 r84  
    294294    color: #666;
    295295    font-size: 10px;
    296     margin-top: 5px;
     296    margin-top: -1px;
     297    margin-bottom: 5px;
    297298    overflow: hidden;
    298299    padding: 0;
Note: See TracChangeset for help on using the changeset viewer.