les boutons affichés en bas d'un formulaire sont isolés dans une méthode; qui
pourra être surchargée plus tard
This commit is contained in:
parent
ef95fd3625
commit
8ad008a32f
|
@ -469,25 +469,26 @@ class ObjectsWebMixin(AdministrableWebMixin):
|
|||
widget = slot.getWidget()
|
||||
form += widget.getModelPageBodyLayout(slot, fields = None)
|
||||
|
||||
buttonsBar = X.div(_class = 'buttons-bar')
|
||||
form += buttonsBar
|
||||
actionButtonsBar = X.span(_class = 'action-buttons-bar')
|
||||
buttonsBar += actionButtonsBar
|
||||
if not object.id:
|
||||
actionButtonsBar += X.buttonInForm('create', 'createButton')
|
||||
else:
|
||||
# The button Delete is also added here, so that the user can
|
||||
# delete the object he is editing without having to make it
|
||||
# valid, clic modify and then delete it.
|
||||
if self.canDeleteObject(object.id):
|
||||
actionButtonsBar += X.buttonStandalone(
|
||||
'delete', X.idUrl(object.id, 'confirmDelete'))
|
||||
actionButtonsBar += X.buttonInForm('modify', 'modifyButton')
|
||||
form += X.div(_class = 'buttons-bar')(self.getEditButtons(object))
|
||||
|
||||
return writePageLayout(layout, headerTitle)
|
||||
finally:
|
||||
context.pull(_level = 'edit')
|
||||
|
||||
def getEditButtons(self, object):
|
||||
array = X.array()
|
||||
if not object.id:
|
||||
array += X.buttonInForm('create', 'createButton')
|
||||
else:
|
||||
# The button Delete is also added here, so that the user can
|
||||
# delete the object he is editing without having to make it
|
||||
# valid, clic modify and then delete it.
|
||||
if self.canDeleteObject(object.id):
|
||||
array += X.buttonStandalone(
|
||||
'delete', X.idUrl(object.id, 'confirmDelete'))
|
||||
array += X.buttonInForm('modify', 'modifyButton')
|
||||
return array
|
||||
|
||||
def getEditLeadIn(self, object):
|
||||
return None
|
||||
|
||||
|
|
Reference in New Issue