Commit Graph

18448 Commits

Author SHA1 Message Date
Javi Martín
55ed40e182 Depend on a specific version of Node.js
We're choosing version 18 because if offers support for SSL 3, just
like Ruby 3.1 does.

Note we're symlinking a .nvmrc file as well, in order to make it
compatible with NVM. While the .nvmrc and .node-version files use
different formats, they both support the syntax we're using to
define the version.

The code to install Node.js in the Dockerfile is a simplification of the
code in the Rails Dockerfile template [1].

[1] https://github.com/rails/rails/blob/04c97aec8a/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt#L25
2023-10-17 13:11:58 +02:00
Senén Rodero
0138e5d92c Merge pull request #5168 from consuldemocracy/bug_editing_image_name
Do not validate the attachment when updating the name
2023-10-13 15:00:27 +02:00
Javi Martín
5317f2fe28 Merge pull request #5257 from consuldemocracy/increase_contrast
Increase contrast in colors used in "My account"
2023-10-10 15:33:18 +02:00
Javi Martín
664b7c853b Merge pull request #5255 from consuldemocracy/focus_contrast
Increase links and buttons contrast on focus
2023-10-10 15:31:55 +02:00
Javi Martín
ae4b07de41 Make alt text readable when the logo doesn't load
We were displaying the alt text using the same color as the background
color, which made it impossible to read it when the logo didn't load
(for whatever reason).

Using the same color as the text, like done in the admin section, solves
the issue.
2023-10-10 15:03:35 +02:00
Javi Martín
19bb08f7b8 Increase contrast in initialjs avatars
Not all the colors initialjs uses by default provide enough contrast
against a white text. The default initialjs colors are:

["#1abc9c", "#16a085", "#f1c40f", "#f39c12", "#2ecc71", "#27ae60",
"#e67e22", "#d35400", "#3498db", "#2980b9", "#e74c3c", "#c0392b",
"#9b59b6", "#8e44ad", "#bdc3c7", "#34495e", "#2c3e50", "#95a5a6",
"#7f8c8d", "#ec87bf", "#d870ad", "#f69785", "#9ba37e", "#b49255",
"#b49255", "#a94136"]

We're replacing them with colors containing less luminosity when
necessary in order to get a 4,5:1 contrast (it could be argued that a
3:1 contrast is enough when the icons are big, but that isn't always the
case and more contrast doesn't hurt):

["#16836d", "#12826c", "#896f06", "#a06608", "#1e8549", "#1e8549",
"#b35e14", "#c75000", "#207ab6", "#2779b0", "#de2f1b", "#c0392b",
"#9b59b6", "#8e44ad", "#6c767f", "#34495e", "#2c3e50", "#66797a",
"#697677", "#d82286", "#c93b8e", "#db310f", "#727755", "#8a6f3d",
"#8a6f3d", "#a94136"]

Since initialjs doesn't provide a way to change these colors using
JavaScript, we're changing them in Ruby, following the same algorithm
used by initialjs.
2023-10-10 15:03:35 +02:00
Javi Martín
517f74a748 Extract component to render an initialjs avatar
This way it'll be easier to change it.
2023-10-10 15:03:35 +02:00
Javi Martín
959176b66d Use a darker "delete" color
The color we were using didn't have enough contrast against a white
background, which made it harder to read texts like "Remove map marker"
or "Erase my account".

Since the new color is almost identical to the color we were using on
hover and for the border, we're changing the color on hover as well,
while IMHO it's no longer necessary to use a different color for the
border.
2023-10-10 15:03:35 +02:00
Javi Martín
64edfe5c98 Increase links and buttons contrast on focus
The Web Content Accessibility Guidelines version 2.1 added a success
criterion called Non-text Contrast [1], which mentions that the focus
indicator must contrast with the background, and version 2.2 introduced
a specific one regarding focus appearance [2]. According to that
criterion, the focus indicator:

* is at least as large as the area of a 2 CSS pixel thick perimeter of
  the unfocused component or sub-component
* has a contrast ratio of at least 3:1 between the same pixels in the
  focused and unfocused states.

Our current solution for highlighting elements on focus has a couple of
issues:

* It doesn't offer enough contrast against the default white background
  (1.6:1)
* It offers even less contrast against other backgrounds, like the
  homepage banner or the featured proposals/debates

Making the color of the outline darker would increase the contrast
against these backgrounds, but it would reduce the contrast against
other backgrounds like our default brand color.

For this reason, most modern browsers use a special double outline with
two different colors [3], and we're choosing to combine an outline and a
box shadow to emulate it, using the brand color as the second color.

However, this double-colored outline doesn't work so well when focusing
on dark buttons surrounded by a light background, so instead we're using
a triple outline, which works well on any color combination [4]. Since I
feel that making the third outline 2px wide makes the overall outline
too wide, I'm making the inner outline just 1px wide since that's enough
to prevent edge cases.

Note that Foundation adds a transition for the `box-shadow` property on
`select` controls, which gets in the way of the focus we use on the
language selector. So we're removing the transition.

Also note that the box-shadow style didn't work properly with the
box-shadow we added on the `:hover` status on cards, so we're changing
the code in order to cover this case.

Finally, note that the box-shadow isn't displayed properly on multiline
links (in Chrome, not even with `box-decoration-break: clone`), like the
ones in debates/proposals/polls/investments/processes titles, so we're
changing the style of these links to `inline-block`.

[1] https://www.w3.org/TR/WCAG21/#non-text-contrast
[2] https://www.w3.org/TR/WCAG22/#focus-appearance
[3] https://www.sarasoueidan.com/blog/focus-indicators/#examining-(current)-browser-focus-indicators-against-wcag-requirements
[4] https://www.erikkroes.nl/blog/the-universal-focus-state/
2023-10-10 15:03:21 +02:00
Javi Martín
d3eeffded1 Fix focus outline on links containing images
In some cases, like SDG icons and the proposals map, the image was
bigger than the link containing it, resulting in a funny-looking outline
on focus.

For reasons I don't understand, using `&:active,&:focus:active` didn't
compile to the CSS I was expecting, so I'm repeating the same code for
these two separate cases.
2023-10-10 15:03:21 +02:00
Javi Martín
b15512f025 Fix focus outline on budget executions index
The outline was invisible when we had the link containing block
elements, and I didn't manage to fix it, so the easiest solution is to
use an inline link and style the card with CSS.
2023-10-10 15:03:21 +02:00
Javi Martín
f285dfcbac Simplify HTML in proposal/debates recommendations
This way it's going to be easier to style the link on focus, since
styles like `box-shadow` weren't working properly when we had an inline
link with block elements inside, and adding the `display: inline-block`
element to the link didn't play well with the layout we were using for
the recommendations.

We're also fixing the focus outline on recommendations, which didn't
look properly because of the border added with:

```
.recommended-index {
  // (...)
  @include full-width-border(top, 1px solid #fafafa);
}
```

The border was on top of the outline, breaking it. Increasing the
`z-index` of the element containing the outline solves the issue.

In a similar way, we're making sure the button to hide recommendations
stays visible so it's easier to click it.
2023-10-10 15:03:21 +02:00
Javi Martín
d874697310 Remove redundant CSS properties set to none
These are default values that aren't needed.
2023-10-10 15:03:21 +02:00
Senén Rodero Rodríguez
2ae3045a04 Do not validate the attachment file content type ...
when the attachment has not changed
2023-10-10 10:33:25 +02:00
Julian Herrero
5f29680186 Do not validate the attachment file size ...
when the attachment has not changed
2023-10-10 10:33:04 +02:00
Sebastia
db759bdd08 Merge pull request #5118 from consuldemocracy/undo-votes
Allow undoing "like/unlike" votes
2023-10-10 06:44:43 +02:00
taitus
00ff47e7e6 Add component in order to reduce duplicated code
Co-authored-by: Javi Martín <javim@elretirao.net>
2023-10-09 07:38:01 +02:00
taitus
718fcba6d8 Allow undo votes in comments votes component 2023-10-09 07:38:01 +02:00
taitus
f87a332c3e Refactoring: Move 'vote' action to Comments::VotesControllers
As far as possible I think the code is clearer if we use CRUD actions
rather than custom actions. This will make it easier to add the action
to remove votes in the next commit.

Note that we are adding this line as we need to validate it that a vote
can be created on a comment by the current user:

```authorize! :create, Vote.new(voter: current_user, votable: @comment)```

We have done it this way and not with the following code as you might
expect, as this way two votes are created instead of one.

```load_and_authorize_resource through: :comment, through_association: :votes_for```

This line tries to load the resource @comment and through the association
"votes_for" it tries to create a new vote associated to that debate.
Therefore a vote is created when trying to authorise the resource and
then another one in the create action, when calling @comment.vote.
2023-10-09 07:21:49 +02:00
taitus
b39b64a674 Remove unnecessary 'shallow' in comments routes
Since this commit 6e27917d6e it seems that it is no longer necessary
to continue using shallow.
2023-10-09 07:21:49 +02:00
taitus
e0dc7c96c3 Use polimorphic path in favor against component 2023-10-09 07:21:49 +02:00
taitus
108a05a66d Allow undo votes in favor against component 2023-10-09 07:21:49 +02:00
taitus
fd5fa2da79 Refactoring: Move 'vote' action to Votes Controllers
As far as possible I think the code is clearer if we use CRUD actions
rather than custom actions. This will make it easier to add the action
to remove votes in the next commit.

Note that we are adding this line as we need to validate it that a vote
can be created on a debate by the current user:

```authorize! :create, Vote.new(voter: current_user, votable: @debate)```

We have done it this way and not with the following code as you might
expect, as this way two votes are created instead of one.

```load_and_authorize_resource through: :debate, through_association: :votes_for```

This line tries to load the resource @debate and through the association
"votes_for" it tries to create a new vote associated to that debate.
Therefore a vote is created when trying to authorise the resource and
then another one in the create action, when calling @debate.vote_by (which
is called by @debate.register_vote).
2023-10-09 07:21:49 +02:00
taitus
c96e3b027f Replace Partials with Direct Component Rendering
In this commit, we have performed a refactoring to enhance code organization.
Several partials that were solely responsible for rendering components have been removed.

Instead, we are now directly rendering the components within the views where these
partials were previously used.
2023-10-06 18:13:45 +02:00
taitus
5009bf6c37 Add aria-pressed to in comments votes component
In order to the users using screen readers know whether the button is pressed
or not.
2023-10-06 18:13:45 +02:00
taitus
10cfa0e59f Refactor scss for in favor against component
In order to reduce the code used to add styles to the buttons,
we removed the classes that had been added and handled it with
the new aria-pressed attribute
2023-10-06 18:13:45 +02:00
taitus
daf9692753 Add aria-pressed to in favor against component
In order to the users using screen readers know whether the button is pressed
or not.
2023-10-06 07:14:07 +02:00
Javi Martín
4f747c9b53 Merge pull request #5272 from jensconsul/master
update readme file
2023-10-04 23:05:47 +02:00
jensconsul
85ddb367fc Merge pull request #1 from jensconsul/jensconsul-readme-edit
Update README.md
2023-10-04 10:50:24 +02:00
jensconsul
aa0667e7cf Update README.md
These are Jens Kimmel proposed changes to the README file so as to include a reference to the Foundation and the global user community
2023-10-04 09:56:20 +02:00
Javi Martín
5fda3f33ed Merge pull request #5263 from consuldemocracy/dependabot/bundler/knapsack_pro-5.7.0
Bump knapsack_pro from 5.6.0 to 5.7.0
2023-10-04 02:25:31 +02:00
dependabot[bot]
8480b5f31e Bump knapsack_pro from 5.6.0 to 5.7.0
Bumps [knapsack_pro](https://github.com/KnapsackPro/knapsack_pro-ruby) from 5.6.0 to 5.7.0.
- [Changelog](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.6.0...v5.7.0)

---
updated-dependencies:
- dependency-name: knapsack_pro
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-04 02:04:19 +02:00
Javi Martín
2d74ac0b61 Merge pull request #5264 from consuldemocracy/dependabot/bundler/groupdate-6.4.0
Bump groupdate from 6.2.1 to 6.4.0
2023-10-04 01:37:36 +02:00
dependabot[bot]
aabd5cf397 Bump groupdate from 6.2.1 to 6.4.0
Bumps [groupdate](https://github.com/ankane/groupdate) from 6.2.1 to 6.4.0.
- [Changelog](https://github.com/ankane/groupdate/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ankane/groupdate/compare/v6.2.1...v6.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-04 01:15:55 +02:00
Javi Martín
545e9a27e9 Merge pull request #5265 from consuldemocracy/dependabot/bundler/audited-5.4.0
Bump audited from 5.3.3 to 5.4.0
2023-10-04 00:15:33 +02:00
dependabot[bot]
4598af5256 Bump audited from 5.3.3 to 5.4.0
Bumps [audited](https://github.com/collectiveidea/audited) from 5.3.3 to 5.4.0.
- [Changelog](https://github.com/collectiveidea/audited/blob/main/CHANGELOG.md)
- [Commits](https://github.com/collectiveidea/audited/compare/v5.3.3...v5.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 21:46:13 +00:00
Javi Martín
50a3b9b451 Merge pull request #5266 from consuldemocracy/dependabot/bundler/rubocop-performance-1.19.1
Bump rubocop-performance from 1.19.0 to 1.19.1
2023-10-03 23:45:12 +02:00
dependabot[bot]
cc6668adfb Bump rubocop-performance from 1.19.0 to 1.19.1
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.19.0 to 1.19.1.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.19.0...v1.19.1)

---
updated-dependencies:
- dependency-name: rubocop-performance
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 23:23:17 +02:00
Javi Martín
9077c060ed Merge pull request #5267 from consuldemocracy/dependabot/bundler/rubocop-1.56.4
Bump rubocop from 1.56.2 to 1.56.4
2023-10-03 22:45:41 +02:00
dependabot[bot]
3d094bbdc5 Bump rubocop from 1.56.2 to 1.56.4
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.2 to 1.56.4.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.56.2...v1.56.4)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 20:13:35 +00:00
Javi Martín
ef4c438b96 Merge pull request #5269 from consuldemocracy/dependabot/bundler/rubocop-factory_bot-2.24.0
Bump rubocop-factory_bot from 2.23.1 to 2.24.0
2023-10-03 22:12:18 +02:00
dependabot[bot]
82e74969b9 Bump rubocop-factory_bot from 2.23.1 to 2.24.0
Bumps [rubocop-factory_bot](https://github.com/rubocop/rubocop-factory_bot) from 2.23.1 to 2.24.0.
- [Release notes](https://github.com/rubocop/rubocop-factory_bot/releases)
- [Changelog](https://github.com/rubocop/rubocop-factory_bot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-factory_bot/compare/v2.23.1...v2.24.0)

---
updated-dependencies:
- dependency-name: rubocop-factory_bot
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 18:37:08 +00:00
Javi Martín
edcef9e8a8 Merge pull request #5270 from consuldemocracy/dependabot/bundler/view_component-3.6.0
Bump view_component from 3.5.0 to 3.6.0
2023-10-03 20:34:30 +02:00
dependabot[bot]
eb04ec1bf9 Bump view_component from 3.5.0 to 3.6.0
Bumps [view_component](https://github.com/viewcomponent/view_component) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/viewcomponent/view_component/releases)
- [Changelog](https://github.com/ViewComponent/view_component/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/viewcomponent/view_component/compare/v3.5.0...v3.6.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 17:54:46 +00:00
Javi Martín
8cc772f187 Merge pull request #5261 from consuldemocracy/dependabot/bundler/dalli-3.2.6
Bump dalli from 3.2.5 to 3.2.6
2023-10-03 19:53:17 +02:00
dependabot[bot]
5f9295db18 Bump dalli from 3.2.5 to 3.2.6
Bumps [dalli](https://github.com/petergoldstein/dalli) from 3.2.5 to 3.2.6.
- [Changelog](https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/petergoldstein/dalli/compare/v3.2.5...v3.2.6)

---
updated-dependencies:
- dependency-name: dalli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 17:31:14 +00:00
Javi Martín
a4441422f2 Merge pull request #5260 from consuldemocracy/dependabot/bundler/selenium-webdriver-4.13.1
Bump selenium-webdriver from 4.12.0 to 4.13.1
2023-10-03 19:15:27 +02:00
Sebastia
2e335df2f3 Merge pull request #5250 from consuldemocracy/content-block
Add new content block `footer_legal` to Footer
2023-10-03 14:03:50 +02:00
dependabot[bot]
7a587e2c12 Bump selenium-webdriver from 4.12.0 to 4.13.1
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/commits)

---
updated-dependencies:
- dependency-name: selenium-webdriver
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 22:04:37 +00:00
Javi Martín
0e696331b1 Merge pull request #5258 from consuldemocracy/fix_knapsack
Update bash script to run Knapsack Pro
2023-09-29 17:30:23 +02:00