Commit Graph

15767 Commits

Author SHA1 Message Date
taitus
adc66cb28e Improve icons size on goals index
We're also using a percentage to separate the icons, since using the
viewport width causes strange result on screens where the element
max-width (which is based in rem) is much smaller than the size of the
window.
2021-01-29 18:14:50 +01:00
taitus
d61d648dda Render all icons on one line in forms
Show all icons of the RelatedListSelector component on one line in the
forms.
2021-01-29 18:14:50 +01:00
Javi Martín
0b84c0da01 Improve margin rules in SDG icons
We were using the classic approach of adding a margin-right property to
all elements except the last one. This works great when all icons are
displayed in one row.

However, when they're displayed in several rows, there could be a
scenario where the last row has more elements:

element1 <margin> element2 <margin>
element3 <margin> element4 <margin> element5

In the example above, `element3` does not fit in the first row because
it's got a margin to its right. However, `element5` fits in the second
row because the last element has now right margin.

One option to fix this issue it using CSS `gap` property. However, at
the time of writing, it's only supported by 70% of the browsers.

So we're emulating the gap by giving a negative margin to the list
equivalent to the margin of the first element.

This idea is based on:

https://coryrylan.com/blog/css-gap-space-with-flexbox

The exception is the index page. Here the list of icons is centered with
`margin: auto`, and so we cannot use negative margins. We're using the
classic approach instead, which is fine because we define there are 6
icons per row.
2021-01-29 18:14:50 +01:00
taitus
2215209ae4 Standardize icon size
These icons share page with the social media icons (eg: ssb-twitter)
in both the index and the show pages
We believe we gain consistency if all the icons that appear are the
same size.

Pull request 4101 will use this width in social media icons as well.
2021-01-29 18:14:50 +01:00
Javi Martín
d774742bf5 Move sdg-colors to the right settings section
We were adding it under the Foundation overrides section, but this
variable has nothing to do with Foundation.
2021-01-29 18:14:50 +01:00
Javi Martín
8785621a56 Merge pull request #4331 from consul/sdg_view_targets
Add targets to SDG view
2021-01-29 14:37:24 +01:00
taitus
1d151b7b6f Add empty message when there are not local targets 2021-01-29 14:15:58 +01:00
taitus
f45bbb316c Add Targets component to Show component 2021-01-29 14:15:58 +01:00
taitus
857a6aa228 Add targets component to render all targets in tabs section 2021-01-29 14:15:58 +01:00
Javi Martín
5044c424b6 Merge pull request #4334 from consul/sdg_show_section_header
New header section on SDG Goals Index
2021-01-29 14:14:44 +01:00
Javi Martín
e440cd498f Merge pull request #4337 from consul/sdg_dynamic_filter
Make target filter change when goal filter changes
2021-01-29 13:02:11 +01:00
taitus
7a02ce9c08 Add sdg section header on SDG IndexComponent
Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-28 20:02:46 +01:00
Javi Martín
e0b6b83b11 Use <main> in SDG index
Just like we do in the other sections.

We're also moving the banner inside the <main> element because we do it
the same way in other sections.
2021-01-28 19:49:31 +01:00
Javi Martín
08c410cc93 Make target filter change when goal filter changes
Note we're using both the `hidden` and `disabled` properties to
guarantee compatibility with user agents which might still display the
option even when using the `hidden` attribute or hiding it with
`display: none`. We could also use `hide()` and `show()` instead of the
`hidden` property, but since we're using the `disabled` property, I
thought the code would be easier to read if we used properties in both
cases.

Also note users will no longer be able to get, let's say, debates which
are related to goal 1 and target 2.1. We think this use case is highly
unlikely and there's no need to take it into account.
2021-01-28 18:54:04 +01:00
Javi Martín
0aa0a9c16b Add missing test to search by SDG
We had only added a test to seach by target.
2021-01-28 18:46:46 +01:00
Javi Martín
a6714be6b8 Group advanced search tests together
We were doing the same tests three times to test the advanced search
feature. I'm grouping them in one place and shuffling the sections
around to remove duplication and make the test suite faster.
2021-01-28 13:42:44 +01:00
Javi Martín
5f3279b9db Extract search form component in SDG Management
We're going to add some JavaScript which affect this component, and IMHO
it will be easier to know the JavaScript affects this form if both have
their own separate file.
2021-01-28 13:41:23 +01:00
Javi Martín
3018de2847 Merge pull request #4324 from consul/sdg_target_filter
Add SDG target tags and filter
2021-01-27 16:48:12 +01:00
Javi Martín
fbcc7f0332 Merge pull request #4330 from consul/sdg_descriptions
Add descriptions to SDG view
2021-01-27 16:23:49 +01:00
Javi Martín
fa14a267a6 Render related SDGs before tags
When a proposal had geozones, it was a bit strange to have a list of
tags, then a list of SDGs, and then another list of tags. So we're
changing the order a bit.
2021-01-27 16:21:40 +01:00
Javi Martín
1fefc910d6 Add list of targets to SDG tag list
Co-authored-by: Senén Rodero Rodríguez <senenrodero@gmail.com>
2021-01-27 16:21:40 +01:00
Javi Martín
7b3fcf6cb5 Split goal tag list component
This way we'll be able to add targets as well. Besides, having two
classes in the CSS selector will allows to overwrite styles such as
`.debate-show ul li`.

On the other hand, we need to add a stylesheet for the filters as well.
2021-01-27 16:21:40 +01:00
Javi Martín
a7727bfcfe Fix trailing space 2021-01-27 16:21:40 +01:00
Javi Martín
2614de79c1 Extract placeholder selector to style a tag
So we can use it in more places.
2021-01-27 16:21:40 +01:00
Javi Martín
d1ab8ac29b Split li tags in link list helper
This way we generate the same HTML as we generate everywhere where we
manually generate lists of links. Having a blank space betwwen tags
results in a space being introduced when the elements are displayed
inline (or with `inline-block`).

So in places where we don't want that space between the elements we have
to use a flex layout.
2021-01-27 15:56:58 +01:00
Javi Martín
744b9d1ffd Extract placeholder selector for SDG list styles 2021-01-27 15:56:58 +01:00
taitus
6c7a8d31b1 Add read more and real less on long description
In the spec we added in system/sdg/goals_spec.rb we couldn't use
either click_link or find_link, because the link to show/hide the
long description doesn't have the href attribute.
2021-01-27 15:56:08 +01:00
Javi Martín
0d3c4c8154 Simplify styling tags
This way we won't have to add the `inline-block` and `no-bullet` classes
to other elements and we can define the styles in one place.

Note we're using the `ul.tags` selector instead of just `.tags` to avoid
conflicts with a `div.tags` selector which is used to select tags in a
form. Renaming the selector to `.tag-list` would be better, but we
aren't doing so because it would break custom stylesheets using that
selector.

Also note we're keeping the %tags placeholder selector in `.tags`
selector in the participation.scss file. This is so styles are not
overwritten by selectors like `.debate-show ul li`, which has the same
specifity as `ul.tags li`.
2021-01-27 15:55:21 +01:00
Javi Martín
b0a6c20bc0 Add long description to goals 2021-01-27 15:49:46 +01:00
Javi Martín
bf7ff0d004 Change advanced search filters order
Having the date at the beginning makes it less weird to select a custom
date now that we don't have enough space to display the "from" and "to"
date selectors in different columns.
2021-01-26 19:30:58 +01:00
Javi Martín
3ec628a63b Add SDG target filter to advanced search 2021-01-26 19:30:58 +01:00
Javi Martín
b8cd758437 Merge pull request #4327 from consul/add_local_target_to_related_list_selector
Add local targets to related list selector
2021-01-26 19:30:19 +01:00
taitus
7fa594e3e3 Rename sdg_related_list to related_sdg_list
To maintain consistency with the current names in the database with fields:
:related_sdg_type and :related_sdg_id
2021-01-26 19:18:11 +01:00
taitus
41ead2b37c Allow add local targets to RelatedListSelectorComponent 2021-01-26 19:16:57 +01:00
taitus
0a3de68206 Add relation between Goal and LocalTarget
This is similar to what we do with investments, which belong to a heading
but also belong to a budget. In our case, the reason is we've been asked
to add local targets which belong to a goal but are not related to any
existing target.
Even though we're not implementing that case right now, we're adding the
relation so we don't have to add data migrations in the future.
2021-01-26 19:10:12 +01:00
Javi Martín
cb57a4696d Add method to easily access a local target by code
Similar to what we do in goals and targets.
2021-01-26 19:10:12 +01:00
Javi Martín
8542e3e3cf Merge pull request #4323 from consul/sdg_stats
Add SDG stats page to admin section
2021-01-25 15:18:03 +01:00
Javi Martín
7a0c9a956e Merge pull request #4328 from consul/fix_relatable_cache
Expire cache after assigning targets
2021-01-25 12:47:18 +01:00
Javi Martín
498472d5c3 Merge pull request #4326 from consul/fix_flaky_pg_violation
Try to avoid PG::ProtocolViolation error in tests
2021-01-25 12:46:34 +01:00
Senén Rodero Rodríguez
9b2d349e21 Create SDG stats page 2021-01-23 12:23:29 +01:00
Senén Rodero Rodríguez
4c2d918bb5 Create component to render goal stats 2021-01-23 12:23:29 +01:00
Javi Martín
101625ebab Touch the associated record when assigning targets
So the cache will expire properly.
2021-01-22 17:54:18 +01:00
Javi Martín
6470ff85be Merge pull request #4322 from consul/sdg_local_filter
Allow filtering by local target in SDG management
2021-01-22 16:48:31 +01:00
Javi Martín
b5ccae2f40 Allow assigning both targets and local targets
Particularly useful in tests, because writing `targets` is shorter than
writing `global_targets` and `local_targets`.
2021-01-22 16:34:26 +01:00
Javi Martín
39d68a1779 List local targets alongside targets 2021-01-22 16:34:26 +01:00
Javi Martín
176839c905 Rename sdg_targets association
We use `sdg_global_targets` because we will add a new `sdg_targets`
method which will return both targets and local targets.
2021-01-22 16:34:26 +01:00
Javi Martín
14e4c528e9 Allow filtering by local target in SDG management 2021-01-22 16:34:26 +01:00
Javi Martín
d3f72b100e Allow target and local target comparison
This way we'll be able to sort a mixed collection of targets and local
targets.
2021-01-22 16:34:26 +01:00
Javi Martín
e96f45ba39 Merge pull request #4325 from consul/add_related_list_selector
Add related list selector component to forms
2021-01-22 16:34:10 +01:00
taitus
7d2b940ad9 Add SDG::RelatedListSelectorComponent to Legislation Process
Allow to relate SDG and Targets to Legislation Process
2021-01-22 16:14:50 +01:00