Commit Graph

201 Commits

Author SHA1 Message Date
Julian Herrero
d20e521ee9 Display the time a phase ends at in admin section 2021-03-11 19:37:58 +01:00
Javi Martín
a2a6ae7bdd Use a caption to identify budget phases table
This makes the table easier to identify when writing tests and using
screen readers.

Since we do not render any other table captions anywhere else, we're
making the caption invisible so only screen reader users will be
affected by this change.
2021-03-11 19:37:58 +01:00
Javi Martín
150fb91686 Simplify test for budget phases table
Even if the test checked all possibilities, it was hard to understand.
Using `have_table with_cols:` to test the order of the rows and testing
one phase is enabled and has a link to edit it es enough IMHO.
2021-03-11 19:37:58 +01:00
decabeza
c0c458bb38 Remove summary in phases form
Since it does not appear in the phases anymore.

Also, the rake unifies the fields of the budget summary with the budget
description.
2021-03-11 19:37:58 +01:00
decabeza
c0f9e4f045 Change budget phases design
Co-authored-by: Javi Martín <javim@elretirao.net>
2021-03-11 19:37:58 +01:00
Javi Martín
70cf956210 Extract method to check the current phase 2021-03-09 16:37:47 +01:00
Senén Rodero Rodríguez
aa6195abc5 Add link to SDG help page to Other information of interest section at main help 2021-03-02 14:45:19 +01:00
taitus
90f014f639 Allow open link on new window
While trying to add the target="_blank" to this link I noticed that this attribute
no longer works in some places in the application, such as the terms and
conditions  link in the sign_up page.

For the time being I think we can resolve it this way in this case and deal with
this issue in a separate PR.
2021-03-02 14:45:19 +01:00
taitus
e91b52ffe0 Add link to help page to related list selector component 2021-03-02 14:45:18 +01:00
taitus
d26607183e Add sdg help page
In this page we will render a list of clickable Goals icons that will show their
targets and related local targets

Co-authored-by: Senen <senenrodero@gmail.com>
2021-03-02 14:45:18 +01:00
taitus
522684cd2f Adapt targets component to render on sdg help page
This component was rendered on different pages so there were no conflicts
with static id's.
Now in the SDG help page we are going to render them all at once, so we
convert the static identifiers to dynamic.
2021-02-26 16:36:40 +01:00
Senén Rodero Rodríguez
1d6490e22f Update sdg management homepage to render header cards 2021-02-26 16:16:51 +01:00
Javi Martín
683af5de60 Merge pull request #4371 from consul/all_budgets_filter
Add filter to display all budgets in admin section
2021-02-26 14:47:19 +01:00
Javi Martín
45517f659e Add SDG goals/targets to legislation proposals 2021-02-24 20:42:53 +01:00
decabeza
2f636eaf77 Add completed info on finished budgets 2021-02-23 18:39:45 +01:00
decabeza
4ff8162a2e Add filter to show all budgets in admin 2021-02-23 18:39:45 +01:00
Julian Herrero
28caabecdf Refactor participatory budgets in draft mode
Previously the draft mode was a phase of the PB, but that had some
limitations.

Now the phase drafting disappears and therefore the PB can have the
status published or not published (in draft mode).

That will give more flexibility in order to navigate through the
different phases and see how it looks for administrators before
publishing the PB and everybody can see.

By default, the PB is always created in draft mode, so it gives you
the flexibility to adjust and modify anything before publishing it.
2021-02-23 17:05:24 +01:00
Julian Herrero
0b2b8b557d Fix staff not being loaded after creating budget 2021-02-23 16:28:00 +01:00
decabeza
f685020fd0 Show results and stats settings only in budget edit view 2021-02-23 16:11:14 +01:00
Javi Martín
fb88e0b77c Fix number of new notifications
We were displaying the total number of notifications with a message "You
have N unread notifications", but were using the total number of
notifications instead of the unread ones.
2021-02-18 14:45:48 +01:00
Javi Martín
4c289f2489 Simplify notification item HTML
Other than simplifying the view, we can write tests using `click_link`,
which makes the tests more robust. Clicking the `.icon-notification`
element was causing some tests to fail when defining a window height of
750 pixels in the `admin_budgets` branch.
2021-02-16 23:21:51 +01:00
Javi Martín
ab2b3a2671 Improve help messages in SDG selector
Hopefully now it's a bit more obvious that SDGs can be selected by
clicking on them and that the field to select goals and the field to
select targets/goals are related (since they're now part of the same
fieldset).
2021-02-15 15:48:25 +01:00
Javi Martín
6ecb6757a6 Use real check boxes to select goals
We were using list items with the checkbox role. This is probably
confusing since list items have a listitem role, and so we were
basically using a list with no listitem.

We could add a `<span role="checkbox">` tag inside the list item, but
using real checkboxes is probably easier. We're also adding a test to
verify the checkboxes native behavior is compatible with our code.

Note we're using the "enter" key to toggle the "checked" status of the
SDG. This is probably not intuitive for screen reader users who might
try to submit the form using the "enter" key after selecting a goal.

However, the alternative would be even less intuitive for sighted
keyboard users, since for them these icons look like links or buttons
and they would accidentally submit the form when trying to select a
goal.

Since we haven't come up with a better interface yet, for now we're
following the principle of least damage; we consider submitting the form
against a user's will is less annoying than forcing users to move to a
different field before being able to submit the form.

Also note we can't write `check` in the tests because Capybara will try
to click the checkbox, which is hidden by the image in the label.
2021-02-15 15:48:25 +01:00
Javi Martín
00dfa95902 Allow toggling the column selector with a keyboard
Using a button tag, it's possible for every user to "click" the element.
Besides, we don't need to call the `preventDefault` function, because
buttons with type "button" don't do anything by default.
2021-02-08 19:57:42 +01:00
Javi Martín
945d723fef Merge pull request #4349 from consul/fix_budget_polls_spec
Fix flaky budget polls voting spec
2021-02-08 17:01:38 +01:00
Javi Martín
0d8119a1e3 Use social-share-button whatsapp icon
We were using a custom icon because in the past social-share-button
didn't have support for whatsapp. But now that it does, we can remove
our custom icon.

Note we're using the `_app` suffix because that's the name of the icon
meant for mobile devices.
2021-02-08 16:31:26 +01:00
Javi Martín
ef0494f09c Fix missing expectation in budget polls spec
We've had a failure in one of our test suite runs [1]. A possible cause
could be an HTTP request taking place at the same time as an AJAX
request, with both trying to access the database at the same time.

We've had several similar issues in the past which have been fixed by
checking the AJAX request has finished before requesting another page,
so we're applying the same principle here.

[1] https://github.com/consul/consul/runs/1855207922
2021-02-08 15:45:25 +01:00
Senén Rodero Rodríguez
fb611d91ca Fix legislation proposal crash with SDG enabled
Now we check the given record or name is a relatable instance or class
to avoid trying to render goals for records which don't have a goals
association.

Note for now we are ignoring the case where we pass a controller_path
for an unsupported class (for example, `legislation/proposals` or
`budgets/headings`) because we never use it. We might need to revisit
this case in the future.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-31 14:44:53 +01:00
Senén Rodero Rodríguez
450b157a5e Fix tag links on legislation proposals
On commit 1a902a96 we removed this helper to make use of polymorphic
routes but when it's called for Legislation::Proposal fails as the
namespace does not match the model namespace.

Now we recover the removed helper but only the parts that do not work
with polymorphic_url helper.

Co-Authored-By: Javi Martín <javim@elretirao.net>
2021-01-31 13:56:05 +01:00
Javi Martín
a877449936 Add related SDG and targets tags to processes
I'm not sure why we were using squares to style these lists see commit
bbacd4546b) but I don't think it's very important and it breaks
displaying the list of related SDGs.
2021-01-31 13:33:27 +01:00
Javi Martín
19bab5a9dc Add related SDG and targets tags to polls 2021-01-31 13:33:27 +01:00
taitus
f45bbb316c Add Targets component to Show component 2021-01-29 14:15:58 +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
3018de2847 Merge pull request #4324 from consul/sdg_target_filter
Add SDG target tags and filter
2021-01-27 16:48:12 +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
3ec628a63b Add SDG target filter to advanced search 2021-01-26 19:30:58 +01:00
taitus
41ead2b37c Allow add local targets to RelatedListSelectorComponent 2021-01-26 19:16:57 +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
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
Javi Martín
14e4c528e9 Allow filtering by local target in SDG management 2021-01-22 16:34:26 +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
taitus
920631c5b3 Add SDG::RelatedListSelectorComponent to Polls
Allow to relate SDG and Targets to Polls
2021-01-22 16:14:50 +01:00
taitus
6d3782b4a0 Add SDG::RelatedListSelectorComponent to Budget Investments
Allow to relate SDG and Targets to Budget Investments
2021-01-22 16:14:47 +01:00
taitus
95c1f36bdd Add SDG::RelatedListSelectorComponent to Proposals
Allow to relate SDG and Targets to Proposals
2021-01-22 16:05:16 +01:00
taitus
e6bfeef58d Add SDG::RelatedListSelectorComponent to Debates 2021-01-22 16:04:40 +01:00
taitus
8a91493fe4 Extract repeating code to a method 2021-01-22 12:42:53 +01:00