Commit Graph

182 Commits

Author SHA1 Message Date
Javi Martín
8024c4bb69 Fix goal order in goal select 2021-01-10 15:54:23 +01:00
Javi Martín
0595f91222 Simplify advanced search layout width rules
This way, adding a new element is going to be easier.
2021-01-10 15:54:23 +01:00
Javi Martín
f024a643ea Simplify accessing advanced search params 2021-01-10 15:54:23 +01:00
Javi Martín
2faf99c54b Extract advanced search into a component 2021-01-10 15:54:23 +01:00
Javi Martín
142f9b300b Add filters by SDG to processes sidebar
It appears on every process where a tag cloud appears: debates,
proposals and budget investments.
2021-01-10 15:52:22 +01:00
Javi Martín
ceed3c18d3 Display SDG icons alongside tags
We're using the translation fallbacks for the icons, just like we do for
texts.

Note we use the `render?` method provided by view_component to make sure
the component will not be rendered when certain features are disabled.

Also note the `find_asset` method works differently in development and
production, and so we use different approaches here.
2021-01-09 14:53:54 +01:00
Javi Martín
53af5749b9 Extract class to check SDG rendering conditions
This class provides a method which shows whether a certain process is
enabled.

Even if it uses a helper, this class is inside the models folder because
the helper it uses actually only uses model methods. We might eventually
remove/simplify this helper and cache inside the model, like we did with
I18n content translations in commit 41dba842a.
2021-01-09 14:19:00 +01:00
Javi Martín
159edba015 Specify the SDG title uses two lines
This way translators will find a hint indicating they must use two lines
and not three or more, since the title is optimized for being displayed
in two lines.
2021-01-04 12:45:03 +01:00
Javi Martín
2509512d73 Split title in two lines
The same it's done in the UN official SDG pages.

We could try to split the string on a space which is more or less in the
middle. However, this wouldn't work on languages which don't have spaces
between works, like Chinese.

So in the end I've added a new translation key, where the title is
supposed to be split in several lines the same way it's done by the UN.
2020-12-27 21:43:17 +01:00
Javi Martín
bec166548c Add code to goal title
The same way it's done in UN official SDG pages.
2020-12-27 21:43:17 +01:00
Javi Martín
83400b9ed4 Display a message when feeds have no items
This is a scenario which will likely take place for at least some of the
goals.
2020-12-27 21:42:42 +01:00
Javi Martín
cc9ab70fbb Add processes to goal view
Note the link to see all processes does not filter by goal because the
legislation section does not have any search filters.
2020-12-27 21:42:42 +01:00
Javi Martín
13fbf4e4b3 Use h2 tags in feed headers
We were jumping from h1 to h3 and some of these sections (cards and
processes) had h3 tags inside them.

My best guess is we were using h3 so the titles were smaller. So I'm
adding a CSS mixin to easily use a font size of a different heading tag.
2020-12-27 21:42:42 +01:00
Javi Martín
06d29335ff Separate the header from the feed content
We were having some style issues when adding the processes feed to the
goal view because of this lack of separation.

We're using a <section> tag so it's clear where the <header> tag belongs
to.
2020-12-27 21:42:42 +01:00
Javi Martín
2bb0a2dfaf Make "see all" links filter per goal 2020-12-27 21:42:42 +01:00
Javi Martín
2fcfa7ebd7 Render participation feeds per SDG 2020-12-27 21:42:42 +01:00
Javi Martín
fae52274a4 Reuse code between feed components
They were all following the same format.

Note we need to group the `see_all` translation keys together (the same
way it's done with the `most_active` keys) so we don't have an unused
translation warning.

We're also moving the "see all" link in processes outside the feed
content; the same way it's done in debates and proposals and removing
unnecessary classes in the processes feed: the column class is causing
the processes not to be aligned with the debates above them, and the
margin bottom is not needed because the margin of the footer is already
enough.
2020-12-27 21:42:40 +01:00
Javi Martín
be9fc22650 Use flex layout instead of data-equalizer in feeds
Using data-equalizer is always hard due to the JavaScript it uses, while
the flex layout works all the time.
2020-12-27 16:44:51 +01:00
Javi Martín
98aea588e5 Simplify debates and proposals feed layout
Using the `:only-child` selector we can adjust widths with CSS and don't
have to rely on methods calculating which features are available.
2020-12-27 16:44:51 +01:00
Javi Martín
330efe5a41 Extract components for feeds 2020-12-27 16:44:51 +01:00
Javi Martín
a73ab57cef Add basic header to SDG goals view 2020-12-23 13:18:17 +01:00
Javi Martín
910acff624 Add empty SDG goal show page
Note we're using the code instead of the ID to get the goal in the URL.
IMHO this is what most people would expect; visiting a URL with a "7"
takes you to SDG number 7, and not to the one with "7" as a database ID.

In order to avoid tests (either automated tests or manual tests) passing
by coincidence due to the goal ID and the goal code being the same, I'm
shuffling the codes before entering them in the databse.

I've tried using `resolve` in the routes so the code is automatically
taken into account, but it doesn't work since `resolve` cannot be used
inside a namespace, and here we're within the `sdg` namespace.
2020-12-23 13:18:17 +01:00
Javi Martín
de4be15a8d Add empty SDG index 2020-12-23 13:18:10 +01:00
Javi Martín
74962ef05f Add filter by target 2020-12-21 18:27:27 +01:00
Javi Martín
c9362ffeb4 Add filter by goal 2020-12-21 18:27:27 +01:00
Javi Martín
791ba73e12 Extract method to display a goal code and title
This is a pattern we're going to use in many places.
2020-12-21 18:27:27 +01:00
Javi Martín
cb183b6e15 Add search to SDG managed content 2020-12-21 18:27:27 +01:00
Javi Martín
ee06dcc05a Disable SDG sections when settings are disabled 2020-12-21 18:04:48 +01:00
Javi Martín
f76279a4dd Add form to assign targets to a record 2020-12-21 18:04:48 +01:00
Javi Martín
11c3b3db13 Add link to an (empty) edit action 2020-12-21 18:04:48 +01:00
Javi Martín
ed51c5dcd3 Add basic SDG Management content section
Note using `params[:relatable_type].classify` is recognized as a
security risk by some tools. However, it's a false positive, since we've
added constraints to the URL so that paramenter can only have the values
we trust.
2020-12-21 18:04:48 +01:00
Javi Martín
5590ecaaa6 Extract methods to generate SDG management menu 2020-12-21 18:04:48 +01:00
taitus
6d5333fc7a Add generic method for header
Unify Header to be able to use it from the admin as from the seg_management.
2020-12-16 13:16:48 +01:00
taitus
d64518d173 Add sdg manager section to admin profile section 2020-12-16 13:16:48 +01:00
taitus
9fe24aec9d Add sdg manager section to admin
Allow a user to become an sdg manager
2020-12-16 13:16:45 +01:00
Javi Martín
599332f26e Merge pull request #4271 from consul/sdg_local_targets
Add SDG local targets
2020-12-16 11:35:12 +01:00
Senén Rodero Rodríguez
5fa7503374 Include local_targets controller 2020-12-11 16:10:37 +01:00
Senén Rodero Rodríguez
8f7809ddb4 Allow to destroy SDG local targets 2020-12-11 16:10:37 +01:00
Senén Rodero Rodríguez
a211937744 Add SDG page to update local targets 2020-12-11 16:10:37 +01:00
Senén Rodero Rodríguez
eb0f13018c Add actions column to SDG local targets index 2020-12-11 16:10:37 +01:00
Senén Rodero Rodríguez
5611f58909 Add SDG page to create local targets 2020-12-11 16:10:37 +01:00
Senén Rodero Rodríguez
3364423698 Update SDG header component
* Add a header element as component markup wrapper
* Allow component to receive an optional block
* Add reusable styles for header links

Co-autored-by: Javi Martín <javim@elretirao.net>
2020-12-11 16:09:43 +01:00
Senén Rodero Rodríguez
88bcf527d8 Add local_targets index to the administration 2020-12-11 16:09:42 +01:00
Javi Martín
0c482ae418 Fix active class for proposals in admin menu 2020-12-07 19:28:12 +01:00
Javi Martín
1046ec5e78 Move link methods from view to component
This way the view is not as hard to read as it was.
2020-12-07 15:28:56 +01:00
Javi Martín
55d2cfe5b1 Use link list helper in admin menus
For now we're not including lists with nested lists.
2020-12-07 15:28:56 +01:00
Javi Martín
cf510043a4 Search on the same URL by default 2020-12-07 14:28:36 +01:00
Javi Martín
a9427f5971 Allow custom options in search form component
So we keep the same API as the form_tag method.
2020-12-04 19:57:05 +01:00
Javi Martín
9b073599f0 Allow different labels in admin search component 2020-12-04 19:57:05 +01:00
Javi Martín
0a3acf3c5f Use a shared translation for search buttons
We were writing the same text over and over for the same translations.
Since they all serve the same function, it's perfectly fine for them to
have the same text, and so we can have a shared translation.
2020-12-04 19:57:05 +01:00