Add row numbers to tables

When a table is showing the contents of a CSV file, it should look
something like a spreadsheet.

The minimally skeuomorphic way to do this is by adding row numbers.

This commit doesn’t
- make the row numbers monospace (it’s barely noticeable and doesn’t
  reflect what actual spreadsheets do)
- make the first column heading ‘Row’ (again, doesn’t reflect how actual
  spreadsheets work, and takes up more valuable space)
This commit is contained in:
Chris Hill-Scott
2016-04-05 11:16:29 +01:00
parent 2abc336a0c
commit 39e94ac8ec
13 changed files with 29 additions and 20 deletions

View File

@@ -29,7 +29,7 @@
{% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %}
{% for item in items %}
{% call row() %}
{{ parent_caller(item) }}
{{ parent_caller(item, loop.index + 1) }}
{% endcall %}
{% endfor %}
{% if not items %}
@@ -55,6 +55,12 @@
</td>
{%- endmacro %}
{% macro index_field(text) -%}
<td class="table-field-index">
<span>{{ text }}</span>
</td>
{%- endmacro %}
{% macro text_field(text) -%}
{% call field() %}
{{ text }}