Add trait list to action
This commit is contained in:
parent
b459f5f4b1
commit
182d0c0c86
@ -54,6 +54,7 @@ def list_actions():
|
||||
@app.route("/action/<name>")
|
||||
def show_action(name):
|
||||
item = mongo.db.action.find_one_or_404({"name": name})
|
||||
# Actions
|
||||
if item["data"]["actions"]["value"] == None:
|
||||
if item["data"]["actionType"]["value"] == 'passive':
|
||||
item['_action_icon'] = None
|
||||
@ -67,8 +68,13 @@ def show_action(name):
|
||||
item['_action_icon'] = item["data"]["actions"]["value"]
|
||||
else:
|
||||
raise ValueError(f'Unknown action: {item["data"]["actionType"]["value"]} - {item["data"]["actions"]["value"]}')
|
||||
|
||||
# Traits
|
||||
_traits = item.get("data", {}).get("traits", {})
|
||||
item["_all_traits"] = []
|
||||
item["_all_traits"].append(_traits.get("rarity", {}).get("value", "unkown rarity"))
|
||||
item["_all_traits"] += _traits.get("value", [])
|
||||
item["_all_traits"] += _traits.get("custom").split(',')
|
||||
return render_template("action.html", action=item)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
app.run()
|
||||
|
@ -2,6 +2,11 @@
|
||||
{% block title %}{{action.name}} - PF2 DB{% endblock %}
|
||||
{% block body %}
|
||||
<h1>{{action["name"]}}{{c.actions[action["_action_icon"]]|safe}}</h1>
|
||||
<ul class="traits">
|
||||
{%- for trait in action["_all_traits"] %}
|
||||
<li class="trait">{{trait|upper}}</li>
|
||||
{% endfor -%}
|
||||
</ul>
|
||||
<p>{{action["data"]["description"]["value"]|filter_vtt|safe}}</p>
|
||||
<p class="sourcebook">{{action["data"]["source"]["value"]}}</p>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user