cards: do not disable card after duplication (#35934)

This commit is contained in:
Frédéric Péters 2019-09-09 11:43:33 +02:00
parent d9d5fd2eed
commit f9358c5e96
2 changed files with 14 additions and 0 deletions

View File

@ -5194,3 +5194,11 @@ def test_cards_new(pub, studio):
assert '<h2>card title' in resp.body
assert CardDef.get(1).workflow_id is None
assert CardDef.get(1).disabled is False
def test_cards_duplicate(pub, studio):
test_cards_new(pub, studio)
app = login(get_app(pub))
resp = app.get('http://example.net/backoffice/cards/1/')
resp = resp.click('Duplicate')
assert CardDef.get(2).name == 'card title (copy)'
assert CardDef.get(2).disabled is False

View File

@ -179,6 +179,12 @@ class CardDefPage(FormDefPage):
r += htmltext('</div>')
return r.getvalue()
def duplicate(self):
response = super(CardDefPage, self).duplicate()
self.formdefui.formdef.disabled = False
self.formdefui.formdef.store()
return response
def get_sidebar(self):
r = TemplateIO(html=True)
r += htmltext('<ul id="sidebar-actions">')