Allow batch view to disable the Execute button in some cases.
Although this only disables the UI button element, it doesn't really prevent anything beyond that...
This commit is contained in:
		
							parent
							
								
									fb8fab1577
								
							
						
					
					
						commit
						4290f0d8df
					
				
					 2 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -70,7 +70,7 @@
 | 
				
			||||||
      % endif
 | 
					      % endif
 | 
				
			||||||
      % if not batch.executed and request.has_perm('{0}.execute'.format(permission_prefix)):
 | 
					      % if not batch.executed and request.has_perm('{0}.execute'.format(permission_prefix)):
 | 
				
			||||||
          ## ${h.link_to(execute_title, url('{0}.execute'.format(route_prefix), uuid=batch.uuid))}
 | 
					          ## ${h.link_to(execute_title, url('{0}.execute'.format(route_prefix), uuid=batch.uuid))}
 | 
				
			||||||
          <button type="button" onclick="location.href = '${url('{0}.execute'.format(route_prefix), uuid=batch.uuid)}';">${execute_title}</button>
 | 
					          <button type="button" onclick="location.href = '${url('{0}.execute'.format(route_prefix), uuid=batch.uuid)}';"${'' if execute_enabled else ' disabled="disabled"'}">${execute_title}</button>
 | 
				
			||||||
      % endif
 | 
					      % endif
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</%def>
 | 
					</%def>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -473,6 +473,7 @@ class BatchCrud(BaseCrud):
 | 
				
			||||||
            'batch_display': self.batch_display,
 | 
					            'batch_display': self.batch_display,
 | 
				
			||||||
            'batch_display_plural': self.batch_display_plural,
 | 
					            'batch_display_plural': self.batch_display_plural,
 | 
				
			||||||
            'execute_title': self.handler.get_execute_title(batch),
 | 
					            'execute_title': self.handler.get_execute_title(batch),
 | 
				
			||||||
 | 
					            'execute_enabled': True,
 | 
				
			||||||
            'route_prefix': self.route_prefix,
 | 
					            'route_prefix': self.route_prefix,
 | 
				
			||||||
            'permission_prefix': self.permission_prefix,
 | 
					            'permission_prefix': self.permission_prefix,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue