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>
|
||||
<h6 class="card-subtitle mb-2 text-body-secondary">
|
||||
You have {{ active_count }} active worklogs.
|
||||
{% set ids %}
|
||||
{ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]}
|
||||
{% set ids %}
|
||||
{ids: [{% for row in active_worklog_rows %}{{ row['id'] }}, {% endfor %}]}
|
||||
{% endset %}
|
||||
{{ links.export_link(
|
||||
'active_worklog',
|
||||
'worklog',
|
||||
ids
|
||||
'active_worklog',
|
||||
'worklog',
|
||||
ids
|
||||
) }}
|
||||
</h6>
|
||||
{{ tables.render_table(
|
||||
headers = active_worklog_headers,
|
||||
rows = active_worklog_rows,
|
||||
id = 'Active Worklog',
|
||||
entry_route = 'worklog_entry',
|
||||
per_page = 10
|
||||
headers = active_worklog_headers,
|
||||
rows = active_worklog_rows,
|
||||
id = 'Active Worklog',
|
||||
entry_route = 'worklog_entry',
|
||||
per_page = 10
|
||||
)}}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -62,11 +62,14 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
const data = {{ datasets['summary']|tojson }};
|
||||
const layout = { title: 'Summary' };
|
||||
const work_data = {{ datasets['work_summary']|tojson }};
|
||||
const work_layout = { title: 'Work Summary', xaxis: { tickangle: -45 } };
|
||||
|
||||
Plotly.newPlot('summary', data, layout)
|
||||
Plotly.newPlot('work_summary', work_data, work_layout);
|
||||
{% endblock %}
|
||||
{% if datasets['summary'] %}
|
||||
const data = {{ datasets['summary']|tojson }};
|
||||
const layout = { title: 'Summary' };
|
||||
Plotly.newPlot('summary', data, layout)
|
||||
{% endif %}
|
||||
{% if datasets['work_summary'] %}
|
||||
const work_data = {{ datasets['work_summary']|tojson }};
|
||||
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