Commit Graph

18723 Commits

Author SHA1 Message Date
dependabot[bot]
68285aae06 Bump rubocop-performance from 1.19.1 to 1.20.2
Note we're removing the Performance/StringIdentifierArgument rule
because now it also replaces methods in interpolation, and we don't
particularly prefer using `send(:"#{method}_name")` over
`send("#{method}_name)`. We actually use the latter about two thirds of
the time.

We'll add this rule again if it ever offers the option to ignore the
cases where interpolation is used, although it's highly doubtful that'll
ever happen because this rule is meant for (insignificant) performance
gains and not for code clarity.

Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.19.1 to 1.20.2.
- [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.1...v1.20.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 02:43:24 +01:00
Javi Martín
897b5fe872 Merge pull request #5434 from consuldemocracy/dependabot/bundler/rspec-rails-6.1.2
Bump rspec-rails from 5.1.2 to 6.1.2
2024-03-23 02:42:57 +01:00
Javi Martín
5b35226ad0 Merge pull request #5308 from consuldemocracy/dependabot/bundler/globalize-6.3.0
Bump globalize from 6.2.1 to 6.3.0
2024-03-23 02:36:51 +01:00
dependabot[bot]
7473c9edf1 Bump rspec-rails from 5.1.2 to 6.1.2
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 5.1.2 to 6.1.2.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v5.1.2...v6.1.2)

---
updated-dependencies:
- dependency-name: rspec-rails
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 01:17:56 +00:00
dependabot[bot]
006816c56e Bump globalize from 6.2.1 to 6.3.0
Bumps [globalize](https://github.com/globalize/globalize) from 6.2.1 to 6.3.0.
- [Changelog](https://github.com/globalize/globalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/globalize/globalize/compare/v6.2.1...v6.3.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 01:17:14 +00:00
Javi Martín
659c834e91 Merge pull request #5296 from consuldemocracy/dependabot/bundler/responders-3.1.1
Bump responders from 3.1.0 to 3.1.1
2024-03-23 02:16:20 +01:00
dependabot[bot]
797e9cb7e8 Bump responders from 3.1.0 to 3.1.1
Bumps [responders](https://github.com/heartcombo/responders) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/heartcombo/responders/releases)
- [Changelog](https://github.com/heartcombo/responders/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heartcombo/responders/compare/v3.1.0...v3.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 00:59:00 +00:00
Javi Martín
aeef760acd Merge pull request #5292 from consuldemocracy/dependabot/bundler/paranoia-2.6.3
Bump paranoia from 2.6.2 to 2.6.3
2024-03-23 01:57:09 +01:00
dependabot[bot]
9f2f63cc69 Bump paranoia from 2.6.2 to 2.6.3
Bumps [paranoia](https://github.com/rubysherpas/paranoia) from 2.6.2 to 2.6.3.
- [Release notes](https://github.com/rubysherpas/paranoia/releases)
- [Changelog](https://github.com/rubysherpas/paranoia/blob/core/CHANGELOG.md)
- [Commits](https://github.com/rubysherpas/paranoia/compare/v2.6.2...v2.6.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 00:39:08 +00:00
Javi Martín
f1043403da Merge pull request #5293 from consuldemocracy/dependabot/bundler/devise-4.9.3
Bump devise from 4.9.2 to 4.9.3
2024-03-23 01:31:49 +01:00
Javi Martín
8d2c2c473e Base Devise initializer on the latest version
We haven't updated this initializer for years, so here's the updated
version. The `expire_auth_token_on_timeout` doesn't seem to exist
anymore, and a few more options have been added.

Note that the default Devise initializer configures
`config.responder.error_status` and `config.responder.redirect_status`
so they follow Hotwire/Turbo conventions. For now, I'm commenting these
lines because we currently don't use Hotwire/Turbo.
2024-03-23 01:12:35 +01:00
dependabot[bot]
965283d81d Bump devise from 4.9.2 to 4.9.3
Bumps [devise](https://github.com/heartcombo/devise) from 4.9.2 to 4.9.3.
- [Release notes](https://github.com/heartcombo/devise/releases)
- [Changelog](https://github.com/heartcombo/devise/blob/main/CHANGELOG.md)
- [Commits](https://github.com/heartcombo/devise/compare/v4.9.2...v4.9.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 01:12:35 +01:00
Javi Martín
8ae6b6daef Merge pull request #5338 from consuldemocracy/dependabot/bundler/spring-4.1.3
Bump spring from 2.1.1 to 4.1.3
2024-03-23 01:12:25 +01:00
Javi Martín
e4e0cb5d47 Don't use spring in the test environment
Spring now (since version 3, I think) requires `config.cache_classes =
false` in order to work. However, that means that tests would be slower
for developers who don't use spring (like me).

I'd personally vote for removing spring completely (Rails removed it as
a default installation option in August 2021 [1]), but for now we're
keeping it for backwards compatibility.

[1] See pull request 42997 in https://github.com/rails/rails
2024-03-23 00:58:49 +01:00
dependabot[bot]
c87f7a7e9a Bump spring from 2.1.1 to 4.1.3
Bumps [spring](https://github.com/rails/spring) from 2.1.1 to 4.1.3.
- [Release notes](https://github.com/rails/spring/releases)
- [Changelog](https://github.com/rails/spring/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rails/spring/compare/v2.1.1...v4.1.3)

---
updated-dependencies:
- dependency-name: spring
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 00:58:48 +01:00
Javi Martín
69b2d767b1 Merge pull request #5424 from consuldemocracy/dependabot/bundler/pg-1.4.6
Bump pg from 1.4.3 to 1.4.6
2024-03-23 00:58:09 +01:00
Javi Martín
a878185a41 Merge pull request #5396 from consuldemocracy/main_section
Add a link to skip to the main content
2024-03-23 00:56:26 +01:00
dependabot[bot]
84097bb002 Bump pg from 1.4.3 to 1.4.6
Bumps [pg](https://github.com/ged/ruby-pg) from 1.4.3 to 1.4.6.
- [Changelog](https://github.com/ged/ruby-pg/blob/master/History.md)
- [Commits](https://github.com/ged/ruby-pg/compare/v1.4.3...v1.4.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-23 00:36:40 +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
e867135a07 Always provide the title before writing anything else
This way our views are more consistent.
2024-03-23 00:35:47 +01:00
Javi Martín
45c1f93562 Add a link to skip to the main content
While people using screen readers already have keyboard shortcuts to
jump to the <main> tag, there are people who navigate the page with the
keyboard using just the tab key, and for them, this link provides a way
to save time and start reading the main content instead of having to
manually go through all the navigation links every time a new page is
loaded.

Note that we had to add an additional `width: 0` rule because
Foundation's `element-invisible` would apply `1px` and the test checking
for `visible: :hidden` would faile.
2024-03-23 00:35:47 +01:00
Javi Martín
2b962f2789 Use a <main> tag on every page
Many pages had this tag, but many other didn't, which made navigation
inconsistent for people using screen readers.

Note that there are slight changes in two pages:

* The homepage now includes the banner and the content of the
  `shared/header` element inside the <main> tag
* The budgets index now includes the banner inside the <main> tag

I see both potential advantages and disadvantages of this approach,
since banners aren't necessarily related to the main content of a page
but on the other hand they aren't the same across pages and people using
screen readers might accidentally skip them if they jump to the <main>
tag.

So I'm choosing the option that is easier to implement.

Note we're adding a `public-content` class to the <main> element in the
application layout. This might be redundat because the element could
already be accessed through the `.public main` selector, but this is
consistent with the `admin-content` class used in the admin section, and
without it the <main> element would sometimes have an empty class
attribute and we'd have to use `if content_for?(:main_class)` or
`tag.main` which IMHO makes the code less consistent.

The Capybara::DSL monkey-patch is only done on the `visit` method
because it's the only reliable one. Other methods like `click_link`
generate AJAX requests, so `expect(page).to have_css "main", count: 1`
might be executed before the AJAX request is finished, meaning it
wouldn't properly test anything.
2024-03-23 00:35:43 +01:00
Javi Martín
9c037a484e Make proposals map test more robust
We were testing what happens when clicking on a geozone without HTML
coordinates, which won't happen in a real browser.

So we're now defining the HTML coordinates and clicking on the area in
the test, which is what real people will do.

We also avoid having two consecutive `visit` calls, which will interfere
with the way we plan to test the presence of the <main> tag after every
`visit`.

Note that, the test didn't work with the HTML coordinates defined in the
`with_html_coordinates` trait, with Capybara showing the following
error:

```
Selenium::WebDriver::Error::ElementClickInterceptedError:
element click intercepted: Element
  <area shape="poly"
  coords="30,139,45,153,77,148,107,165"
  href="/proposals?search=California"
  title="California" alt="California">
is not clickable at point (413, 456).
Other element would receive the click:
  <img usemap="#map" src="/assets/map.jpg">
```

The cause of this error was the strange shape of the polygon, which was
greatly concave and and so the middle of its area wasn't part of it.
We're changing the polygon so it's now convex and when Capybara clicks
on its middle point everything will work as expected.
2024-03-23 00:33:41 +01:00
Javi Martín
f1105140ae Remove duplicate <main> tags in management views
There can only be one <main> tag in a document, and we've already got a
<main> tag in the management layout.
2024-03-23 00:33:41 +01:00
Javi Martín
f0baa080b6 Merge pull request #4955 from consuldemocracy/dependabot/bundler/master/graphql-2.0.13
Bump graphql from 1.12.14 to 1.13.22
2024-03-22 23:14:38 +01:00
dependabot[bot]
8e63bd9d20 Bump graphql from 1.12.14 to 1.13.22
Bumps [graphql](https://github.com/rmosolgo/graphql-ruby) from 1.12.14 to 1.13.22.
- [Release notes](https://github.com/rmosolgo/graphql-ruby/releases)
- [Changelog](https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rmosolgo/graphql-ruby/compare/v1.12.14...v1.13.22)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-22 22:56:42 +01:00
Javi Martín
d0f5a4b80a Merge pull request #5442 from consuldemocracy/code_of_conduct_contact
Update code of conduct contact address
2024-03-22 18:49:54 +01:00
Javi Martín
6c3971871d Update code of conduct contact address 2024-03-22 18:34:47 +01:00
Javi Martín
56a545f86e Merge pull request #5440 from consuldemocracy/remove_link_to_gitter
Remove link to gitter chat
2024-03-22 17:04:24 +01:00
Javi Martín
6bb587c7da Remove link to gitter chat
We're replacing gitter with GitHub Discussions.
2024-03-22 16:39:10 +01:00
Sebastia
9e5344b5d7 Merge pull request #5276 from consuldemocracy/order-cards
Allow sorting homepage cards
2024-03-22 10:56:33 +01:00
Javi Martín
692d509cf5 Merge pull request #5398 from consuldemocracy/readme_badges
Update badges in README files
2024-03-22 03:05:13 +01:00
taitus
bce1474527 Only render position field on table when cards rendered are not headers 2024-03-21 19:00:56 +01:00
coslajohn
529357c980 Merge pull request #5390 Geozone Admin maps
This makes it easier to see if Geojson has been imported correctly.
2024-03-21 18:47:37 +01:00
taitus
4e9d5d8c5a Allow sorting widget_cards on custom pages 2024-03-21 18:27:49 +01:00
taitus
f795c18bec Allow sorting widget_cards on sdg section 2024-03-21 18:27:49 +01:00
taitus
7c85daac3f Allow sorting widget_cards on homepage
Note that we keep :created_at order as complement to new :order field.

We do this so that current installations will not notice any change in the
sorting of their cards when upgrading, as the default "order" field will always
be 1, so it will continue to sort by the "created_at".
2024-03-21 18:27:49 +01:00
taitus
6059aab674 Allow saving a position when create a widget card
We are ensuring that only position field is rendered only on
non-header cards.

Note that we have 3 sections that use widget cards:
- Homepage (cards and header cards)
- Custompages (only have cards)
- Sdg Homepage (cards and header cards)
2024-03-21 18:15:50 +01:00
taitus
9dd10cac19 Add order field to widget cards
We will use this field to enter the position where the cards will be shown to the
user in the homepage.
2024-03-21 18:10:26 +01:00
taitus
e9a7731f49 Do not render "Number of colums" when create a sdg header card
Co-authored-by: Javi Martín <javim@elretirao.net>
2024-03-21 18:08:25 +01:00
Javi Martín
82c24a7ef3 Merge pull request #5428 from consuldemocracy/release_2.1.1
Release version 2.1.1
2024-03-21 15:08:54 +01:00
Javi Martín
e7cc823c87 Reorganize badges in README
So now related badges are together. First paragraph, legal stuff.
Second paragraph, technical tools and status. Third paragraph, links
related to collaboration.
2024-03-21 14:25:01 +01:00
Javi Martín
e32818b3fc Remove Rocket Validator badge
We haven't used this service for at least four and a half years.
2024-03-21 14:24:46 +01:00
Javi Martín
b9e939d375 Release version 2.1.1 2024-03-20 03:38:59 +01:00
Javi Martín
31f42a2c76 Merge pull request #5432 from consuldemocracy/fix_unsafe_spec_warning
Sanitize the output of a dummy component class
2024-03-19 15:24:55 +01:00
Javi Martín
669472c800 Sanitize the output of a dummy component class
After commit 52ec5094f, we started to get a warning when running out
test suite:

```
WARNING: The #<Class:0x00007958c06fb8e0> component rendered HTML-unsafe
output. The output will be automatically escaped, but you may want to
investigate.
```

The reason is that, for security reasons, since version 3.9.0,
ViewComponent no longer renders unsafe output in the `call` method, so
we need to make sure the rendered text is safe. This is similar to what
Rails automatically does in views with `<%= %>`.

While this change doesn't affect the application (this class is only
used in a test), with it we avoid the warning.
2024-03-19 14:54:06 +01:00
Javi Martín
42eff36bdd Merge pull request #5421 from consuldemocracy/rails6.1_rubocop_rules
Add rubocop rules affecting Rails 6.1
2024-03-18 16:29:54 +01:00
Javi Martín
d0fae3377e Add and apply Rails/WhereMissing rubocop rule
So now we know where to use the `where.missing` method which was
introduced in Rails 6.1.

Note this rule didn't detect all cases where the new method can be used.
2024-03-18 16:05:07 +01:00
Javi Martín
86cf674d0c Add Rails/DeprecatedActiveModelErrorsMethods rule
Even though we're already applying this rule since commit 08b12a78f,
it's very useful to have it so we don't accidentally introduce code that
won't work with Rails 7.

After upgrading to Rails 7, this rule will no longer be necessary, since
the code using the deprecated syntax will not work and so we'll notice
it immediately.
2024-03-18 16:05:07 +01:00
Javi Martín
77505db337 Merge pull request #5389 from CoslaDigital/render_geojson
Allow whitespace between square brackets in GeoJSON polygons
2024-03-18 16:03:59 +01:00