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 19, 2024
1 parent f8f614b commit 47da171
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 37 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 @@ -49,7 +49,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 @@ -28,7 +28,6 @@

import {
AfterContentInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
Expand All @@ -55,11 +54,11 @@ import {
} from 'core-app/spot/components/drop-modal/drop-modal-teleportation.service';
import { delay } from 'rxjs';

// eslint-disable-next-line change-detection-strategy/on-push
@Component({
selector: 'op-modal-single-date-picker',
templateUrl: './modal-single-date-picker.component.html',
styleUrls: ['../styles/datepicker.modal.sass', './modal-single-date-picker.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [
{
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
1 change: 0 additions & 1 deletion spec/features/admin/working_days_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def working_days_setting

# Check if a date is correctly highlighted after selecting it in different time zones
datepicker.select_day 5
datepicker.expect_day "5"

# It can cancel and reopen
within_test_selector("op-datepicker-modal") do
Expand Down
19 changes: 19 additions & 0 deletions spec/support/components/datepicker/datepicker_modal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,24 @@ def set_date_input(date)
raise "Expected date to equal #{date}, but got #{input.value}" unless input.value == date.iso8601
end
end

##
# Select day from datepicker
def select_day(value)
unless (1..31).cover?(value.to_i)
raise ArgumentError, "Invalid value #{value} for day, expected 1-31"
end

expect(flatpickr_container).to have_text(value)

retry_block do
flatpickr_container
.first(".flatpickr-days .flatpickr-day:not(.nextMonthDay):not(.prevMonthDay)",
text: value)
.click

raise "Expected #{value} to be selected" unless flatpickr_container.has_css?(".flatpickr-day.selected", text: value)
end
end
end
end

0 comments on commit 47da171

Please sign in to comment.