OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Show frequency and interval in horizontal group
Oliver Güntherf74bea725930
diff --git a/frontend/src/stimulus/controllers/show-when-value-selected.controller.ts b/frontend/src/stimulus/controllers/show-when-value-selected.controller.tsindex cfb31519fd5..d29ae2c9c33 100644--- a/frontend/src/stimulus/controllers/show-when-value-selected.controller.ts+++ b/frontend/src/stimulus/controllers/show-when-value-selected.controller.ts@@ -21,11 +21,22 @@ export default class OpShowWhenValueSelectedController extends ApplicationContro.effectTargets.filter((el) => targetName === el.dataset.targetName).forEach((el) => {- if (el.dataset.notValue) {- el.hidden = el.dataset.notValue === input.value;+ const disabled = this.willDisable(el, input.value);+ el.disabled = disabled;++ if (el.dataset.setVisibility === 'true') {+ el.style.setProperty('visibility', disabled ? 'hidden' : 'visible');} else {- el.hidden = !(el.dataset.value === input.value);+ el.hidden = disabled;}});}++ private willDisable(el:HTMLElement, value:string):boolean {+ if (el.dataset.notValue) {+ return el.dataset.notValue === value;+ }++ return !(el.dataset.value === value);+ }}diff --git a/lookbook/docs/patterns/02-forms.md.erb b/lookbook/docs/patterns/02-forms.md.erbindex b9e78cfddd9..b757110c941 100644--- a/lookbook/docs/patterns/02-forms.md.erb+++ b/lookbook/docs/patterns/02-forms.md.erb@@ -162,7 +162,8 @@ Important data inputs:- `"show-when-value-selected-target": "effect"` is the input that will get hidden or shown depending on the selected value- `data: { value: 'XYZ'}` or `data-value="XYZ"` the value to be checked against the cause- `data: { not_value: 'XYZ'}` or `data-not-value="XYZ"` the value to be checked against the cause, resulting in it being hidden if the selected value is NOT the given one.-- data: `{ target_name: "abc"}` or `data-target-name="abc"` allows you to define multiple sets of cause/effect handlers+- data: `{ target_name: "abc"}` or `data-target-name="abc"` allows you to define multiple sets of cause/effect handlers+- If you want the target to be visibly blocked, not hidden, then use `data: { set_visibility: "true" }`. By default, the field will be hidden and removed from DOM computation.diff --git a/modules/meeting/app/components/meetings/index/form_component.html.erb b/modules/meeting/app/components/meetings/index/form_component.html.erbindex ee26235bf1e..82f8c581a1e 100644--- a/modules/meeting/app/components/meetings/index/form_component.html.erb+++ b/modules/meeting/app/components/meetings/index/form_component.html.erb@@ -48,18 +48,23 @@if @meeting.is_a?(RecurringMeeting)modal_body.with_row(mt: 3) do- render(RecurringMeeting::Frequency.new(f))- end+ flex_layout(classes: "FormControl-horizontalGroup") do |frequency_row|+ frequency_row.with_column(flex: 1) do+ render(RecurringMeeting::Frequency.new(f))+ end- modal_body.with_row(- mt: 3,- hidden: @meeting.frequency_working_days?,- data: {- target_name: "frequency",- not_value: "working_days",- "show-when-value-selected-target": "effect"- }) do- render(RecurringMeeting::Interval.new(f))+ frequency_row.with_column(+ flex: 1,+ hidden: @meeting.frequency_working_days?,+ data: {+ target_name: "frequency",+ not_value: "working_days",+ set_visibility: "true",+ "show-when-value-selected-target": "effect"+ }) do+ render(RecurringMeeting::Interval.new(f))+ end+ endendmodal_body.with_row(mt: 3) do