Commit Graph

25 Commits

Author SHA1 Message Date
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
0edfd0cab5 Open management links in the same window
We were doing it this way because managers usually have the management
section open at all times. However, this might not always be the case,
and by opening links in a new tab, we're taking control away from them.

If managers would like to keep the management section open, they can
open the link in a new tab, and if they open it in the same tab, they
can go back to the management section by either clicking the browser's
back button or clicking on the navigation link to the management
section.
2023-10-24 16:31:39 +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
92b1e53fc3 Unify user permission texts
We had the same texts four times, with slight variations in the case of
the management section.

We're unifying them under the "verification" i18n namespace, since the
texts are about actions which can be done depending on whether users are
verified or not.

Note the names of the i18n keys aren't very consistent, since we use
"debates" in plural but "proposal" in singular. We're leaving it like
this so existing translations aren't affected.
2022-06-01 14:27:33 +02:00
Javi Martín
b66859945e Remove _html suffix from already sanitized texts
Using the `_html` suffix automatically marks texts as HTML safe, so
doing so on sanitized texts is redundant.

Note flash texts are not sanitized the moment they are generated, but
are sanitized when displayed in the view.
2019-10-09 19:46:47 +02:00
Javi Martín
928312e218 Use sanitize in translations with links
Sometimes we're interpolating a link inside a translation, and marking
the whole translations as HTML safe.

However, some translations added by admins to the database or through
crowdin are not entirely under our control.

Although AFAIK crowdin checks for potential cross-site scripting
attacks, it's a good practice to sanitize parts of a string potentially
out of our control before marking the string as HTML safe.
2019-10-08 18:46:21 +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
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
taitus
ceaf118188 Add new fields to form
- Add :date_of_birth and :postal_code
- Only display new fields when aplication has configured the Remote
  Census API and contains values for fields. Check with Setting Class
  methods:
  - force_presence_date_of_birth?
  - force_presence_postal_code?
2019-07-29 13:10:09 +02:00
Julian Herrero
0e0462368b Use double quotes in app/views/management 2019-03-19 12:16:50 +01:00
decabeza
2e8fe65b3d Cleans and improves management views layout 2018-07-02 17:41:39 +02:00
Alberto Garcia Cabeza
702cfe13d1 Fixes specs 2016-07-06 14:47:09 +02:00
Alberto Garcia Cabeza
42722080fc Changes references to Madrid 2016-07-05 13:47:14 +02:00
Alberto Garcia Cabeza
5bd7bbee4f Improves styles for management section 2016-06-01 18:07:58 +02:00
Juanjo Bazán
e4e87bf548 moves user deletion link to a partial 2016-04-08 11:39:33 +02:00
Juanjo Bazán
ce477273da adds managers option to delete a level 2 account 2016-04-08 11:03:30 +02:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
rgarcia
0a668ae39a checks valid age 2015-10-19 11:20:32 +02:00
rgarcia
f55c3974aa refactors managed user info into management layout 2015-10-12 14:05:06 +02:00
kikito
b6aaad87af Adds a user controller for management 2015-10-07 20:18:17 +02:00
kikito
d5d5e683d1 Refactors account_info partial 2015-10-07 19:39:59 +02:00
kikito
5e327f0ae0 Applies the same renaming done in management.yml to the views 2015-10-05 19:40:10 +02:00
kikito
6f799ae32e Extracts common elements out of management views 2015-10-05 11:49:15 +02:00
kikito
1fe850b6dc Renaming of management validations 2015-10-01 19:27:04 +02:00