Commit Graph

78 Commits

Author SHA1 Message Date
taitus
41ead2b37c Allow add local targets to RelatedListSelectorComponent 2021-01-26 19:16:57 +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
189c299a6e Do not render component when the feature is disabled 2021-01-22 16:03:53 +01:00
Javi Martín
a979a2225d Merge pull request #4315 from consul/sdg_relation_tags
Add SDG goal/target selector
2021-01-20 19:33:32 +01:00
taitus
d56396acb7 Improve usability and design
Render the tags under the input. This way the input is not moved down
when a tag is added.
Render icons under the label. As you can add tags by clicking on the icons,
in this way the input is more related to the icons.
2021-01-20 19:18:58 +01:00
taitus
602b22edfd Allow tags to be removed with the keyboard
We improved accessibility by overwriting the setIcon method in the library.
Now we render a button and add the aria-label attribute.
2021-01-20 19:18:57 +01:00
taitus
fce844261a Add help section
In the help section we show the titles of the Goals and Targets that we have added
2021-01-20 19:18:55 +01:00
taitus
c18ab66cc7 Add new suggestion attribute to render custom text on tags
Add "display_text" to allow customize the text that we want render on tag.
For Goals we render "SDG1", "SDG2"..
For Targets we render the code "1.1", "1.A"...
2021-01-20 19:18:03 +01:00
taitus
23f72d939a Add list of goals icons to component
- When we click on an icon we add a new tag with the Goal related to the input or
we remove the tag when that label already exists.

- Manage goals icons status when add or remove related targets:
Whenever there is a tag related to Goal, either the Goal itself or a Target, the icon
will be "checked".
When there is no related Goal or Target it will no longer be marked as checked.
2021-01-20 19:18:03 +01:00
taitus
25501c74bb Add suggestions list with goals and targets
This will allow autocomplete for the loaded values in suggestions settings.
We remove commas on tag to allow to jquery.amsify.suggestag.js use comma
as delimiter.
2021-01-20 19:18:02 +01:00
taitus
334d803332 Add related list selector component
This component allows you to add Goals and Targets in a single
input to relate it to any resource.
We use the new added library to render them as tags.
2021-01-20 19:18:01 +01:00
Javi Martín
5a42d65d5f Make it possible to add banners to the SDG section 2021-01-20 17:22:08 +01:00
Javi Martín
5927e4dfaa Add title to SDG homepage 2021-01-14 18:04:21 +01:00
Javi Martín
c3e60ff514 Add cards to SDG homepage 2021-01-14 17:47:21 +01:00
Javi Martín
4072735187 Add icons to SDG index 2021-01-14 17:45:14 +01:00
Javi Martín
1e7517d1f6 Extract components to edit and add cards
This way we'll be able to reuse it in the SDG Management section while
reusing the `title` method to set the page title.
2021-01-14 17:38:01 +01:00
Javi Martín
e8e920ee50 Rename Widgets components to Widget
So naming is consistent with the way Admin::Widget controllers are
named.
2021-01-12 14:50:37 +01:00
Javi Martín
cee4613d87 Merge pull request #4305 from consul/sdg_icons_in_index
Add SDG icons to related records
2021-01-11 13:07:11 +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
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
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
2fcfa7ebd7 Render participation feeds per SDG 2020-12-27 21:42:42 +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