Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/dashboard/app/javascript/dynamic_forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ function toggleMinMax(event, changeId, otherId) {
[ 'max', 'min' ].forEach((dim) => {
if(mm && mm[dim] !== undefined) {
changeElement.attr(dim, mm[dim]);
} else {
const defaultVal = dim == 'min' ? 1 : 999;
changeElement.attr(dim, defaultVal);
Comment on lines +511 to +513
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the precision here in making just a small enough change, but sadly, I feel like it's not enough.

It seems to me that we should embed the min or max to fall back on. Take this for example, we should fall back to these values if they're defined.

some_element:
  widget: number_field
  min: 2
  max: 4

If we can't fallback to any values, then we just don't. I think the conservative route of just doing nothing is better than choosing 1 or 999. But we can document that these are fallback values when you use data-min or data-max sparingly.

}
});

Expand Down
Loading