Changeset 957 for trunk/grails-app
- Timestamp:
- Jun 30, 2011, 7:55:55 AM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryStoreDetailedController.groovy
r913 r957 3 3 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager']) 4 4 class InventoryStoreDetailedController extends BaseController { 5 5 6 def filterService 7 6 8 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser']) 7 9 def index = { redirect(action:list,params:params) } … … 12 14 def list = { 13 15 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 14 [ inventoryStoreInstanceList: InventoryStore.list( params ), inventoryStoreInstanceTotal: InventoryStore.count() ] 16 def associatedPropertyMax = 1000 17 def associatedPropertyValues = [:] 18 def siteNameQuery = 'select distinct a.name from Site a where a.isActive = ? order by a.name' 19 associatedPropertyValues.siteList = Site.executeQuery(siteNameQuery, [true], [max:associatedPropertyMax]) 20 21 if(!params.filter) { 22 return [inventoryStoreInstanceList: InventoryStore.list(params), 23 inventoryStoreInstanceTotal: InventoryStore.count(), 24 associatedPropertyValues: associatedPropertyValues, 25 filterParams: params] 26 } 27 28 // filterPane: 29 return[ inventoryStoreInstanceList: filterService.filter( params, InventoryStore ), 30 inventoryStoreInstanceTotal: filterService.count( params, InventoryStore ), 31 associatedPropertyValues: associatedPropertyValues, 32 filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params), 33 params:params ] 15 34 } 16 35 … … 73 92 def version = params.version.toLong() 74 93 if(inventoryStoreInstance.version > version) { 75 94 76 95 inventoryStoreInstance.errors.rejectValue("version", "default.optimistic.locking.failure") 77 96 render(view:'edit',model:[inventoryStoreInstance:inventoryStoreInstance]) -
trunk/grails-app/views/inventoryStoreDetailed/list.gsp
r836 r957 1 2 3 1 <html> 4 2 <head> … … 6 4 <meta name="layout" content="main" /> 7 5 <title>InventoryStore List</title> 6 <filterpane:includes /> 8 7 <nav:resources override="true"/> 9 8 </head> … … 13 12 </div> 14 13 <div class="body"> 15 <g:if test="${flash.message}"> 16 <div class="message">${flash.message}</div> 17 </g:if> 18 <div class="list"> 19 <table> 20 <thead> 14 <g:render template="/shared/messages" /> 15 16 <filterpane:currentCriteria domainBean="InventoryStore" 17 action="list" 18 dateFormat="EEE, dd-MMM-yyyy" 19 removeImgDir="images" 20 removeImgFile="bullet_delete.png" 21 title="Search"/> 22 23 <div class="paginateButtons"> 24 Results: ${inventoryStoreInstanceList.size()} / ${inventoryStoreInstanceTotal} 25 <span class="searchButtons"> 26 <filterpane:filterButton text="Search" appliedText="Change Search" /> 27 </span> 28 </div> 29 30 <br /> 31 32 <g:if test="${inventoryStoreInstanceList.size() > 0}"> 33 <div class="list"> 34 <table> 35 <thead> 21 36 <tr> 22 23 <g:sortableColumn property="id" title="Id" />24 37 25 <g:sortableColumn property=" name" title="Name" />38 <g:sortableColumn property="id" title="Id" params="${filterParams}" /> 26 39 27 <g:sortableColumn property=" description" title="Description" />40 <g:sortableColumn property="name" title="Name" params="${filterParams}" /> 28 41 29 <g:sortableColumn property=" isActive" title="Is Active" />42 <g:sortableColumn property="description" title="Description" params="${filterParams}" /> 30 43 31 <th>Site</th> 44 <g:sortableColumn property="isActive" title="Is Active" params="${filterParams}" /> 45 46 <g:sortableColumn property="site" title="Site" params="${filterParams}" /> 32 47 33 48 <th></th> 34 49 35 50 </tr> 36 </thead> 37 <tbody> 38 <g:each in="${inventoryStoreInstanceList}" status="i" var="inventoryStoreInstance"> 39 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"> 40 41 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 42 ${fieldValue(bean:inventoryStoreInstance, field:'id')} 43 </td> 44 45 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 46 ${fieldValue(bean:inventoryStoreInstance, field:'name')} 47 </td> 48 49 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 50 ${fieldValue(bean:inventoryStoreInstance, field:'description')} 51 </td> 52 53 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 54 ${fieldValue(bean:inventoryStoreInstance, field:'isActive')} 55 </td> 56 57 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 58 ${fieldValue(bean:inventoryStoreInstance, field:'site')} 59 </td> 51 </thead> 52 <tbody> 53 <g:each in="${inventoryStoreInstanceList}" status="i" var="inventoryStoreInstance"> 54 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"> 60 55 61 <td class="notClickable"> 62 <g:link action="show" id="${inventoryStoreInstance.id}"> 63 <img src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" /> 64 </g:link> 65 </td> 66 67 </tr> 68 </g:each> 69 </tbody> 70 </table> 56 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 57 ${fieldValue(bean:inventoryStoreInstance, field:'id')} 58 </td> 59 60 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 61 ${fieldValue(bean:inventoryStoreInstance, field:'name')} 62 </td> 63 64 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 65 ${fieldValue(bean:inventoryStoreInstance, field:'description')} 66 </td> 67 68 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 69 ${fieldValue(bean:inventoryStoreInstance, field:'isActive')} 70 </td> 71 72 <td onclick='window.location = "${request.getContextPath()}/inventoryStoreDetailed/show/${inventoryStoreInstance.id}"'> 73 ${fieldValue(bean:inventoryStoreInstance, field:'site')} 74 </td> 75 76 <td class="notClickable"> 77 <g:link action="show" id="${inventoryStoreInstance.id}"> 78 <img src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" /> 79 </g:link> 80 </td> 81 82 </tr> 83 </g:each> 84 </tbody> 85 </table> 86 </div> 87 </g:if> 88 89 <div class="paginateButtons"> 90 <g:paginate total="${inventoryStoreInstanceTotal}" params="${filterParams}" /> 71 91 </div> 72 <div class="paginateButtons"> 73 <g:paginate total="${inventoryStoreInstanceTotal}" /> 74 </div> 92 93 <filterpane:filterPane domainBean="InventoryStore" 94 title="Search" 95 action="list" 96 class="overlayPane" 97 associatedProperties="site.name" 98 filterPropertyValues="${['site.name':[values: associatedPropertyValues.siteList]]}" /> 75 99 </div> 76 100 </body>
Note: See TracChangeset
for help on using the changeset viewer.