Commit Graph

9506 Commits

Author SHA1 Message Date
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
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
Sebastia
9e5344b5d7 Merge pull request #5276 from consuldemocracy/order-cards
Allow sorting homepage cards
2024-03-22 10:56:33 +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
b9e939d375 Release version 2.1.1 2024-03-20 03:38:59 +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
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
Javi Martín
1a22db8b17 Fix link to debates help
This link used to open in a new window, and we accidentally changed that
behavior while refactoring it in commit c2710de5f.

Since we're adding a test for this case, and the Proposals::NewComponent
class is similar, we're adding a test for that class too. In the case of
proposals, we need to sign in a user because the proposals form contains
fields to attach image, that currently rely on a user being signed in.
2024-03-18 15:29:46 +01:00
Javi Martín
bbac39e976 Merge pull request #5426 from consuldemocracy/fix_comment_votes_html
Fix invalid HTML in comment votes
2024-03-18 15:02:25 +01:00
CoslaJohn
8b3ec8fc79 Applied patch to tidy whitespace and add tests 2024-03-07 12:08:17 +00:00
Javi Martín
a101608ebe Fix invalid HTML in comment votes
We forgot to change the `span` tag when we replaced links with buttons
in commit ba0d21b46.
2024-03-05 00:41:53 +01:00
Javi Martín
1d955b7a20 Simplify using helper methods in components
The `use_helpers` method was added in ViewComponent 3.8.0, and it's
included by default in all components since version 3.11.0.

Note we sometimes delegated the `can?` method to the controller instead
of the helpers, for no particularly reason. We're unifying that code as
well.
2024-03-02 17:34:25 +01:00
Javi Martín
49e76a1427 Release version 2.1.0 2024-02-20 18:28:56 +01:00
CoslaJohn
81d768f1c0 Refactor regex in normalized_coordinates method to allow for whitespace between square brackets 2024-02-09 14:36:02 +00:00
Senén Rodero Rodríguez
3e9f2b8319 Load markers cluster layer by chunks
In order to avoid locking the browser for a long time.
when there are a lot of markers in the map:

https://github.com/Leaflet/Leaflet.markercluster#handling-lots-of-markers
2024-01-29 17:56:54 +01:00
Pierre Mesure
e5a6a5bf1d Adding clustering 2024-01-29 17:56:54 +01:00
Senén Rodero Rodríguez
ef14636b6c Sort variables alphabetically 2024-01-29 17:56:54 +01:00
Senén Rodero Rodríguez
0186484fac Use leaflet npm version instead of the gem 2024-01-29 17:56:54 +01:00
Senén Rodero Rodríguez
0643606dcd Add new setting to enable/disable map marker clustering 2024-01-29 17:56:54 +01:00
Senén Rodero Rodríguez
ea0cedec72 [EXP] Make AJAX settings work when javascript is disabled
Otherwise we get a AuthenticityToken exception.

I was nor able to write a test to verify this change.
2024-01-25 18:29:39 +01:00
Senén Rodero Rodríguez
6c4f917e2a [EXP] Show all admin settings tabs when javascript is disabled
Otherwise administrators cannot access the settings from other tabs.
2024-01-25 18:29:39 +01:00
Senén Rodero Rodríguez
047cb2b76c Extract SDG configuration tab partial to a component 2024-01-25 18:29:39 +01:00
Senén Rodero Rodríguez
f32d7edcf3 Extract proposals dashboard tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
75180de8e6 Extract images and documents tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
f56dc654f3 Extract map configuration tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
6876f080a2 Extract features tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
726019616f Extract configuration settings tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
347a9d3d5b Extract remote census configuration tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
684a830515 Extract participation processes tab partial to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
f8835debae Move logic from key definition to views
Before this change, two important things depend on the format of each key,
where to render it in the administration panel and which kind of interface
to use for each setting. Following this strategy led us to a very complex
code, very difficult to maintain or modify. So, we do not want to depend
on the setting key structure anymore to decide how or where to render each
setting.

With this commit, we get rid of the key format-based rules. Now we render
each setting explicitly passing to it the type and the tab where it belongs.
2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
91c3bde36b Fix map settings redirection 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
cb91a7421d Fix upload settings redirection 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
1fb351425f Use a plain tab param
Instead of using a setting nested param `setting[:tab]`. We only need
the tab param when rendering settings in the administration section.

This change will make it easier rendering the correct tab after
updating settings.
2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
6a64f38d17 Use admin table settings component to render featured settings
Now, with the same template we can render all kind of settings.
2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
e7223ba865 Extract interactive map form to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
65c6189183 Extract setting text form to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
c9e3b8903d Extract setting content types form to a component 2024-01-25 18:29:38 +01:00
Senén Rodero Rodríguez
57c257e91c Extract settings table partial to a component 2024-01-25 18:29:38 +01:00
Sebastia
be8f8e3bd8 Merge pull request #5148 from consuldemocracy/polls_order
Order expired polls by ends date
2024-01-25 15:34:29 +01:00
Senén Rodero
fe6ae18a09 Merge pull request #5348 from consuldemocracy/rename_storage_folder
Rename tenant's storage folder when modifying the schema
2024-01-19 17:16:43 +01:00
Senén Rodero Rodríguez
b3012caac7 Rename tenant's storage folder when modifying the schema 2024-01-19 13:39:56 +01:00
decabeza
bfb02093a6 Order expired polls by ends date 2023-12-11 15:38:55 +01:00