Refactor index.html for improved readability and maintainability of template logic
This commit is contained in:
parent
f9089066ec
commit
bf707dc33f
1 changed files with 21 additions and 18 deletions
|
@ -15,21 +15,21 @@
|
||||||
<h5 class="card-title">Active Worklogs</h5>
|
<h5 class="card-title">Active Worklogs</h5>
|
||||||
<h6 class="card-subtitle mb-2 text-body-secondary">
|
<h6 class="card-subtitle mb-2 text-body-secondary">
|
||||||
You have {{ active_count }} active worklogs.
|
You have {{ active_count }} active worklogs.
|
||||||
{% set ids %}
|
{% set ids %}
|
||||||
{ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]}
|
{ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{{ links.export_link(
|
{{ links.export_link(
|
||||||
'active_worklog',
|
'active_worklog',
|
||||||
'worklog',
|
'worklog',
|
||||||
ids
|
ids
|
||||||
) }}
|
) }}
|
||||||
</h6>
|
</h6>
|
||||||
{{ tables.render_table(
|
{{ tables.render_table(
|
||||||
headers = active_worklog_headers,
|
headers = active_worklog_headers,
|
||||||
rows = active_worklog_rows,
|
rows = active_worklog_rows,
|
||||||
id = 'Active Worklog',
|
id = 'Active Worklog',
|
||||||
entry_route = 'worklog_entry',
|
entry_route = 'worklog_entry',
|
||||||
per_page = 10
|
per_page = 10
|
||||||
)}}
|
)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,11 +62,14 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
const data = {{ datasets['summary']|tojson }};
|
{% if datasets['summary'] %}
|
||||||
const layout = { title: 'Summary' };
|
const data = {{ datasets['summary']|tojson }};
|
||||||
const work_data = {{ datasets['work_summary']|tojson }};
|
const layout = { title: 'Summary' };
|
||||||
const work_layout = { title: 'Work Summary', xaxis: { tickangle: -45 } };
|
Plotly.newPlot('summary', data, layout)
|
||||||
|
{% endif %}
|
||||||
Plotly.newPlot('summary', data, layout)
|
{% if datasets['work_summary'] %}
|
||||||
Plotly.newPlot('work_summary', work_data, work_layout);
|
const work_data = {{ datasets['work_summary']|tojson }};
|
||||||
{% endblock %}
|
const work_layout = { title: 'Work Summary', xaxis: { tickangle: -45 } };
|
||||||
|
Plotly.newPlot('work_summary', work_data, work_layout);
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue