Commit Graph

2285 Commits

Author SHA1 Message Date
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
4a880fc1c5 Render header on sdg index page
We no longer show the static header when we have created a
custom header.
2021-02-26 16:20:57 +01:00
Senén Rodero Rodríguez
1d6490e22f Update sdg management homepage to render header cards 2021-02-26 16:16:51 +01:00
Senén Rodero Rodríguez
c217af9f4b Add sdg management header controller 2021-02-26 16:16:51 +01:00
Javi Martín
ba4b1a91e1 Allow using a different URL on widget card forms 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
Javi Martín
3d97708cc5 Simplify calls to filter_by 2021-02-24 20:20:25 +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
Javi Martín
0911b89d16 Add name attribute to heading content blocks
This way we can simplify the code and don't have to rely on `.try`
statements which are confusing and so we don't allow them in the
`Rails/SafeNavigation` Rubocop rule.
2021-02-05 17:46:23 +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
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
Senén Rodero Rodríguez
9b2d349e21 Create SDG stats page 2021-01-23 12:23:29 +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
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
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
7b1821fc9b Prepare relatable concern and relations controller
Allow send Goals and Targets from edit component input field
2021-01-20 19:17:59 +01:00
Javi Martín
a7bbdb1bd0 Simplify rendering a banner
Now the banner component accepts either a banner or a section and loads
the banner if it's a section, so we don't have to add the `@banners`
variable in several controllers.
2021-01-20 17:22:05 +01:00
Senén Rodero Rodríguez
739d23fe73 Mark relatable as reviewed when updating its relations
Show a notice only once when the user updates the relatable.
2021-01-19 14:56:30 +01:00
Senén Rodero Rodríguez
c6407d82e3 Add filters to SDG relations controller
We have three filters: "pending", "all" and "reviewed". Where "pending"
is the default one.

Now we are rendering the `shared/_filter_subnav` partial we need to stub
helper methods defined at the controller and the helper methods that
rely on the request parameters to test the component.
2021-01-19 14:56:30 +01:00
Senén Rodero Rodríguez
94a4b67675 Use local variables at shared/filter_subnav partial
So we can use it from components too.
2021-01-19 13:51:06 +01:00
Javi Martín
c3e60ff514 Add cards to SDG homepage 2021-01-14 17:47:21 +01:00
Javi Martín
7aee4f6241 Add SDG phases cards management
These cards will be displayed in the SDG homepage.

Note there seems to be a strange behavior in cancancan. If we define
these rules:

can :manage, Widget::Card, page_type: "SDG::Phase"
can :manage, Widget::Card

The expected behavior is the first rule will always be ignored because
the second one overwrites it. However, when creating a new card with
`load_and_authorize_resource` will automatically add `page_type:
"SDG::Phase"`.

Similarly, if we do something like:

can :manage, Widget::Card, id: 3
can :manage, Widget::Card

Then the new card will have `3` as an ID.

Maybe upgrading cancancan solves the issue; we haven't tried it. For now
we're defining a different rule when creating widget cards.
2021-01-14 17:40:02 +01:00
Javi Martín
2968275a1c Add empty SDG homepage configuration page
Here we'll eventually display links to edit the homepage and the cards
in it.
2021-01-14 17:35:38 +01:00
Senén Rodero Rodríguez
3aaf5ce151 Add back link to cards form
As we normally do in other places.
2021-01-12 15:34:55 +01:00
Javi Martín
4c0bb894eb Use polymorphic routes to manage cards
We use a different logic to load the card depending on the controller
we're using, and then share the rest of the code. This way we simplify
the code a bit, since we don't have to check for the page_id parameter.
2021-01-12 14:50:37 +01:00
Javi Martín
52d71b8432 Remove unneeded namespace methods
These methods are not necessary since we changed the `namespace` helper
method in commit 13b3d9ceb.
2021-01-12 14:50:36 +01:00
Javi Martín
c06f14fa65 Remove unused method in cards controller
This method isn't necessary since commit 71601bd3f.
2021-01-12 14:50:36 +01:00
Javi Martín
0762c66855 Don't skip authorization check managing cards
I'm not sure why we were skipping this check.
2021-01-12 14:50:36 +01:00
Javi Martín
ded5a8d468 Use cancancan to load pages and cards
Like we do in most places in the application.
2021-01-12 14:50:33 +01:00
Javi Martín
73e605232e Merge pull request #4292 from consul/sdg_view
Add SDG view with related content
2020-12-28 21:01:14 +01:00
Senén Rodero Rodríguez
db06bb2c9e Load records using cancancan load_and_authorize_resource method 2020-12-23 16:53:39 +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
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
taitus
9521d87d03 Remove unneeded for_render
for_render does is including organizations and there is no need to
 render organizations on these controllers
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
taitus
fb5965fe63 Add cancancan to SDG content
Only allow access to the SDG content section to administrators and sdg managers
2020-12-16 11:43:17 +01:00