Skip to content

Commit

Permalink
Make stat tables responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Delaney committed Jun 19, 2016
1 parent 59ad9c9 commit e1d7f04
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 157 deletions.
239 changes: 123 additions & 116 deletions debsources/app/sources/templates/sources/stats.html
Expand Up @@ -15,123 +15,130 @@

{% block content %}

<h2>{{ self.title() }}</h2>

<ul>
<li><a href="#size_current">Size</a></li>
<li><a href="#sloc_current">Source lines of code</a></li>
<li><a href="#hist_trends">Historical trends</a>
<ul>
<li><a href="#hist_disk_usage">Disk usage</li>
<li><a href="#hist_sloc">Source lines of code</li>
<li><a href="#hist_source_pkgs">Source packages</li>
<li><a href="#hist_source_files">Source files</li>
<li><a href="#hist_ctags">Ctags</li>
</ul>
</li>
</ul>

<h3><a name="size_current">Size (current)</a></h3>

{% macro size_table(suites) -%}
<table class="stats">
<tr class="head">
<th></th>
{% for suite in suites %}
<th><a href="{{ url_for('.stats_suite', suite=suite[7:]) }}">
{{ suite[7:] }}</a></th>
{% endfor %}
</tr>
<tr>
<th>Disk usage (kB)</th>
{% for suite in suites %}
<td>{{ results[suite + ".disk_usage"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Sources lines of code</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Source packages</th>
{% for suite in suites %}
<td>{{ results[suite + ".source_packages"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Source files</th>
{% for suite in suites %}
<td>{{ results[suite + ".source_files"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Ctags (symbols)</th>
{% for suite in suites %}
<td>{{ results[suite + ".ctags"] | format_big_num }}</td>
{% endfor %}
</tr>
</table>
{% endmacro -%}

<h4><a name="size_cur_releases" />Releases</h4>
{{ size_table(release_suites) }}

<h4><a name="size_cur_devel" />Development suites</h4>
{{ size_table(devel_suites) }}

<h3><a name="sloc_current">Source lines of code (current)</a></h3>

{% macro sloccount_table(suites) -%}
<table class="stats">
<tr class="head">
<th></th>
{% for suite in suites %}
<th><a href="{{ url_for('.stats_suite', suite=suite[7:]) }}">
{{ suite[7:] }}</a></th>
{% endfor %}
</tr>
<tr>
<th>Total</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount"] | format_big_num }}</td>
{% endfor %}
</tr>
{% for lang in languages|sort %}
<tr>
<th>{{ lang }}</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount." + lang] | format_big_num }}</td>
<div class="row">

<h2>{{ self.title() }}</h2>

<ul>
<li><a href="#size_current">Size</a></li>
<li><a href="#sloc_current">Source lines of code</a></li>
<li><a href="#hist_trends">Historical trends</a>
<ul>
<li><a href="#hist_disk_usage">Disk usage</li>
<li><a href="#hist_sloc">Source lines of code</li>
<li><a href="#hist_source_pkgs">Source packages</li>
<li><a href="#hist_source_files">Source files</li>
<li><a href="#hist_ctags">Ctags</li>
</ul>
</li>
</ul>

<h3><a name="size_current">Size (current)</a></h3>

{% macro size_table(suites) -%}
<div class="table-responsive">
<table class="stats table">
<tr class="head">
<th></th>
{% for suite in suites %}
<th><a href="{{ url_for('.stats_suite', suite=suite[7:]) }}">
{{ suite[7:] }}</a></th>
{% endfor %}
</tr>
<tr>
<th>Disk usage (kB)</th>
{% for suite in suites %}
<td>{{ results[suite + ".disk_usage"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Sources lines of code</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Source packages</th>
{% for suite in suites %}
<td>{{ results[suite + ".source_packages"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Source files</th>
{% for suite in suites %}
<td>{{ results[suite + ".source_files"] | format_big_num }}</td>
{% endfor %}
</tr>
<tr>
<th>Ctags (symbols)</th>
{% for suite in suites %}
<td>{{ results[suite + ".ctags"] | format_big_num }}</td>
{% endfor %}
</tr>
</table>
</div>
{% endmacro -%}

<h4><a name="size_cur_releases" />Releases</h4>
{{ size_table(release_suites) }}

<h4><a name="size_cur_devel" />Development suites</h4>
{{ size_table(devel_suites) }}

<h3><a name="sloc_current">Source lines of code (current)</a></h3>

{% macro sloccount_table(suites) -%}
<div class="table-responsive">
<table class="stats table">
<tr class="head">
<th></th>
{% for suite in suites %}
<th><a href="{{ url_for('.stats_suite', suite=suite[7:]) }}">
{{ suite[7:] }}</a></th>
{% endfor %}
</tr>
<tr>
<th>Total</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount"] | format_big_num }}</td>
{% endfor %}
</tr>
{% for lang in languages|sort %}
<tr>
<th>{{ lang }}</th>
{% for suite in suites %}
<td>{{ results[suite + ".sloccount." + lang] | format_big_num }}</td>
{% endfor %}
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% endmacro -%}

<div>
<span class="sidechart">
<a href="{{ url_for('static',
filename='img/stats/ALL-sloc_pie-current.png') }}">
<img src="{{ url_for('static',
filename='img/stats/ALL-sloc_pie-current.png') }}" />
</a>
<a href="{{ url_for('static',
filename='img/stats/sloc_bar_plot.png') }}">
<img src="{{ url_for('static',
filename='img/stats/sloc_bar_plot.png') }}" />
</a>
</span>
<h4>Releases</h4>
{{ sloccount_table(release_suites) }}
<h4>Development suites</h4>
{{ sloccount_table(devel_suites) }}
</div>

<h3><a name="hist_trends">Historical trends</a></h3>

{% import "sources/stats_trends.inc.html" as stats_trends %}
{{ stats_trends.render_trends("ALL") }}
</table>
</div>
{% endmacro -%}

<div>
<span class="sidechart">
<a href="{{ url_for('static',
filename='img/stats/ALL-sloc_pie-current.png') }}">
<img src="{{ url_for('static',
filename='img/stats/ALL-sloc_pie-current.png') }}" />
</a>
<a href="{{ url_for('static',
filename='img/stats/sloc_bar_plot.png') }}">
<img src="{{ url_for('static',
filename='img/stats/sloc_bar_plot.png') }}" />
</a>
</span>
<h4>Releases</h4>
{{ sloccount_table(release_suites) }}
<h4>Development suites</h4>
{{ sloccount_table(devel_suites) }}
</div>

<h3><a name="hist_trends">Historical trends</a></h3>

{% import "sources/stats_trends.inc.html" as stats_trends %}
{{ stats_trends.render_trends("ALL") }}

</div>

{% endblock %}
75 changes: 38 additions & 37 deletions debsources/app/sources/templates/sources/stats_suite.html
Expand Up @@ -14,41 +14,42 @@

{% block content %}

<h2>{{ self.title() }}</h2>

{% set suite = "debian_" + suite %}

<ul>
{% if rel_date != "None" %}
<li>Release date: {{rel_date}}</li>
{% endif %}
{% if rel_version != None %}
<li>Release version: {{rel_version}}</li>
{% endif %}
<li>Source files: {{ results[suite + ".source_files"] | format_big_num }}</li>
<li>Source packages: {{ results[suite + ".source_packages"] | format_big_num }}</li>
<li>Disk usage: {{ results[suite + ".disk_usage"] | format_big_num }} kB</li>
<li>Ctags: {{ results[suite + ".ctags"] | format_big_num }}</li>
<li>Source lines of code: {{ results[suite + ".sloccount"] | format_big_num }}
<span class="sidechart">
<a href="{{ url_for('static',
filename='img/stats/' + suite[7:] + '-sloc_pie-current.png') }}">
<img src="{{ url_for('static',
filename='img/stats/' + suite[7:] + '-sloc_pie-current.png') }}" />
</a>
</span>
<ul>
{% for lang in languages|sort %}
<li>{{ lang }}: {{ results[suite + ".sloccount." + lang] | format_big_num }}</li>
{% endfor %}
</ul>
</li>
</ul>


<h3>Historical trends</h3>

{% import "sources/stats_trends.inc.html" as stats_trends %}
{{ stats_trends.render_trends(suite[7:]) }}

<div class="row">
<h2>{{ self.title() }}</h2>

{% set suite = "debian_" + suite %}

<ul>
{% if rel_date != "None" %}
<li>Release date: {{rel_date}}</li>
{% endif %}
{% if rel_version != None %}
<li>Release version: {{rel_version}}</li>
{% endif %}
<li>Source files: {{ results[suite + ".source_files"] | format_big_num }}</li>
<li>Source packages: {{ results[suite + ".source_packages"] | format_big_num }}</li>
<li>Disk usage: {{ results[suite + ".disk_usage"] | format_big_num }} kB</li>
<li>Ctags: {{ results[suite + ".ctags"] | format_big_num }}</li>
<li>Source lines of code: {{ results[suite + ".sloccount"] | format_big_num }}
<span class="sidechart">
<a href="{{ url_for('static',
filename='img/stats/' + suite[7:] + '-sloc_pie-current.png') }}">
<img src="{{ url_for('static',
filename='img/stats/' + suite[7:] + '-sloc_pie-current.png') }}" />
</a>
</span>
<ul>
{% for lang in languages|sort %}
<li>{{ lang }}: {{ results[suite + ".sloccount." + lang] | format_big_num }}</li>
{% endfor %}
</ul>
</li>
</ul>


<h3>Historical trends</h3>

{% import "sources/stats_trends.inc.html" as stats_trends %}
{{ stats_trends.render_trends(suite[7:]) }}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion debsources/app/static/css/base.css
Expand Up @@ -157,7 +157,7 @@ table.stats tr td {
line-height: 1ex;
}
table.stats tr.head th {
text-align: center;
text-align: right;
}
table.stats tr th {
text-align: left;
Expand Down
6 changes: 3 additions & 3 deletions doc/twitter-bootstrap.progress.md
Expand Up @@ -50,9 +50,9 @@
| `source_file.html`| 3 |
| `source_folder.html`| 2 |
| `source_package.html`| 2 |
| `stats.html`| 3 |
| `stats_suite.html`| 3 |
| `stats_trends.inc.html`| 3 |
| `stats.html`| 2 |
| `stats_suite.html`| 2 |
| `stats_trends.inc.html`| 2 |


### `debsources/app/copyright/templates/copyright`
Expand Down

0 comments on commit e1d7f04

Please sign in to comment.