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>")
|
@app.route("/action/<name>")
|
||||||
def show_action(name):
|
def show_action(name):
|
||||||
item = mongo.db.action.find_one_or_404({"name": name})
|
item = mongo.db.action.find_one_or_404({"name": name})
|
||||||
|
# Actions
|
||||||
if item["data"]["actions"]["value"] == None:
|
if item["data"]["actions"]["value"] == None:
|
||||||
if item["data"]["actionType"]["value"] == 'passive':
|
if item["data"]["actionType"]["value"] == 'passive':
|
||||||
item['_action_icon'] = None
|
item['_action_icon'] = None
|
||||||
@ -67,8 +68,13 @@ def show_action(name):
|
|||||||
item['_action_icon'] = item["data"]["actions"]["value"]
|
item['_action_icon'] = item["data"]["actions"]["value"]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Unknown action: {item["data"]["actionType"]["value"]} - {item["data"]["actions"]["value"]}')
|
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)
|
return render_template("action.html", action=item)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run()
|
app.run()
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
{% block title %}{{action.name}} - PF2 DB{% endblock %}
|
{% block title %}{{action.name}} - PF2 DB{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>{{action["name"]}}{{c.actions[action["_action_icon"]]|safe}}</h1>
|
<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>{{action["data"]["description"]["value"]|filter_vtt|safe}}</p>
|
||||||
<p class="sourcebook">{{action["data"]["source"]["value"]}}</p>
|
<p class="sourcebook">{{action["data"]["source"]["value"]}}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user