Skip to content

Commit

Permalink
Added html templates
Browse files Browse the repository at this point in the history
  • Loading branch information
shner-elmo committed Jun 24, 2024
1 parent f60ffec commit 5b84be3
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
63 changes: 63 additions & 0 deletions templates/fields.html.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ primary_screener.rstrip('s') }} Fields</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"/>
</head>
<body>
<main class="container">
<div role="group">
{% for name, file, set_markets in screeners %}
<button
class="{{ "primary" if name == primary_screener else "secondary" }}"
onclick="window.location.href = '{{ file }}'"
data-tooltip="{{ set_markets }}"
data-placement="bottom"
>{{ name }}</button>
{% endfor %}
</div>
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Display name</th>
<th scope="col">Type</th>
<th scope="col" data-tooltip="If true it has the following timeframes: `'1', '5', '15', '30', '60', '120', '240', '1W', '1M'`">Timeframes</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
{% if is_list(row) %}
<td>
<details>
<summary>{{ row[0][0] }}</summary>
<ul>
{% for val in row[1:] %}
<li>{{ val }}</li>
{% endfor %}
</ul>
</details>
</td>
{% for val in row[0][1:] %}
<td>{{ val }}</td>
{% endfor %}
{% else %}
{% for val in row %}
<td>{{ val }}</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th scope="row">Fields</th>
<td>{{ n_fields }}</td>
</tr>
</tfoot>
</table>
</main>
</body>
</html>
28 changes: 28 additions & 0 deletions templates/module.html.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{#
We want to extend the default template instead of defining everything ourselves.
#}
{% extends "default/module.html.jinja2" %}

{% block nav_title %}
<script type="text/javascript">
window.onload = function() {
let ul = document.evaluate("//h2[text() = 'Submodules']/following-sibling::ul", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
ul.insertAdjacentHTML('afterend', '<h2 id="fields">Fields</h2>');
let html = `
<ul>
<li><a href="static/stocks_fields.html">Stocks</a></li>
<li><a href="static/crypto_fields.html">Crypto</a></li>
<li><a href="static/forex_fields.html">Forex</a></li>
<li><a href="static/coin_fields.html">Coin</a></li>
<li><a href="static/cfd_fields.html">Cfd</a></li>
<li><a href="static/futures_fields.html">Futures</a></li>
<li><a href="static/bonds_fields.html">Bonds</a></li>
<li><a href="static/economics2_fields.html">Economics2</a></li>
<li><a href="static/options_fields.html">Options</a></li>
</ul>
`;
document.getElementById('fields').insertAdjacentHTML('afterend', html);
}
</script>
{% endblock %}

0 comments on commit 5b84be3

Please sign in to comment.