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