Mercurial > piecrust2
changeset 629:40e897e2f11e
admin: Make the publish UI handle new kinds of target configurations.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 08 Feb 2016 23:29:21 -0800 |
parents | 14c51f5accc9 |
children | b6a4f768cbb9 |
files | foodtruck/templates/publish.html foodtruck/views/publish.py |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/foodtruck/templates/publish.html Mon Feb 08 23:28:39 2016 -0800 +++ b/foodtruck/templates/publish.html Mon Feb 08 23:29:21 2016 -0800 @@ -5,9 +5,8 @@ {% for target in targets %} <div> - <h2>{{target.name}}</h2> + <h3>{{target.name}}</h3> {% if target.description %}<div>{{target.description}}</div>{% endif %} - {% if target.cmd %}<p>Run <code>{{target.cmd}}</code>.</p>{% endif %} <form action="{{url_run}}" method="POST"> <input type="hidden" name="target" value="{{target.name}}" /> <button type="submit" class="btn btn-default">Execute</button>
--- a/foodtruck/views/publish.py Mon Feb 08 23:28:39 2016 -0800 +++ b/foodtruck/views/publish.py Mon Feb 08 23:29:21 2016 -0800 @@ -33,10 +33,12 @@ data['targets'] = [] for tn in sorted(pub_cfg.keys()): tc = pub_cfg[tn] + desc = None + if isinstance(tc, dict): + desc = tc.get('description') data['targets'].append({ 'name': tn, - 'description': tc.get('description'), - 'cmd': tc.get('cmd') + 'description': desc }) with_menu_context(data)