Feature #44567 » 0003-Highlight-corresponding-Gantt-rows.patch
| app/assets/stylesheets/gantt.css | ||
|---|---|---|
|
}
|
||
|
[data-gantt-column="subjects"] .gantt-row {
|
||
|
inset-inline-start: var(--gantt-row-indent);
|
||
|
inline-size: calc(100% - var(--gantt-row-indent));
|
||
|
inset-inline-start: 0;
|
||
|
inline-size: 100%;
|
||
|
padding-inline-start: var(--gantt-row-indent);
|
||
|
line-height: 16px;
|
||
|
overflow: hidden;
|
||
|
white-space: nowrap;
|
||
| ... | ... | |
|
white-space: nowrap;
|
||
|
}
|
||
|
[data-gantt-column="subjects"] .gantt-row[data-gantt-row-type="issue"]:hover {
|
||
|
background-color: var(--oc-yellow-0);
|
||
|
.gantt-row-hover {
|
||
|
background-color: rgba(var(--oc-yellow-1-rgb), 0.5);
|
||
|
}
|
||
|
.gantt-timeline-body .gantt-row {
|
||
| app/helpers/gantt_helper.rb | ||
|---|---|---|
|
# Events emitted by child controllers the chart listens to.
|
||
|
# - `gantt--options` toggles checkboxes under Options.
|
||
|
# - `gantt--subjects` reports tree expand/collapse.
|
||
|
# - Mouse events synchronize the hovered row across the chart panes.
|
||
|
# - Window resize triggers a redraw of progress lines and relations.
|
||
|
action: %w(
|
||
|
gantt--options:toggle-display@document->gantt--chart#handleOptionsDisplay
|
||
|
gantt--options:toggle-relations@document->gantt--chart#handleOptionsRelations
|
||
|
gantt--options:toggle-progress@document->gantt--chart#handleOptionsProgress
|
||
|
gantt--subjects:toggle-tree->gantt--chart#handleSubjectTreeChanged
|
||
|
mouseover->gantt--chart#highlightRow
|
||
|
mouseout->gantt--chart#unhighlightRow
|
||
|
resize@window->gantt--chart#handleWindowResize
|
||
|
).join(' '),
|
||
|
'gantt--chart-issue-relation-types-value': Redmine::Helpers::Gantt::DRAW_TYPES.to_json,
|
||
| app/javascript/controllers/gantt/chart_controller.js | ||
|---|---|---|
|
}
|
||
|
disconnect() {
|
||
|
this.clearRowHighlight()
|
||
|
if (this.#drawPaper) {
|
||
|
this.#drawPaper.remove()
|
||
|
this.#drawPaper = null
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
highlightRow(event) {
|
||
|
const row = event.target.closest(".gantt-row")
|
||
|
if (!row) return
|
||
|
this.#setRowHighlight(row, true)
|
||
|
}
|
||
|
unhighlightRow(event) {
|
||
|
const row = event.target.closest(".gantt-row")
|
||
|
if (!row) return
|
||
|
if (!row.contains(event.relatedTarget)) {
|
||
|
this.#setRowHighlight(row, false)
|
||
|
}
|
||
|
}
|
||
|
clearRowHighlight() {
|
||
|
this.element.querySelectorAll(".gantt-row-hover").forEach((row) => {
|
||
|
row.classList.remove("gantt-row-hover")
|
||
|
})
|
||
|
}
|
||
|
showSelectedColumnsValueChanged() {
|
||
|
this.#drawSelectedColumns()
|
||
|
}
|
||
| ... | ... | |
|
this.showProgressValue = !!(event.detail && event.detail.enabled)
|
||
|
}
|
||
|
#setRowHighlight(row, highlighted) {
|
||
|
const rowKey = row.dataset.ganttRowKey
|
||
|
if (!rowKey) return
|
||
|
const selector = `.gantt-row[data-gantt-row-key="${CSS.escape(rowKey)}"]`
|
||
|
this.element.querySelectorAll(selector).forEach((element) => {
|
||
|
element.classList.toggle("gantt-row-hover", highlighted)
|
||
|
})
|
||
|
}
|
||
|
#drawProgressLineAndRelations() {
|
||
|
this.#setupDrawArea()
|
||
|
this.#setupDrawPaper()
|
||
| test/system/gantts_test.rb | ||
|---|---|---|
|
assert_selector timeline_issue, visible: :visible
|
||
|
end
|
||
|
test 'row highlight spans subjects selected columns and timeline' do
|
||
|
visit_gantt
|
||
|
expand_options
|
||
|
find('#draw_selected_columns').check
|
||
|
find('.gantt-timeline-body .gantt-row[data-gantt-row-key="issue-1"] .tooltip').hover
|
||
|
assert_selector '[data-gantt-column="subjects"] .gantt-row.gantt-row-hover[data-gantt-row-key="issue-1"]'
|
||
|
assert_selector '[data-gantt-column="status"] .gantt-row.gantt-row-hover[data-gantt-row-key="issue-1"]'
|
||
|
end
|
||
|
test 'related issues toggle displays and hides relation arrows' do
|
||
|
visit_gantt
|
||
|
expand_options
|
||
| ... | ... | |
|
assert_selector '.gantt-relations path', minimum: 1
|
||
|
# Relation arrows should keep the same position when redrawn after horizontal scrolling.
|
||
|
paths_before_scroll = all('.gantt-relations path').pluck(:d)
|
||
|
find('#draw_relations').uncheck
|
||
| ... | ... | |
|
issue_link_text = issue1_subject_row.first('a.issue', visible: :all).text
|
||
|
assert_selector '.tip', text: issue_link_text
|
||
|
end
|
||
|
# Context menu for issue subject
|
||
|
issue1_subject_row.right_click
|
||