Skip to content

Commit

Permalink
Provide option to hide highlight on col
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Aug 16, 2024
1 parent 8834369 commit 34ca056
Show file tree
Hide file tree
Showing 25 changed files with 40 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/components/projects/table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table" data-controller="table-highlighting" <%= table_id ? "id=\"#{table_id}\"".html_safe : '' %>>
<colgroup>
<% columns.each do |column| %>
<col>
<%= tag :col, data: { highlight: column.attribute != :hierarchy } %>
<% end %>
<col>
</colgroup>
Expand Down
2 changes: 1 addition & 1 deletion app/components/table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
<% headers.each do |_name, _options| %>
<col>
<% end %>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/attribute_help_texts/_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/custom_fields/_custom_options.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/custom_fields/_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/forums/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ See COPYRIGHT and LICENSE files for more details.
<col>
<% if User.current.allowed_in_project?(:manage_forums, @project) %>
<col>
<col>
<col data-highlight="false">
<% end %>
</colgroup>
<thead>
Expand Down
2 changes: 1 addition & 1 deletion app/views/groups/_memberships.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/groups/_users_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ See COPYRIGHT and LICENSE files for more details.

<table class="generic-table users">
<colgroup>
<col colightCol>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/groups/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ See COPYRIGHT and LICENSE files for more details.
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/principals/_global_roles.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table principal_roles" id="table_principal_roles" data-controller="table-highlighting">
<colgroup>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/settings/categories/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ See COPYRIGHT and LICENSE files for more details.
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/repositories/_dir_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table" data-controller="table-highlighting" data-repository-navigation-target="repoBrowser">
<colgroup>
<col>
<col>
<col data-highlight="false">
<col>
<col>
<col>
Expand Down
4 changes: 2 additions & 2 deletions app/views/repositories/_revisions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table changesets">
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
<col data-highlight="false">
<col>
<col>
<col>
Expand Down
2 changes: 1 addition & 1 deletion app/views/roles/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ See COPYRIGHT and LICENSE files for more details.
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
4 changes: 2 additions & 2 deletions app/views/types/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table" data-controller="table-highlighting">
<colgroup>
<col>
<col data-highlight="false">
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
6 changes: 3 additions & 3 deletions app/views/wiki/history.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ See COPYRIGHT and LICENSE files for more details.
<table class="generic-table wiki-page-versions">
<colgroup>
<col>
<col data-highlight="false">
<col data-highlight="false">
<col>
<col>
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<caption class="hidden-for-sighted">
<span>
Expand Down
4 changes: 2 additions & 2 deletions app/views/workflows/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ See COPYRIGHT and LICENSE files for more details.
<div class="generic-table--results-container">
<table class="generic-table" data-controller="table-highlighting">
<colgroup>
<col data-highlight="false">
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<div class="work-packages-tabletimeline--table-side work-package-table--container __hidden_overflow_container">
<table
class="keyboard-accessible-list generic-table work-package-table"
data-controller="table-highlighting"
[class.op-table-baseline]="baselineEnabled"
>
<colgroup>
<col *ngIf="configuration.dragAndDropEnabled">
<col *ngIf="baselineEnabled">
<col data-highlight="false" *ngIf="configuration.dragAndDropEnabled">
<col data-highlight="false" *ngIf="baselineEnabled">
<!-- Generate col elements dynamically(!) for each requested column plus one for the action menu's column. -->
<col *ngFor="let column of [].constructor(columns.length)">
<col *ngIf="configuration.columnMenuEnabled">
<col *ngIf="!configuration.columnMenuEnabled">
<col data-highlight="false" *ngIf="!configuration.columnMenuEnabled">
</colgroup>
<caption class="hidden-for-sighted">
<span>{{text.tableSummary}}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead class="-sticky">
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,16 @@ export default class TableHighlightingController extends ApplicationController {
const th = target.closest('th') as HTMLElement;
const index = this.parentIndex(th);

if (index !== null) {
return this.colgroup.children.item(index) as HTMLElement|null;
if (index === null) {
return null;
}
const col = this.colgroup.children.item(index) as HTMLElement|null;

return null;
if (!col || col.dataset.highlight === 'false') {
return null;
}

return col;
}

private parentIndex(element:HTMLElement):number|null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See COPYRIGHT and LICENSE files for more details.
<% if User.current.allowed_in_project?(:view_cost_rates, @project)%>
<col>
<%end%>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion modules/costs/app/views/cost_types/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion modules/costs/app/views/cost_types/_list_deleted.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ See COPYRIGHT and LICENSE files for more details.
<col>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion modules/costs/app/views/cost_types/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ See COPYRIGHT and LICENSE files for more details.
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion modules/costs/app/views/hourly_rates/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ See COPYRIGHT and LICENSE files for more details.
<colgroup>
<col>
<col>
<col>
<col data-highlight="false">
</colgroup>
<thead>
<tr>
Expand Down

0 comments on commit 34ca056

Please sign in to comment.