Skip to content

Commit

Permalink
Radio table template: implement heading tooltips
Browse files Browse the repository at this point in the history
Fixes #88
  • Loading branch information
TomaszGasior committed May 15, 2020
1 parent 575b2ed commit 2cbdd6e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
19 changes: 11 additions & 8 deletions templates/radio_table/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{% embed 'radio_table/table/radio_table.html.twig' %}
{%- block table_class 'radio-table sortable' -%}

{%- block heading_cell -%}
{%- block heading_cell_html_attr -%}
{%- set columns_sorting = {
(constant('COLUMN_DISTANCE', radio_table)): 'N',
(constant('COLUMN_FREQUENCY', radio_table)): 'N',
Expand All @@ -93,13 +93,16 @@
(constant('COLUMN_RDS_PI', radio_table)): 'T',
(constant('COLUMN_TYPE', radio_table)): 'T',
} -%}
<th {% if columns_sorting[column] is defined %}data-sort="{{ columns_sorting[column] }}"{% endif %}>
{%- if column == 'comment' and radio_table.appearance.collapsedComments -%}
{{- 'heading.comment.short'|trans({}, 'radio_table') -}}
{%- else -%}
{{- parent()|striptags -}}
{%- endif -%}
</th>
{%- if columns_sorting[column] is defined %} data-sort="{{ columns_sorting[column] }}"{% endif -%}
{{- parent() -}}
{%- endblock -%}

{%- block heading_cell_html_inner -%}
{%- if column == 'comment' and radio_table.appearance.collapsedComments -%}
{{- 'heading.comment.short'|trans({}, 'radio_table') -}}
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock -%}

{# Check for permission outside of radio station loop for better performance. #}
Expand Down
11 changes: 10 additions & 1 deletion templates/radio_table/table/radio_table.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
{%- endblock -%}

{%- block heading_cell -%}
<th>{{ parent() }}</th>
{%- set parent = parent() -%}
{%- set column_heading = block('heading_cell_html_inner') -%}
{%- set column_name = ('column.' ~ column)|trans -%}
<th
{%- block heading_cell_html_attr -%}
{%- if column_heading != column_name %} title="{{ column_name }}"{% endif -%}
{%- endblock -%}
>
{%- block heading_cell_html_inner parent -%}
</th>
{%- endblock -%}

{%- block row_start -%}
Expand Down

0 comments on commit 2cbdd6e

Please sign in to comment.