Make fact value clickable.

In the Facts view you can now click on the value of a fact and get a
listing of all the nodes with that value for that fact.

Closes #13
This commit is contained in:
Daniele Sluijters
2013-11-05 15:38:49 +01:00
parent 0563224c87
commit 754784f4af
4 changed files with 25 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
{% macro facts_table(facts, autofocus=False, condensed=False, show_node=False, margin_top=20, margin_bottom=20) -%}
{% macro facts_table(facts, autofocus=False, condensed=False, show_node=False, show_value=True, link_facts=False, margin_top=20, margin_bottom=20) -%}
<div class="filter" style="margin-bottom:{{margin_bottom}}px;margin-top:{{margin_top}}px;">
<input {% if autofocus %} autofocus="autofocus" {% endif %} style="width:100%" type="text" class="filter-table input-medium search-query" placeholder="Type here to filter">
</div>
@@ -10,7 +10,9 @@
{% else %}
<th>Fact</th>
{% endif %}
{% if show_value %}
<th>Value</th>
{% endif %}
</tr>
</thead>
<tbody class="searchable">
@@ -21,7 +23,15 @@
{% else %}
<td><a href="{{url_for('fact', fact=fact.name)}}">{{fact.name}}</a></td>
{% endif %}
<td style="word-wrap:break-word">{{fact.value}}</td>
{% if show_value %}
<td style="word-wrap:break-word">
{% if link_facts %}
<a href="{{url_for('fact_value', fact=fact.name, value=fact.value)}}">{{fact.value}}</a>
{% else %}
{{fact.value}}
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>

View File

@@ -1,8 +1,12 @@
{% extends 'layout.html' %}
{% import '_macros.html' as macros %}
{% block content %}
<h1>{{name}}</h1>
<h1>{{name}}{% if value %}/{{value}}{% endif %}</h1>
{{macros.facts_graph(facts, autofocus=True, show_node=True, margin_bottom=10)}}
{{macros.facts_graph_value(facts, autofocus=True, show_node=True, margin_bottom=10)}}
{{macros.facts_table(facts, autofocus=True, show_node=True, margin_bottom=10)}}
{% if value %}
{{macros.facts_table(facts, autofocus=True, show_node=True, show_value=False, margin_bottom=10)}}
{% else %}
{{macros.facts_table(facts, autofocus=True, show_node=True, link_facts=True, margin_bottom=10)}}
{% endif %}
{% endblock content %}

View File

@@ -27,7 +27,7 @@
</div>
<div class="span4">
<h1>Facts</h1>
{{macros.facts_table(facts, condensed=True, margin_top=10)}}
{{macros.facts_table(facts, link_facts=True, condensed=True, margin_top=10)}}
</div>
<div class="span4">
<h1>Reports</h1>