Commit Graph

51 Commits

Author SHA1 Message Date
Javi Martín
b51aa31e6a Use HTML beautifier to indent ERB files
We had inconsistent indentation in many places. Now we're fixing them
and adding a linter to our CI so we don't accidentally introduce
inconsistent indentations again.
2025-03-07 16:31:08 +01:00
Javi Martín
6af8ddd324 Extract component to render the date of birth
We reduce code duplication thanks to that, and make it easier
to change this field.

Note that there was one place where the "16.years" value was
hardcoded. We're moving the test for this case to the
component and changing it so the test doesn't use the default
age.

We're also removing the redundant helper method that had the
same code as a method in the User class which is called
everywhere else.
2024-11-12 15:15:34 +01:00
Javi Martín
431ebeda87 Fix missing "for" attribute in document number label
Since this attribute was missing, the label wasn't correctly associated
with its field.
2024-11-08 15:03:55 +01:00
Javi Martín
c2710de5fc Extract method to open links in a new window
This way we can slightly simplify the code.
2023-10-23 18:19:48 +02:00
Javi Martín
95958b2080 Remove title attribute in fields to accept terms
Not sure why we introduced these titles in commit 9dce52a69. The title
attributes contained the same text as the label, which IMHO made them
useless.
2023-10-23 18:19:48 +02:00
Javi Martín
1a098dfcab Add and apply MultilineMethodCallBraceLayout rule
In order for this rule to work effectively when running `--autocorrect`,
we also need to enable the `ClosingParenthesisIndentation` rule.
2023-08-18 14:56:16 +02:00
Javi Martín
629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00
Javi Martín
9b908d7264 Extract component to render account permissions
We were using similar code in four different places; six, if we count
the welcome pages seeds. Reducing duplication in the pages seeds is a
bit tricky because administrators are supposed to edit their content and
might remove the HTML class we use to define styles. However, we can
share the code everywhere else.

Note that there's a bug in the application since we show that level 2
users cannot vote for budget projects but we give them permission to do
so in the abilities model. We're keeping the same behavior after this
refactoring but we might change it in the future.
2022-11-29 18:48:24 +01:00
Javi Martín
6382028142 Use page_path to generate the census_terms URL
We had a link to `/census_terms`, and by looking at the code, it wasn't
so clear where this URL came from.

Using `page_path`, it's easier to understand that it comes from a page
with the `census_term` slug. It also means we'll find this line when
searching for usages of `page_path` in the code.
2022-05-04 16:22:46 +02:00
Javi Martín
231a7aa8ee Remove unused code to track events
We forgot to remove it in commit f28a5cc49.

The generated HTML was invalid, with the error:

> Element meta is missing one or more of the following attributes:
> content, property.
2021-12-30 17:05:07 +01:00
Javi Martín
6ea9383743 Allow toggling elements with the keyboard
Using `<a>` tags with no `href` means these elements cannot be activated
by keyboard users, so we're replacing them with buttons.

In the future we probably want to add more consistency so all toggle
buttons use the same code. We might also add styles depending on the
`aria-expanded` property.
2021-03-31 13:38:38 +02:00
Senén Rodero Rodríguez
588fac6055 Rename method and placeholder
As `residence_in_madrid` is too specific.

We should port this commit to main repo.
2021-03-02 13:15:15 +01:00
Javi Martín
6b1864fbcd Sanitize translations instead of using _html
Using the `_html` suffix in an i18n key is the same as using `html_safe`
on it, which means that translation could potentially be used for XSS
attacks.
2019-10-09 19:46:47 +02:00
Javi Martín
75a28fafcb Sanitize label texts automatically
This way we can remove all those `html_safe` calls and we avoid
potential XSS attacks in label texts.
2019-10-08 18:46:21 +02:00
Javi Martín
55a190f44a Remove unneeded _html suffix in I18n keys
This suffix does the same thing as calling `.html_safe` on them. So we
don't need to use it in texts that don't use HTML.
2019-10-08 13:20:22 +02:00
Javi Martín
9ddbd01f91 Use active model translations for labels
The same way we did for Active Record, but this time we do it for models
not inheriting fom Active Record.
2019-10-07 01:56:24 +02:00
Javi Martín
8d9cb4d8e3 Simplify generating checkboxes in forms
Using the block syntax to generate the label with a <span> tag inside
isn't necessary after upgrading foundation_rails_helpers. Before the
upgrade, we couldn't do so because the <span> tag was escaped.
2019-10-06 19:32:04 +02:00
Javi Martín
4f5de5be3b Add aria-describedby attribute automatically
We were manually adding the attribute in many places, but not
everywhere. I'm assuming adding it where we didn't have it is doing no
harm.
2019-10-06 19:32:03 +02:00
Javi Martín
3ea9f3cecf Simplify generating form fields with labels
Instead of generating the label and then a field without a label, we can
directly generate a field with a label.
2019-10-05 16:01:58 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
c62da726b8 Apply SpaceAroundErbTag ERB Lint rule 2019-09-10 20:02:15 +02:00
decabeza
21c6da3767 Use min age to participate setting on verification residence form 2019-03-22 16:15:48 +01:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
decabeza
0e1bf2188c Remove unused verification offices url setting 2019-03-06 13:08:35 +01:00
Javi Martín
e34a827c48 Add translations for rails date order
Not doing so caused crashes on applications which don't fall back to
English when a translation is missing.

We're adding them in a separate file so we can exclude it from crowdin
and so translators don't translate symbols as if they were words which
need translation.
2018-12-21 19:31:15 +01:00
decabeza
0bf31bde6c Updates all active to is-active classes 2018-06-06 12:02:13 +02:00
decabeza
0b235d69d4 adds consistency for back links 2017-07-26 18:18:30 +02:00
decabeza
af7807ce9f Updates custom note class to foundation help-text 2017-06-27 10:29:36 +02:00
decabeza
3bcfaeb61a replaces sr-only class to show-for-sr 2017-06-13 17:51:57 +02:00
Fernando Blat
76bc1a7934 Use settings helper 2017-01-03 08:55:17 +01:00
Fernando Blat
ca2370eb7c Manage offices url as a setting 2016-12-29 10:31:38 +01:00
Alberto Garcia Cabeza
42722080fc Changes references to Madrid 2016-07-05 13:47:14 +02:00
palomahnhp
b4ec077f16 Merge remote-tracking branch 'origin/master' into tracking_user_verifications_and_others
Conflicts:
	app/assets/javascripts/application.js
2016-04-20 11:28:06 +02:00
Alberto Garcia Cabeza
7648baa240 Adds help for document number on verification 2016-03-15 17:06:14 +01:00
Alberto Garcia Cabeza
f6571662a2 Adds title on links with target blank 2016-03-14 19:32:49 +01:00
Alberto Garcia Cabeza
9dce52a69a Adds title on input checkboxes 2016-03-14 19:32:49 +01:00
Alberto Garcia Cabeza
3ec0971b37 Replaces icons i tags for span 2016-03-14 19:32:48 +01:00
palomahnhp
7d4936b577 track user verification and add statistics of verified users who did not vote proposals 2016-03-13 21:38:05 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
Alberto Garcia Cabeza
2cbfde8f66 Changes texts on error verification and faqs page 2015-10-23 12:47:04 +02:00
Alberto Garcia Cabeza
ebcb1009ae Changes texts and styles for verification process 2015-10-02 15:15:05 +02:00
Alberto Garcia Cabeza
bf08cb582f Adds title on close alerts link 2015-09-28 13:46:54 +02:00
Alberto Garcia Cabeza
de4b0eb502 Improves styles for verification account 2015-09-17 13:38:32 +02:00
Alberto Garcia Cabeza
101a50a96e Improves layout styles 2015-09-07 16:36:33 +02:00
Álvaro Durán Tovar
92ae988251 adds close button to alert boxes, also adds
data-alert attribute to enable javascript
on them
2015-09-06 19:54:12 +02:00
Alberto Garcia Cabeza
4e92b5c3ce Adds back link on verification pages 2015-09-04 15:06:38 +02:00
Alberto Garcia Cabeza
da86c5d6e0 Adds styles for verification account process 2015-09-02 12:34:08 +02:00
Alberto Garcia Cabeza
0235231ae6 Add first styles for verification account process 2015-08-31 21:50:41 +02:00
rgarcia
9abd794133 validates acceptance of census terms of service 2015-08-30 12:50:17 +02:00
Juanjo Bazán
e8463d1372 moves Residence model to Verification namespace 2015-08-29 12:38:07 +02:00