15 def actions(*elements):
18 "elements": list(elements)
21 def button(label, name):
33 text = "{}: <#{}>".format(hunt['name'], hunt['channel'])
34 return section(text_block(text))
36 def home(turb, user_id, body):
37 """Returns a view to be published as the turbot home tab for user_id
39 The body argument is a dictionary as provided by the Slack request.
40 The return value is a dictionary suitable to be published to the
41 Slack views_publish API."""
43 response = turb.db.Table("hunts").scan()
44 hunts = response['Items']
49 section(text_block("*Active hunts*")),
50 *[hunt_block(hunt) for hunt in hunts if hunt['active']],
51 actions(button("New hunt", "new_hunt"))