Commit Graph

20065 Commits

Author SHA1 Message Date
Javi Martín
89d0dc0541 Merge pull request #5165 from consuldemocracy/custom_translations_in_components
Use custom translations in components
2023-08-09 13:34:43 +02:00
Javi Martín
f77c414e23 Merge pull request #5169 from consuldemocracy/fix_robots
Fix syntax in robots.txt
2023-08-09 13:32:35 +02:00
Javi Martín
1e0224a97a Merge pull request #125 from consuldemocracy/readme_warning
Update README before archiving the repository
2023-08-08 13:45:07 +02:00
Javi Martín
7996925644 Allow current way to write respond_to blocks
Not sure exactly since when, but we've started to get rubocop failures
when using the pattern:

respond_to do |format|
  format.js
end

We've been using this pattern for ages, so maybe a recent version of
Rubocop introduced a change that made it report it.

In any case, this is easier to read than respond_to(&:js), so we're
allowing it.
2023-08-07 21:22:27 +02:00
Javi Martín
1bb8c71832 Fix syntax in robots.txt
We added the `user_id` rule in commit edaf420f5. To be honest, I'm not
sure what we meant, since I haven't found URLs containing the user id.

So we're treating it as if it was a typo and we wanted to do the same
thing we did with other parameters.
2023-08-07 14:42:13 +02:00
Javi Martín
dc3a28675e Use custom translations in components
In the `i18n_translation` initializer, we're overwriting the `t` helper
so calling it uses custom translations if they're available.

However, ViewComponent doesn't use the `t` helper but implements its own
`t` method. So, when calling the `t` method in a component, we weren't
using our implementation of the `t` helper, and so we weren't loading
custom translations.

Using the `t` helper in components solves the issue.

There was a test where we were directly testing a method in a component,
and that method uses the `t` helper. This caused an error when running
the test:

ViewComponent::Base::ViewContextCalledBeforeRenderError:
`#helpers` can't be used during initialization, as it depends on the
view context that only exists once a ViewComponent is passed to the
Rails render pipeline.

Using `render_inline` in the test and testing the generated HTML, as
recommended in the ViewComponent documentation, solves the issue.
2023-08-05 15:28:20 +02:00
Javi Martín
b986dbbbd2 Merge pull request #5162 from consuldemocracy/bump_selenium_webdriver_to_4.11
Bump selenium-webdriver from 4.0.0 to 4.11.0
2023-08-04 15:10:37 +02:00
Javi Martín
5b0fb3213d Bump selenium-webdriver from 4.0.0 to 4.11.0
Webdrivers doesn't seem to be working with GitHub Actions since Chrome
changed the way to download ChromeDriver [1].

Luckily, webdrivers functionality has recently been added directly to
selenium-webdriver, and version 4.11.0 is compatible with the new way to
download ChromeDriver.

So we're updating selenium-webdriver and removing webdrivers.

Note we now have to use the `Options` class instead of the
`Capabilities`. We're updating Capybara since its changelog mentions its
latest version also adapts these changes in Selenium.

[1] https://groups.google.com/g/chromedriver-users/c/qVPTFXnedw0
2023-08-03 00:35:16 +02:00
Javi Martín
0c6cdfd321 Update README before archiving the repository
From now on changes will be done using the GitBook interface, so
changing this repository won't have any effects.

So we're archiving the repository and linking to the documentation site.
2023-07-17 19:08:25 +02:00
Javi Martín
28a9bd55c6 Merge pull request #5033 from consuldemocracy/release_2.0.0
Release version 2.0.0
2023-07-17 13:49:36 +02:00
Javi Martín
e2f31b7af7 Merge pull request #5126 from consuldemocracy/i18n_crowdin
Update translations from Crowdin
2023-07-17 13:47:40 +02:00
Senén Rodero Rodríguez
7afd921814 Enable Nepali language by default 2023-07-17 11:45:20 +02:00
Consul Bot
82f5d690c3 Update translations from Crowdin 2023-07-17 11:45:20 +02:00
Javi Martín
b37a5e073c Merge pull request #124 from consuldemocracy/name_change
Update project name
2023-07-16 23:08:33 +02:00
Javi Martín
a5d994533c Release version 2.0.0 2023-07-13 17:52:01 +02:00
Javi Martín
d137df67bf Fix release version number in rake tasks
When we added the tasks, we thought the new version was going to be
version 1.6.0, but in the end we're renaming it to version 2.0.0.
2023-07-13 17:48:26 +02:00
Senén Rodero
c4cf7473ae Merge pull request #5150 from consuldemocracy/typos
Fix source string typo
2023-07-13 14:30:56 +02:00
Senén Rodero Rodríguez
53046a5e0f Fix English typos 2023-07-13 12:05:29 +02:00
Javi Martín
2638aba756 Link to our repository instead of Madrid's 2023-07-12 19:31:03 +02:00
Javi Martín
3a72776ecc Merge pull request #5149 from consuldemocracy/name_change
Update project name
2023-07-12 18:57:50 +02:00
Javi Martín
175c1a752b Remove old comment referencing the project name
It was obvious which project the comment was about. Also, no point
having a TODO referencing what to do after upgrading to Rails 5.1, since
we did it years ago.
2023-07-12 16:05:33 +02:00
decabeza
0a47a00e13 Change the logo to include the new name
Co-Authored-By: Javi Martín <javim@elretirao.net>
2023-07-12 16:05:33 +02:00
Javi Martín
7dfbf772e2 Use the new name in default settings 2023-07-12 16:05:33 +02:00
Javi Martín
3d9a23bd1b Use the new name in code comments 2023-07-12 16:05:33 +02:00
Javi Martín
054aef3854 Change URLs to use the new domain 2023-07-12 16:05:33 +02:00
Javi Martín
629756dd15 Change URLs referencing our GitHub repositories 2023-07-12 16:05:26 +02:00
Javi Martín
b4af3392cd Update URLs for other Consul Democracy projects 2023-07-12 16:03:17 +02:00
Javi Martín
10e2a9713f Update references to GitHub repositories 2023-07-12 16:03:17 +02:00
Javi Martín
13c641eedc Update application name
Note that, in order to have some consistency, we're always writing
"Consul Democracy", instead of using capital letters sometimes (but not
always), like we did until now.
2023-07-12 15:36:49 +02:00
Javi Martín
68d0ffe5ec Copy the README from the CONSUL DEMOCRACY repo
We took it from there years ago, but we haven't kept it up to date.
2023-07-12 15:33:14 +02:00
Javi Martín
832a6dd8b9 Fix URL to our kanban project
We were referencing an old URL that has been obsolete for years.
2023-07-10 19:28:11 +02:00
Javi Martín
69fd75d25e Use the logo with the new name 2023-07-10 19:19:27 +02:00
Javi Martín
ce7b37f6f8 Change name in English and Spanish texts 2023-07-07 15:07:46 +02:00
Javi Martín
2766d8f152 Merge pull request #5144 from consul/fix_invert_selection
Fix text selection in budget header
2023-07-03 17:29:08 +02:00
Javi Martín
29a3fe4ad5 Merge pull request #5142 from consul/local_logs
Reduce log size in development/test environments
2023-07-03 17:27:40 +02:00
Javi Martín
e0a94f6a6e Reduce log size in development/test environments
Code based on the logger Rails uses by default; as mentioned in the
Rails configuration guide:

> [the logger] defaults to an instance of ActiveSupport::TaggedLogging
> that wraps an instance of ActiveSupport::Logger which outputs a log to
> the log/ directory. You can supply a custom logger, to get full
> compatibility you must follow these guidelines:
>
> * To support a formatter, you must manually assign a formatter from
>   the config.log_formatter value to the logger.
> * To support tagged logs, the log instance must be wrapped with
>   ActiveSupport::TaggedLogging.
> * To support silencing, the logger must include
>   ActiveSupport::LoggerSilence module. The ActiveSupport::Logger class
>   already includes these modules.

Just like the documentation mentions, we're enabling log rotation using
"1" as the number of old files to keep and then the maximum size of the
log file.
2023-07-03 16:16:10 +02:00
Javi Martín
db4db07853 Merge pull request #5146 from consul/delayed_job_monitor
Restart DelayedJob workers after they crash
2023-06-30 17:23:13 +02:00
Senén Rodero
37417e5829 Merge pull request #5129 from consul/geozones
Do not show geozones when there are no geozones defined
2023-06-30 17:21:20 +02:00
Javi Martín
286a128a71 Merge pull request #5106 from consul/fix_budget_background_image
Render background images with brackets in their names
2023-06-30 17:20:56 +02:00
Javi Martín
865fe706b4 Merge pull request #5145 from consul/map_wheel_on_focus
Enable mousewheel when focusing on the map
2023-06-30 11:52:20 +02:00
Javi Martín
a668ecd1a8 Merge pull request #5136 from Meet-Democracy/Legislation-draft-render-markdown-tables
Render markdown tables in legislation draft
2023-06-30 00:09:33 +02:00
Javi Martín
af618eaa45 Extract markdown helper logic to a class
This way it'll be easier for other Consul installations to overwrite
parts of the code, like the default options.
2023-06-29 20:48:01 +02:00
Javi Martín
79120209da Use the same extensions in all markdown renderers
We were using two different sets of extensions but, since the markdown
code is always written by administrators, IMHO it makes sense to be
consistent and always render markdown code the same way.
2023-06-29 20:48:01 +02:00
Karim Semmoud
3faaa8521d Render markdown tables in legislation draft
* Add Tables option to Redcarpet in Legislation draft

* Allow table tags in Admin Legislation Sanitizer

* Add Test to render markdown tables in Legislation drafts

* Add Test for Admin Legislation Sanitizer

We include test for image, table and h1 to h6 tags and additional tests to strengthen the allowed and disallowed parameters

* Add Table from markdown test in System and Factories

* Add test to render  tables for admin user

* Remove comment line about Redcarpet options

* Edit custom css for legislation draft table to make it responsive
2023-06-29 20:48:01 +02:00
Senén Rodero
b4f2e66c78 Merge pull request #5147 from consul/bump_capybara-webmock
Bump selenium-webdriver from 3.142 to 4.0.0
2023-06-29 18:37:57 +02:00
Senén Rodero Rodríguez
41a84d6625 Bump selenium-webdriver from 3.142 to 4.0.0
And also `capybara-webmock' to the latest as the previous
one is not supported by selenium-webdriver.

The change in the rails_helper.rb file fixes a deprecation warning
related to desired capabilities after this upgrade.
2023-06-29 17:29:21 +02:00
Javi Martín
68927409b6 Fix text selection in budget heading
The `inverted-selection` rules defined in the `%brand-background`
selector weren't being applied because we were using this selector in
`::before` and `::after` pseudoelements. Not sure about the reason, but
it looks like the saturation of `::after::selection` pseudoelements
resulted in invalid selectors and so the inverted selection rules were
ignored for every selection using `%brand-background`, like
`%budget-header`.

Using `@include brand-background` instead of `@extend %brand-background`
in pseudoelements solves the issue. The inverted selection might not
work in these pseudoelements, but we don't need it there since these
pseudoelements don't have content.
2023-06-29 15:54:29 +02:00
Javi Martín
970a64e276 Enable mousewheel when focusing on the map
Zooming with the mousewheel is useful when you want to use it, but
annoying when you don't want to.

Here we're taking an intermediary approach: by default, the mousewheel
isn't active, but it will be active after focusing on the map, so it can
be used both to scroll and to zoom.

This behavior presents usability issues, though, since we aren't making
users aware of the way the mousewheel works, and even if they were
aware, it could be confusing anyway. However, I currently think it's
better than always enabling or always disabling the mousewheel (might
change my mind, though).

Note that the "focus" event is only used on the map, so if we click on a
marker or navigate to a marker with the keyboard without focusing on the
map first, the mousewheel isn't enabled. The same would happen if we
used the "click" event.

We might use the Leaflet.GestureHandling plugin in the future to deal
with this issue and the scroll on touch screens.
2023-06-29 15:54:07 +02:00
Javi Martín
ee9cd881e0 Restart DelayedJob workers after they crash
DelayedJob offers the `--monitor` (aliased as `-m`) option to create a
process that monitors the workers and restarts them when they crash.

This change implies that, in order to stop the delayed job workers, we
now need to pass the `-n` option when running `bin/delayed_job stop`:
`RAILS_ENV=production bin/delayed_job -n 2 stop`.
2023-06-29 15:50:19 +02:00
Senén Rodero
59d260c891 Merge pull request #5143 from consul/bump_parser
Bump parser from 3.1.0.3 to 3.2.2.3
2023-06-29 13:37:36 +02:00