Commit Graph

8 Commits

Author SHA1 Message Date
Javi Martín
cdf859621e Allow links in forms to open in new tabs
We used to open these links in new tabs, but accidentally stopped doing
so in commit 75a28fafc.

While, in general, automatically opening a link in a new tab/window is a
bad idea, the exception comes when people are filling in a form and
there are links to pages that contain information which will help them
fill in a form.

There are mainly two advantages of this approach. First, it makes less
likely for people to accidentally lose the information they were filling
in. And, second, having both the form and a help page open at the same
time can make it easier to fill in the form.

However, opening these links in new tabs also has disadvantages, like
taking control away from people or making it harder to navigate through
pages when using a mobile phone.

So this is a compromise solution.
2023-10-23 18:19:48 +02:00
taitus
923c2a7ee2 Check labels styles
We are use a display: block style for labels containing check boxes inside
them, and the label has a width of 100%.

This means that clicking on the blank space on the right of the label text
will check/uncheck the checkbox. To avoid this behaviour we modify the
"display" attribute of the labels.

In order to prevent unexpected behaviour in terms_of_service form labels,
we add specific css for this case when define a checkbox within the
.actions class.
2022-04-04 18:55:56 +02:00
Javi Martín
1fa05b1f54 Fix crash on attributes with interpolation arguments
The application crashed when we generated hints to attributes with
interpolation arguments in their `human_attribute_name`.

When generating the hint, we used the `custom_label` method to generate
a label and get the `for` attribute and, since we weren't passing a
text, it used the default human attribute name for the field. However,
it crashes if the default attribute name requires an interpolation
argument.

So now, since we were only using the `custom_label` method in order to
get the `for` attribute, we're simply passing an arbitrary text to the
method.
2022-03-28 14:55:42 +02:00
taitus
d719b2291e Do not generate an empty hint element when there's an empty hint 2022-03-28 14:55:42 +02:00
Javi Martín
effd646e54 Update the way we create form builders in tests
We were getting a warning in Rails 6:

DEPRECATION WARNING: ActionView::Base instances should be constructed
with a lookup context, assignments, and a controller.
2022-03-21 20:43:50 +01:00
Javi Martín
b27d0a8e92 Add and apply ConstantDefinitionInBlock rule
This rule was added in Rubocop 0.91.0. A similar rule named
LeakyConstantDeclaration was added in rubocop-rspec 1.34.0.

Note using the FILENAMES constant did not result in an offense using the
ConstantDefinitionInBlock rule but did result in an offense using the
LeakyConstantDeclaration rule. I've simplified the code to get rid of
the constant; not sure why we were adding a constant with `||=` in the
middle of a spec.
2020-10-23 12:04:22 +02:00
Javi Martín
cd418e45be Allow hints on select fields
Just like we allow them on input fields.
2020-09-09 12:20:46 +02:00
Javi Martín
c5f4cd6229 Fix invalid "hint" attribute in forms
Using `hint: false` was generating an input with `hint="false"` instead
of generating no hint at all.
2020-08-22 23:00:14 +02:00