Commit Graph

20217 Commits

Author SHA1 Message Date
Javi Martín
5e8a61adee Merge pull request #5891 from consuldemocracy/invalid_html_in_dev_settings
Fix invalid HTML caused by the dev seeds
2025-03-07 12:52:54 +01:00
Javi Martín
720a717a51 Merge pull request #5906 from consuldemocracy/dependabot/bundler/launchy-3.1.1
Bump launchy from 3.1.0 to 3.1.1
2025-03-07 00:04:30 +01:00
dependabot[bot]
50f57c2376 Bump launchy from 3.1.0 to 3.1.1
Bumps [launchy](https://github.com/copiousfreetime/launchy) from 3.1.0 to 3.1.1.
- [Changelog](https://github.com/copiousfreetime/launchy/blob/main/HISTORY.md)
- [Commits](https://github.com/copiousfreetime/launchy/compare/v3.1.0...v3.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 22:13:31 +00:00
Javi Martín
0436d75272 Merge pull request #5807 from consuldemocracy/dependabot/bundler/recipient_interceptor-0.3.3
Bump recipient_interceptor from 0.3.2 to 0.3.3
2025-03-06 19:23:47 +01:00
dependabot[bot]
74e543e2c8 Bump recipient_interceptor from 0.3.2 to 0.3.3
Bumps [recipient_interceptor](https://github.com/croaky/recipient_interceptor) from 0.3.2 to 0.3.3.
- [Release notes](https://github.com/croaky/recipient_interceptor/releases)
- [Commits](https://github.com/croaky/recipient_interceptor/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 18:05:54 +00:00
Javi Martín
11816f833d Use a flex layout to render participation processes lists
This way we simplify the HTML, which had some `if...else` blocks that
were hard to follow because there were opening tags inside these blocks
while the closing tags were outside these blocks.

We're also making the CSS container-dependent instead of
window-dependent. Since there are between one and three elements inside
the panel, we accomplish this by making the element with the content
take its own line if the width of the panel is smaller than 35rem.

Note we're trying to keep the layout similar to what it was; since we're
no longer using negative margins (like the ones in the `.row` selector),
the votes element now gets a width of 22.5% instead of 25%.

Also note we're using the column-gap property for flexbox because the
`flex-with-gap` mixin doesn't work so well with elements that have
borders. Since the column-gap property for flexbox is now supperted by
more than 98% of the browsers (which wasn't the case when we started
using the `flex-with-gap` mixin), the `flex-with-gap` mixin has become
obsolete.

Finally, note we're removing the `max-width: 12rem` rule in the images.
I'm not sure why we introduced this rule in the first place, and it
didn't play so well to the new layout. I considered using code like
`max-width: min(100%, 12rem)`, but, since I'm not sure why `12rem` was
there in the first place, I'm not sure whether this approach was better,
and it sure made things more complex.
2025-03-06 18:49:39 +01:00
Javi Martín
6b81799cf9 Remove redundant CSS rule
The exact same rule was already present in the block preceding it.
2025-03-06 18:27:29 +01:00
Javi Martín
b7c07e804e Remove border in proposals and debates supports
This way, it's consistent with the investments list, where we don't use
a border in the elements used for supporting or voting investments.
2025-03-06 18:26:33 +01:00
Javi Martín
1ae4caa0ef Only render successful icon on successful proposals
Not doing so made it trickier to define a flex layout, since the
icon-successful element is given a `position: absolute`, but only for
successful proposals, while for unsuccessful proposals it was taking
the standard `position: static` value.

We're also reusing the `successful?` method instead of rewriting it in
the view, and fixing a small issue where the icon wasn't displayed for
proposals having the exact needed votes (we were using `>` instead of
`>=` in the condition).

Note that legislation proposals use the method
`Proposal.votes_needed_for_success`, which is probaby a mistake caused
by copying the code from the proposal view. Fixing this issue is out of
the scope of this commit (and pull request), though.
2025-03-06 18:25:45 +01:00
Javi Martín
717d1cd2fc Use a one-line if condition in proposals index
With the multiline condition, HTML Beautifier (which we're about to
introduce in order to manage ERB indentation) gets confused. In this
context, a one-line condition is also more readable.
2025-03-06 18:25:45 +01:00
Javi Martín
53ff81dfdf Unify code applying the colors of a process
We had some duplication because the `css_for_process_header` was using
an instance variable, and so it couldn't be called from a partial where
this instance variable wasn't available.

Using a local variable and passing it as a parameter (as we should
always do) solves the issue and lets us simplify the code.
2025-03-06 18:25:45 +01:00
Javi Martín
a1352de9eb Remove duplicate external URL
The external URL is already rendered in the `investment_detail` partial,
so we were rendering it twice in the valuation area.
2025-03-06 18:25:45 +01:00
Javi Martín
064a7490c6 Remove empty and unused file
This file was added in commit 826385f65, but it was never used.
2025-03-06 18:25:45 +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
65e3d4b6cf Fix invalid HTML caused by the dev seeds
These settings are used in links, and were generating invalid `href`
attributes that contained spaces.
2025-03-06 18:24:57 +01:00
Javi Martín
4be2336308 Merge pull request #5890 from consuldemocracy/remove_obsolete_initializers
Remove initializers no longer in Rails
2025-03-06 18:21:04 +01:00
Javi Martín
b04d36bf5d Merge pull request #5908 from consuldemocracy/upgrading_docs
Update instructions to upgrade Consul Democracy
2025-03-06 18:20:36 +01:00
Javi Martín
10a86fd5a4 Update instructions to upgrade Consul Democracy
We now strongly recommend to upgrade one version at a time and to run
the tests before and after upgrading.

Note we use a `release` branch instead of an `upgrade` branch because
we've been mentioning the `release` branch in the release notes of every
release for years.
2025-03-06 17:22:47 +01:00
Javi Martín
d8c866c5e6 Remove initializers no longer in Rails
These initializers either don't contain any code at all or contain code
that we never use. Since this was the case in most Rails applications,
they're no longer generated in new Rails applications [1].

So we're removing them as well.

[1] See pull requests 42538 and 43237 in https://github.com/rails/rails
2025-03-06 12:11:51 +01:00
Javi Martín
f1f3724365 Merge pull request #5888 from consuldemocracy/remove_bin_update_script
Remove obsolete bin/update script
2025-03-06 11:32:23 +01:00
Javi Martín
21c28bdb81 Merge pull request #5912 from consuldemocracy/dependabot/bundler/uri-1.0.3
Bump uri from 1.0.2 to 1.0.3
2025-03-05 20:05:57 +01:00
dependabot[bot]
d5fdbb9c24 Bump uri from 1.0.2 to 1.0.3
Bumps [uri](https://github.com/ruby/uri) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: uri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 18:38:54 +00:00
Sebastia
6cd10cd550 Merge pull request #5844 from consuldemocracy/remove-unused-css
Remove unused CSS
2025-03-05 16:48:05 +00:00
taitus
e094dc17d6 Remove unused CSS
* The `gender-and-channel` class isn't use since commit e3063cd24f
* The `first-comment` class added in commit e5fb90f954 was never used
* The `additional-info` class added in commit d47ce39b37 was never used
* The `title-quote` class isn't use since commit f317514258
* The `big-number` class added in commit aa1ed87725 was never used
* The `big-number-stat` class isn't used since commit cf32dcd6d5
* The `budget-investment-amount` and `budget-investment-description`
classes added in commit 4ade8325d7 were never used
* The `debate-quiz` class isn't use since commit d679c1eb79
* The `enquiries-list` class isn't use since commit 6aa96c4471
* The `investment-project-content` class isn't use since commit d0b8fef6b3
* The `leave-comment` class isn't use since commit ff6285d114
* The `poll-question-show` class isn't use since commit 8277e3cc2b
* The `questions-callout` class isn't use since commit ddf8d5f811
* The `budget-investments-inner` class isn't used since commit c6a9ffc19
* The `map-attributtion` class isn't use since commit 5a09b79da4
* The `postfix` class isn't use since commit 3752f3a53b
* The `translation-locale` added in commit a6e8fecc16 was never used
* The `changes-link`, `comment-advice`, `show-comments` and `comment-votes-number`
classes aren't use since commit d679c1eb79
2025-03-05 17:24:53 +01:00
Javi Martín
0e2d008d9e Remove obsolete bin/update script
This script was removed from Rails in Rails 6.0 [1] because the
`bin/setup` script is now idempotent and can be used to update the
application as well.

[1] See https://github.com/rails/rails/commit/8927eba83c
2025-03-05 16:47:31 +01:00
Sebastia
d84044cd73 Merge pull request #5886 from consuldemocracy/forks_list
Add list of open source forks and modifications
2025-03-05 15:30:27 +00:00
Javi Martín
2300f861b8 Merge pull request #5901 from consuldemocracy/downgrade_sass_to_1.77.5
Downgrade Sass to version 1.77.5
2025-03-05 16:13:29 +01:00
Javi Martín
dc05ff0fd6 Downgrade Sass to version 1.77.5
In commit 64bcedc8b, we upgraded Sass from version 1.70 to version 1.80.
However, since then we've noticed a couple of inconvenient things.

First, we're getting some deprecation warnings when compiling the
assets, related to a usage of `map-has-key` in Foundation which is
deprecated since Sass 1.80. Even with the `quiet_deps` flag, these
warnings aren't silenced.

Second, version 1.79 changed the way color functions work [1]. In
particular, functions like `color.adjust` or `darken` would now generate
RGB colors that include float numbers [2]. Browser support for float values
in RGB colors is about 98% at the time of writing [3], meaning some
browsers that are at least 5 or 6 years old will not render these
colors, sometimes resulting in white text over a white background, which
is of course impossible to read.

Finally, we get some deprecation warnings in our code when we remove the
`quiet_deps` flag, caused by the breaking change in mixed declaration
[4] from version 1.77.7 [5]. This warning is tricky; consider the following
code:

```
@mixin normal-selection {
  &::selection,
  *::selection {
    @include background-with-text-contrast($brand, brand, $check-invert-selection: false);
  }
}

.button.hollow {
  @include normal-selection;
  border: 1px solid;
}
```

In this scenario, since normal-selection is a mixin that generates a
nested rule, we're doing a declaration after a nested rule, which is now
deprecated.

The situation gets even more complicated when we define mixins that have
both nested rules and rules that apply to the element itself. Currently,
we sometimes include a mixin and then override some of the properties
the mixin defines, but we wouldn't be able to do so if we can't define
properties after including the mixin.

Right now, the solution seems to be adding `& { }` selectors
after including a mixin, like this:

```
.button.hollow {
  @include normal-selection;

  & {
    border: 1px solid;
  }
}
```

Which is incredibly cumbersome.

So, for now, we're downgrading to version 1.77.5 (we would downgrade to
version 1.77.6, but the sass-embedded gem skipped that version). That
version was released in June 2024, so it isn't very old yet. In the
future, we'll see what to do about the issues mentioned above, since
we'll have to upgrade at some point.

Note we're removing the `silence_deprecations` flag because Sass 1.77
doesn't raise warnings about using `import`.

[1] https://sass-lang.com/documentation/breaking-changes/color-functions/
[2] https://sass-lang.com/documentation/modules/color/#adjust
[3] https://caniuse.com/mdn-css_types_color_rgb_float_values
[4] https://sass-lang.com/documentation/breaking-changes/mixed-decls/
[5] https://sass-lang.com/documentation/js-api/interfaces/deprecations/#mixed_decls
2025-03-05 15:40:03 +01:00
Javi Martín
4dbc20f799 Merge pull request #5910 from consuldemocracy/dependabot/bundler/rspec-rails-7.1.1
Bump rspec-rails from 7.0.1 to 7.1.1
2025-03-05 15:39:10 +01:00
Javi Martín
1905d42578 Merge pull request #5900 from consuldemocracy/sass_calc_warnings
Fix Sass warnings in divisions without calc()
2025-03-05 15:31:26 +01:00
dependabot[bot]
3035855f4e Bump rspec-rails from 7.0.1 to 7.1.1
Note we aren't updating concurrent-ruby (which Dependabot would have
updated) due to an incompatibility with Rails 7.0.

Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 7.0.1 to 7.1.1.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v7.0.1...v7.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 15:23:35 +01:00
Javi Martín
3334362c55 Merge pull request #5911 from consuldemocracy/dependabot/bundler/rack-2.2.12
Bump rack from 2.2.11 to 2.2.12
2025-03-05 15:23:06 +01:00
Javi Martín
f9d8191ba7 Merge pull request #5899 from consuldemocracy/missing_es_translation
Fix missing Spanish translation
2025-03-05 15:04:41 +01:00
Javi Martín
f460d3bc31 Add and apply function-calculation-no-interpolation rule
This stylelint-scss rule is useful because we were inconsistent when
using calc(); sometimes we added interpolation to Sass variables, and
sometimes we didn't. The reason why we originally added interpolation
was that it was necessary until we migrated to Dart Sass in commit
d54971e53. Since then, we can omit the interpolation, which is also what
the Sass documentation recommends [1].

[1] https://sass-lang.com/documentation/values/calculations/
2025-03-05 14:39:16 +01:00
Javi Martín
a60926c44b Fix wrong icon position in form header
We made a mistake when adding the `calc()` function in commit 6df813fdb,
since the `/` operator originally only affected the `$heading-icon-size`
part of the operation, but affected the whole operation after that
commit. This caused the icon to be positioned on top of another icon.
2025-03-05 14:34:40 +01:00
Javi Martín
cddce21f7b Simplify calc rules with rem-calc inside
The interpolation of the rem-calc function made the code harder to read.
Besides, for new code we've already agreed upon using rem units instead
of `rem-calc`.

For instance, we had the following code:

```
width: calc(100% - #{2 * rem-calc(10)});
```

Now, `2 * rem-calc(10)` is the same as `rem-calc(20)`, but we were using
`2 *` to make it clear that this value was related to the value of the
`margin-left` property, which was `rem-calc(10)`.

IMHO using `0.625rem` for the margin and `2 * 0.625rem` for the width
the code is easier to read because there are no interpolation and no
complex operations involved.
2025-03-05 14:34:40 +01:00
Javi Martín
f3fe1ac6c1 Fix Sass warnings in divisions without calc()
We forgot to add the `calc()` function in commits 4c0b6455f, 390c749d2
and dc54fda71.

We were getting a warning when compiling the assets without the
`quiet_deps` option:

```
DEPRECATION WARNING: Using / for division outside of calc() is
deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($line-height, 3) or calc($line-height / 3)

More info and automated migrator: https://sass-lang.com/d/slash-div
```
2025-03-05 14:34:40 +01:00
dependabot[bot]
3b952f4b21 Bump rack from 2.2.11 to 2.2.12
Bumps [rack](https://github.com/rack/rack) from 2.2.11 to 2.2.12.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.11...v2.2.12)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 11:46:48 +00:00
Sebastia
f188b64e91 Merge pull request #5880 from consuldemocracy/dependabot/bundler/rubocop-1.71.2
Bump rubocop from 1.66.1 to 1.71.2
2025-03-05 11:45:50 +00:00
taitus
202ba3a5f8 Enable new rule from RuboCop 1.71 2025-03-05 11:43:46 +01:00
taitus
ba22d7fdf7 Enable new rules from RuboCop 1.70 2025-03-05 11:43:46 +01:00
taitus
f4ffee3700 Add and apply Lint/RedundantSafeNavigation RuboCop rule
We've tested the updated behavior in RuboCop 1.69, found a new offense, and corrected it.
2025-03-05 11:43:44 +01:00
taitus
4c7fe8a5d9 Enable new rules from RuboCop 1.69 2025-03-05 11:42:47 +01:00
taitus
9081174dd7 Add and apply Style/KeywordArgumentsMerging rubocop rule
This rule was introduced in RuboCop 1.68 to encourage passing
additional keyword arguments directly instead of using merge.
2025-03-05 11:42:47 +01:00
taitus
ada35f51f2 Remove unnecessary EnforcedShorthandSyntax definition
Rubocop 1.67.0 sets EnforcedShorthandSyntax to "either" by default,
so explicitly defining it is no longer necessary.
2025-03-05 11:42:47 +01:00
dependabot[bot]
204704da06 Bump rubocop from 1.66.1 to 1.71.2
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.66.1 to 1.71.2.
- [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.66.1...v1.71.2)

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

Signed-off-by: dependabot[bot] <support@github.com>

Note:
Fix SafeNavigation offense detected by RuboCop 1.67.0
Remove redundant condition that became unnecessary
after updating RuboCop.
2025-03-05 11:42:44 +01:00
Javi Martín
aeb3655541 Merge pull request #5851 from consuldemocracy/dependabot/bundler/rubocop-rspec-3.4.0
Bump rubocop-rspec from 3.1.0 to 3.4.0
2025-03-04 18:03:20 +01:00
dependabot[bot]
203b659de8 Bump rubocop-rspec from 3.1.0 to 3.4.0
Note we're renaming the RSpec/StringAsInstanceDoubleConstant rule to
RSpec/VerifiedDoubleReference because its name changed in version 3.4.0

Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 3.1.0 to 3.4.0.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v3.1.0...v3.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-04 17:38:40 +01:00
Javi Martín
e438ec03c0 Merge pull request #5898 from consuldemocracy/fix_pronto_stylelint
Use pronto.yml to configure pronto-stylelint
2025-03-04 17:37:24 +01:00
Javi Martín
2a9321d988 Merge pull request #5852 from consuldemocracy/dependabot/bundler/rubocop-rails-2.29.1
Bump rubocop-rails from 2.26.2 to 2.29.1
2025-03-02 15:38:02 +01:00