Use <once-button> where applicable for CRUD forms
				
					
				
			This commit is contained in:
		
							parent
							
								
									5907973d42
								
							
						
					
					
						commit
						6be4964221
					
				
					 2 changed files with 24 additions and 2 deletions
				
			
		|  | @ -42,7 +42,18 @@ | ||||||
|   % elif not form.readonly and (buttons is Undefined or (buttons is not None and buttons is not False)): |   % elif not form.readonly and (buttons is Undefined or (buttons is not None and buttons is not False)): | ||||||
|       <br /> |       <br /> | ||||||
|       <div class="buttons"> |       <div class="buttons"> | ||||||
|         ${h.submit('save', getattr(form, 'submit_label', getattr(form, 'save_label', "Submit")), class_='button is-primary')} |         ## TODO: deprecate / remove the latter option here | ||||||
|  |         % if form.auto_disable_save or form.auto_disable: | ||||||
|  |             <once-button type="is-primary" | ||||||
|  |                          native-type="submit" | ||||||
|  |                          text="${getattr(form, 'submit_label', getattr(form, 'save_label', "Submit"))}"> | ||||||
|  |             </once-button> | ||||||
|  |         % else: | ||||||
|  |             <b-button type="is-primary" | ||||||
|  |                       native-type="submit"> | ||||||
|  |               ${getattr(form, 'submit_label', getattr(form, 'save_label', "Submit"))} | ||||||
|  |             </b-button> | ||||||
|  |         % endif | ||||||
|         % if getattr(form, 'show_reset', False): |         % if getattr(form, 'show_reset', False): | ||||||
|             <input type="reset" value="Reset" class="button" /> |             <input type="reset" value="Reset" class="button" /> | ||||||
|         % endif |         % endif | ||||||
|  | @ -50,7 +61,15 @@ | ||||||
|             % if form.mobile: |             % if form.mobile: | ||||||
|                 ${h.link_to("Cancel", form.cancel_url, class_='ui-btn ui-corner-all')} |                 ${h.link_to("Cancel", form.cancel_url, class_='ui-btn ui-corner-all')} | ||||||
|             % else: |             % else: | ||||||
|                 ${h.link_to("Cancel", form.cancel_url, class_='cancel button{}'.format(' autodisable' if form.auto_disable_cancel else ''))} |                 % if form.auto_disable_cancel: | ||||||
|  |                     <once-button tag="a" href="${form.cancel_url}" | ||||||
|  |                                  text="Cancel"> | ||||||
|  |                     </once-button> | ||||||
|  |                 % else: | ||||||
|  |                     <b-button tag="a" href="${form.cancel_url}"> | ||||||
|  |                       Cancel | ||||||
|  |                     </b-button> | ||||||
|  |                 % endif | ||||||
|             % endif |             % endif | ||||||
|         % endif |         % endif | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|  | @ -88,6 +88,7 @@ class ProfilesView(MasterView): | ||||||
|                     pass |                     pass | ||||||
| 
 | 
 | ||||||
|     def make_printer_settings_form(self, profile, printer): |     def make_printer_settings_form(self, profile, printer): | ||||||
|  |         use_buefy = self.get_use_buefy() | ||||||
|         schema = colander.Schema() |         schema = colander.Schema() | ||||||
| 
 | 
 | ||||||
|         for name, label in printer.required_settings.items(): |         for name, label in printer.required_settings.items(): | ||||||
|  | @ -98,11 +99,13 @@ class ProfilesView(MasterView): | ||||||
|             schema.add(node) |             schema.add(node) | ||||||
| 
 | 
 | ||||||
|         form = forms.Form(schema=schema, request=self.request, |         form = forms.Form(schema=schema, request=self.request, | ||||||
|  |                           use_buefy=use_buefy, | ||||||
|                           model_instance=profile, |                           model_instance=profile, | ||||||
|                           # TODO: ugh, this is necessary to avoid some logic |                           # TODO: ugh, this is necessary to avoid some logic | ||||||
|                           # which assumes a ColanderAlchemy schema i think? |                           # which assumes a ColanderAlchemy schema i think? | ||||||
|                           appstruct=None) |                           appstruct=None) | ||||||
|         form.cancel_url = self.get_action_url('view', profile) |         form.cancel_url = self.get_action_url('view', profile) | ||||||
|  |         form.auto_disable_cancel = True | ||||||
| 
 | 
 | ||||||
|         form.insert_before(schema.children[0].name, 'label_profile') |         form.insert_before(schema.children[0].name, 'label_profile') | ||||||
|         form.set_readonly('label_profile') |         form.set_readonly('label_profile') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar