Commit Graph

103 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
b4b33926cf Fix HTML closing tags
In some places, we accidentally opened the same tag twice instead of
closing it, while in some other places we closed a tag without opening
it in the first place.

We've detected these issues thanks to the HTML Beautifier gem, which
we're about to start using for indentation purposes.
2025-03-07 16:02:07 +01:00
Javi Martín
e8184e169b Remove commented code in devise shared link
This code was commented in commit eedd91942, shortly after the project
started.
2025-03-06 18:25:45 +01:00
Javi Martín
3931b43b87 Move omniauth form partial to a component
This way we simplify the view a little bit and replace some slow system
tests with faster component tests.
2024-10-28 21:23:56 +01:00
Javi Martín
b9e137619a Simplify the way we provide the title in most cases
This is consistent with the way we're providing the main class.

Note we're still setting the title using a block in more complex cases.
2024-03-23 00:35:47 +01: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
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Javi Martín
c40c6e04e7 Move login links to components
We're trying to be consistent; in the past, we had the partials
"shared/admin_login_items", "layouts/notification_item" and
"devise/menu/login_items". Now we're moving all these partials to
components in the `Layout` namespace.
2023-01-16 14:44:05 +01:00
Javi Martín
cb2aebe2c8 Fix current_user usage in management section
In the management section, `current_user` is the user impersonated by
the manager. We were deciding whether to show the admin menu depending
on the privileges of the current user, but this menu should be shown
according to the privileges of the manager who is impersonating the
user.

We're doing a similar (very subtle) change in the login items. We were
rendering the `login_items` partial passing `current_user: user`.
However, inside this method, we were using `user_signed_in`, which
ignored the `current_user` we were passing. The result was always the
same expect in tests where we manually sign in users, but we're changing
it anyway in order to reduce confusion.
2023-01-16 14:22:23 +01:00
decabeza
7f0f35a5c0 Add mailer helpers to simplify customization 2022-06-02 17:56:15 +02:00
dependabot[bot]
d7afb9d8fe Bump devise from 4.7.3 to 4.8.0
Bumps [devise](https://github.com/plataformatec/devise) from 4.7.3 to 4.8.0.
- [Release notes](https://github.com/plataformatec/devise/releases)
- [Changelog](https://github.com/heartcombo/devise/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plataformatec/devise/compare/v4.7.3...v4.8.0)

---
updated-dependencies:
- dependency-name: devise
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-13 00:10:15 +02:00
Javi Martín
1632540984 Remove redundant placeholders in forms
Using placeholders having similar (or identical) text as already present
as a label has a few issues.

First, it's a distraction. Reading the same information twice is
useless, requires an extra effort, and might even frustrate users.

Second, if users start typing before reading the placeholder and see it
disappear, they might think they're missing relevant information,
delete what they typed, and read the placeholder. That will get them
nowhere.

Finally, we display placeholders using a text offering very low contrast
against the background, so users don't think the placeholder is an
actual value entered in the field. Using such low contrast makes the
text hard to read, particularly for users with visual impairments.

So we're removing these placeholders.

This commit only deals with placeholder texts with similar (or
identical) texts as the label text. There might be other places where we
should replace placeholder texts with labels, but that's a different
topic.
2021-06-23 19:52:45 +02:00
Javi Martín
4809a87a78 Apply Style/HashSyntax rule in ERB files 2021-02-05 17:46:23 +01:00
Julian Herrero
b7b05b55fe Show Wordpress login button if it's the only one enabled 2020-07-27 14:47:42 +02:00
Javi Martín
b1c2a4a9f2 Make it easier to add new omniauth buttons
Since we're using the exact same logic for all existing buttons, we can
just get the list of available ones and loop through them.
2020-07-27 14:47:42 +02:00
Javi Martín
ed2b217a08 Remove duplication in oauth actions
We were writing the same code twice, with the only difference being the
text "Sign up" in the sign_up action, and "Sign in" in the sign_in
action.

Note we're renaming the `omniauth.info_*` I18n keys so we don't need to
add new exceptions to the `ignore_unused` list, and so it's consistent
with all the other keys under the `omniauth` key.
2020-07-27 14:46:20 +02:00
Julian Herrero
193e51d42f Enable Wordpress Oauth login and registration 2020-02-07 12:23:41 +07:00
Javi Martín
c4ebea27a7 Add CSRF protection to Omniauth requests
More info:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-9284
https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
2019-11-29 03:18:53 +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
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
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
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
ee8426c5b5 Indent with spaces instead of tabs 2019-09-10 20:02:15 +02:00
Javi Martín
c62da726b8 Apply SpaceAroundErbTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
Javi Martín
347fc21cf0 Fix trailing whitespace 2019-09-10 19:21:03 +02:00
alejandro
2de51d1888 Changes autorize path method.
Devise api changed autorize path method
2019-04-16 17:28:07 +02:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
rgarcia
b35c750865 Remove unrelated budget recommendation's link
During the backport for “Read Notifications”[1] this link was added,
which belongs to a different backport “Budget Recommendations” which is
not quite ready to bring to upstream, yet 😌

[1] https://github.com/AyuntamientoMadrid/consul/pull/1304
2018-03-23 19:31:48 +01:00
rgarcia
09c44ee583 Extend notifications to be marked as read and unread 2018-03-23 11:47:06 +01:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00
decabeza
a14d54d56e include text for notification menu on mobile size 2017-10-17 13:26:00 +02:00
decabeza
79fb497bfb adds active class on login items menu 2017-07-19 17:03:19 +02:00
decabeza
3bcfaeb61a replaces sr-only class to show-for-sr 2017-06-13 17:51:57 +02:00
Juanjo Bazán
3f11dbe1d5 allows login using username or email 2017-06-12 17:26:38 +02:00
Alberto Garcia Cabeza
8b42d57e18 adds rel nofollow on links 2017-04-21 16:59:11 +02:00
Alberto Garcia Cabeza
7523c4f870 adds missing close div tag 2017-03-24 16:21:56 +01:00
Alberto Garcia Cabeza
45def094fe removes accesskey on top links and login items links 2017-03-14 18:42:21 +01:00
Alberto Garcia Cabeza
9e582245d3 avoids use tabindex attribute 2017-03-10 12:04:47 +01:00
Alberto Garcia Cabeza
750909916b improves layout on sign in and sign up views 2017-01-17 19:13:31 +01:00
Alberto Garcia Cabeza
508de35320 polishes forms styles on devise views 2017-01-09 19:10:15 +01:00
Alberto Garcia Cabeza
201a222cd3 improves styles for omniauth buttons 2017-01-09 18:49:29 +01:00
Marcia
1e87810593 improves expired password view 2016-09-29 14:34:37 +02:00
Marcia
8d883b1e17 mejoras de codigo 2016-09-15 11:45:03 +02:00
Alberto Garcia Cabeza
f3e0626709 Adds text to notifications icons on header 2016-07-12 13:24:49 +02: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
Alberto Garcia Cabeza
84f044c131 Improves website accessibility 2016-03-08 14:00:06 +01:00
Alberto Garcia Cabeza
5615f19ba9 Fixes some classes for foundation 6 2016-02-29 13:52:31 +01:00