Commit Graph

16282 Commits

Author SHA1 Message Date
Julian Herrero
dcad390933 Ability to attach an image to budgets
Co-authored-by: decabeza <alberto@decabeza.es>
2021-06-09 21:33:08 +02:00
decabeza
d78f2e03ad Render link to budget header
- Allow to define a link (text and url) on budget form for render on the budget
header.
- Improve styles

Co-authored-by: Senén Rodero Rodríguez <senenrodero@gmail.com>
2021-06-09 19:16:55 +02:00
decabeza
090f1bcddb Not showing the phase description in the budget header
This description of the current phase is already being displayed on the same page
in the section "Participatory budgets phases"
2021-06-09 16:03:33 +02:00
decabeza
4adb7236dc Add title to budget header 2021-06-09 16:03:33 +02:00
Senén Rodero Rodríguez
26d14cbd04 Move system specs to subheader component specs
As the are much faster.

Keep a system spec to check the component is called from the view.
2021-06-09 16:03:32 +02:00
Senén Rodero Rodríguez
822140a147 Move systems specs to budget component
As they are much faster.
2021-06-09 16:03:32 +02:00
Javi Martín
03d0a46f5d Merge pull request #4531 from consul/budget-steps
Split budget creation in steps
2021-06-09 13:48:28 +02:00
Javi Martín
bdd5361f6a Allow editing the budget in budget creation wizard
When users created a budget and made a typo, they could use the link to
go back to edit a budget. However, after doing so, they were out of the
budget creation process.

So we're now letting users go back to edit the budget, fix any mistakes
they might have made, and then continue to groups.
2021-06-08 18:45:55 +02:00
decabeza
f8008a4a6f Add link to remove budget on budget admin index 2021-06-08 18:45:55 +02:00
Javi Martín
f110e65f80 Allow enabling/disabling phases in budgets wizard
So now there's no need to edit each phase individually to enable/disable
them.

We aren't doing the same thing in the form to edit a budget because we
aren't sure about possible usability issues. On one hand, in some tables
we automatically update records when we mark a checkbox, so users might
expect that. On the other hand, having a checkbox in the middle of a
form which updates the database automatically is counter-intuitive,
particularly when right below that table there are other checkboxes
which don't update the database until the form is submitted.

So, either way, chances are users would think they've updated the phases
(or kept them intact) while the opposite would be true.

In the form within the wizard to create a budget that problem isn't that
important because there aren't any other fields in the form and it's
pretty intuitive that what users do will have no effect until they press
the "Finish" button.

Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
2021-06-08 18:45:55 +02:00
Julian Herrero
eb77d09425 Add phases step to budget creation 2021-06-08 18:45:55 +02:00
Javi Martín
9421f1673a Extract budget phases form to a component
This way it'll be easier to use it in the budgets wizard section
as well.
2021-06-08 18:45:55 +02:00
Julian Herrero
f8d6ba12d7 Add headings step to budget creation
Co-Authored-By: decabeza <alberto@decabeza.es>
2021-06-08 18:45:53 +02:00
Javi Martín
0a2c70cbfe Improve title in admin headings index
With the word "headings" in it, it's a bit easier to know where we are.

We're also using a translation since not every language in the world
uses a "/" as a standard separator between two terms.
2021-06-08 18:45:14 +02:00
Javi Martín
b99ce2af45 Remove duplication in timeline component
This way adding new steps will be easier.
2021-06-08 18:45:14 +02:00
Alberto
eff370b279 Improve layout in budget headings form 2021-06-08 18:45:14 +02:00
Alberto
b304c640e1 Add groups step to budget creation
Note we're keeping this section's original design (which had one button
to add a new group which after being pressed was replaced by a button to
cancel) but we aren't using Foundation's `data-toggle` because there
were a couple of usability and accessibility issues.

First, using `data-toggle` multiple times and applying it to multiple
elements led to the "cancel" button not being available after submitting
a form with errors. Fixing it made the code more complicated.

Second, the "Add new group" button always had the `aria-expanded`
attribute set to "true", so my screen reader was announcing the button
as expanded even when it wasn't. I didn't manage to fix it using
`data-toggle`.

Finally, after pressing either the "Add new group" and "Cancel" buttons,
the keyboard focus was lost since the elements disappeared.

So we're simplifying the HTML and adding some custom JavaScript to be
able to handle the focus and manually setting the `aria-expanded`
attribute.

Co-Authored-By: Javi Martín <javim@elretirao.net>
Co-Authored-By: Julian Herrero <microweb10@gmail.com>
2021-06-08 18:45:13 +02:00
Alberto
e71ccee682 Hide maximum headings select in groups without headings 2021-06-08 18:30:04 +02:00
Alberto
03e598a53d Improve layout in budget groups form 2021-06-08 18:30:03 +02:00
Javi Martín
01c21158c4 Use :only in groups and headings before_action
When we've got 6 actions and we use it in 3, IMHO the code is easier to
follow if we write the actions where we do use it.
2021-06-08 18:27:32 +02:00
Javi Martín
9d72aed37d Fix mixin for general button styles
Using the placeholder selector, we weren't overwriting the rules in the
mixin called with `@include` in some cases because in the generated CSS
the placeholder selector appeared before the code generated by the calls
to `@include`.
2021-06-08 18:27:32 +02:00
Javi Martín
de27c7a56c Use local variables in group and heading partials
We usually prefer local variables over instance variables in partials.
This way we'll be able to call the partial from views or components
where the instance variable isn't available.

And since we're using the `path` variable to configure the URL, we don't
have to specify extra variables like `@budget` or the namespace `:admin`
in `form_for`, since Rails only uses those variables to set the URL.
2021-06-08 18:26:06 +02:00
Julian Herrero
b16fe80ba5 Extract groups and headings tables to components 2021-06-08 14:25:44 +02:00
Julian Herrero
2115eb5274 Allow creating budgets step by step
We introduce the first step (creating the budget).

Co-Authored-By: decabeza <alberto@decabeza.es>
2021-06-08 14:25:44 +02:00
Javi Martín
82e8de094b Extract budget form to a component
This way it will be easier to change it and reuse it.
2021-06-08 14:25:43 +02:00
Javi Martín
dafe6038ec Merge pull request #4509 from consul/remove-skip-map
Remove skip map checkbox
2021-06-04 17:54:04 +02:00
Javi Martín
e9fb95d8d7 Merge pull request #4536 from consul/release_1.3.1
Release version 1.3.1
2021-06-03 17:53:03 +02:00
Javi Martín
4d314b08d3 Release version 1.3.1 2021-06-03 17:24:46 +02:00
Javi Martín
d06031c427 Don't run release 1.3.0 tasks anymore
People who have already upgraded to version 1.3.0 don't need to execute
them again.

We're not deleting the tasks yet in case some people would like to
upgrade from version 1.2.0 to version 1.3.1. In this case, they'll have
to execute the tasks manually.
2021-06-03 17:24:46 +02:00
Javi Martín
3e921ec25a Merge pull request #4503 from consul/menu_button
Increase menu button touch area on small screens
2021-06-03 17:24:31 +02:00
Javi Martín
0f5943b6a8 Merge pull request #4537 from consul/i18n_crowdin
Update translations from Crowdin
2021-06-03 17:19:01 +02:00
Senén Rodero Rodríguez
b2de9dbb65 Update translations from Crowdin 2021-06-03 15:34:18 +02:00
Melvin Lammerts
c34aa54122 Remove skip map checkbox 2021-06-03 11:13:52 +02:00
Javi Martín
414eba83ec Merge pull request #4522 from consul/budget_without_phases
Fix crash with budgets with disabled current phase
2021-06-02 19:13:33 +02:00
Javi Martín
93a7d28a82 Fix crash with budgets with no published phases
In this case, the duration of the budget cannot be determined, and the
application was crashing when trying to do so.

Now we're just returning `nil` as duration.
2021-06-02 18:00:17 +02:00
Javi Martín
69ade5b131 Fix crash with budgets with disabled current phase
There's an edge case where the current phase of the budget was disabled.
In this case, the application was crashing.

I'm not sure what we should do regarding this case. Is it OK to allow
disabling the current phase? Is it OK to allow selecting a disabled
phase as the current phase?

Since I'm not sure about it, for now I'm leaving it the same way it was.

Co-authored-by: Julian Herrero <microweb10@gmail.com>
2021-06-02 18:00:17 +02:00
Javi Martín
c592d80257 Merge pull request #4528 from consul/budget_with_administrators
Fix crash destroying budgets with admins/valuators
2021-06-02 17:59:31 +02:00
Javi Martín
a0942f66bf Fix crash destroying budgets with admins/valuators
We don't allow deleting a budget with associated investments. However,
we allow deleting a budget with associated administrators and valuators.
This results in a foreign key violation error:

PG::ForeignKeyViolation: ERROR:  update or delete on table "budgets"
violates foreign key constraint "fk_rails_c847a52b1d" on table
"budget_administrators"

Using the `dependent: :destroy` option when defining the relationship,
we remove the association records when removing the budget.

As a bonus, we reduce the number of Rubocop offenses regarding the
`Rails/HasManyOrHasOneDependent` rule. Only 72 to go! :)
2021-06-02 17:07:04 +02:00
Javi Martín
747e6146a7 Add a border to the menu button
This way we make it more obvious that it's clickable and, since adding a
border requires adding padding, we increase the touch area, making it
easier to use and more accessible for users with motor disabilities.

Since now the button looks like a button, we don't need the pointer
cursor Foundation adds to hamburger icons and can use the default cursor
browsers provide for buttons.
2021-06-02 17:06:40 +02:00
Javi Martín
26a8f2eace Increase menu button touch area on small screens
Some users might not be able to touch the icon due to a motor
disability. Other users might think the "Menu" text is part of the
button and try to touch it instead.

Making the "Menu" text part of the button makes it easier to show/hide
this menu. Besides, it lets screen reader users with a small screen hear
the word "Menu" associated to the button.

We could simplify the HTML a bit more but Foundation's `hamburger` mixin
uses the `::after` element with `position: absolute`, so we can't apply
it directly to the button without making the CSS more complex.
2021-06-02 17:06:40 +02:00
Javi Martín
cc69b81ec1 Simplify styles for the menu button
Using `currentcolor` and `color: inherit` is IMHO more expressive (we're
saying we want to use the same color as the text) and makes it easier to
customize these colors in other CONSUL installations. We also remove
duplication as we can use the same styles for both the admin and the
public layouts.
2021-06-02 17:06:40 +02:00
Javi Martín
f92008e91e Simplify system tests using a small window 2021-06-02 17:06:40 +02:00
Javi Martín
99361a958a Merge pull request #4515 from consul/application_css
Fix order loading custom styles
2021-06-02 17:04:15 +02:00
Javi Martín
f18d163cd3 Merge pull request #4535 from consul/update_parser
Bump parser from 2.7.2.0 to 3.0.1.1
2021-06-02 17:03:01 +02:00
Javi Martín
b549eb444a Allow several custom stylesheets
So other institutions customizing CONSUL can organize their custom code
as they wish to.

We're also updating the comments in the `custom.scss` file, since it was
referencing files which no longer exist.
2021-06-02 16:15:00 +02:00
Javi Martín
4d70f50a5f Fix order loading custom styles
We have to load the custom styles last so they actually override what we
do.
2021-06-02 16:14:59 +02:00
Javi Martín
0846766dd6 Load leaflet CSS before our styles
This way we don't have to use the `!important` flag to override styles.
2021-06-02 16:14:24 +02:00
Javi Martín
9885f67111 Merge pull request #4518 from consul/fix_i18n_help_images
Fix exception using locales with no help images
2021-06-02 16:14:02 +02:00
Javi Martín
44c7f7a5a2 Bump parser from 2.7.2.0 to 3.0.1.1
We were getting a warning in the development environment because the
version of parser we were using didn't support Ruby 2.6.7.
2021-06-01 01:37:49 +02:00
Javi Martín
5f92252054 Fix exception using locales with no help images
In commit 905ac48bb we activated exceptions when assets were not found,
in order to detect places where we were trying to load non-existent
images.

We got an exception for that reason: we were loading images based on the
current locale, but for some locales there was no images.

We're now using fallbacks and loading another image when the original
one isn't available.

Note we're copying the English images to images with a generic name for
the case where there's no fallback with an image. We're copying the
files instead of using symbolic links to make sure they can be
overwritten independently in other CONSUL installations.

Also note we're updating the HTML so the section gets the ID instead of
the header. That way the system test is simple.
2021-05-29 15:05:29 +02:00