Commit Graph

17301 Commits

Author SHA1 Message Date
Senén Rodero
a6d61faa3a Merge pull request #4736 from consul/typos
Fix typos in proposals dashboard and budgets admin
2021-11-18 10:13:55 +01:00
Javi Martín
e612705463 Make investment filters easier to understand
So now:

* In the first few phases, no filters are shown (just like before)
* During the valuation phase, we show "Active" and "Unfeasible"
* During the final voting, we show "Active" (which now refers to the
  selected investments), "Not selected for the final voting" and
  "Unfeasible"
* When the budget is finished, we show "Winners", "Not selected for the
  final voting" and "Unfeasible"

Now each investment is shown in one (and only one) of the filters
(except when the budget is finished; in this case we don't show selected
investments which didn't win), and we remove the confusing "Not
unfeasible" filter by only showing it during the valuation phase (before
filters are selected) and renaming it to "Active". We also rearrange the
filters so the default one for each phase is shown first.

The idea of using the "Active" text for investments which can be
selected during the selection phase and voted during the final voting is
experimental. Right now, for simplicity, since we assume filters will
always use the same text, we're removing the "Active" filter when the
budget is finished, since having both "Winners" and "Active" filters
would be confusing.
2021-11-16 19:18:25 +01:00
Senén Rodero Rodríguez
652f85cba3 Update spec expectations to avoid flake specs
The last expectation we were using in this test is satisfied before
going back to the admin stats page, as the campaing2 name is not
present before clicking the `Go back` link. Because of this, the
test could end while the request thrown by the `Go back` link is
not completed yet, which can collide with the following test and
cause a flake spec.
2021-11-16 16:12:05 +01:00
Javi Martín
64892cf3ea Make investment filters less prominent
As mentioned in commit 36d795f69, investment filters aren't that
important; actually, most citizens won't use them at all, and are there
mainly for transparency purposes.

So we're moving them to the bottom of the sidebar, just like the links
for selected/archived/retired proposals in the proposals section.
2021-11-16 14:50:08 +01:00
Javi Martín
6eddf5d395 Merge pull request #3855 from consul/rubocop_open
Add Security/Open rubocop rule
2021-11-16 12:55:43 +01:00
Javi Martín
dc87f9d69a Add Security/Open rubocop rule
The `open` method can be used to open files or URLs and it's deprecated
in Ruby 2.7. In this case, it's clear we're dealing with a URL, so we
can use `URI.parse`.

The code was a bit strange, since it returned a value and had a side
effect: opening the URL. I'm not sure about the intention of the code;
my best guess is we wanted to test the URL exists and was accessible
before returning it (and, if that's the case, IMHO the code should be a
bit more explicit in order to show the intention behind it), but it
could also be an unintended side effect which was there by accident.

Now the URL is no longer opened; if the URL isn't accessible, we'll find
out when trying to connect to it with the Savon client.
2021-11-16 12:37:32 +01:00
Javi Martín
5519518cfb Parse cached attachment URLs with remote storages
In commit 5a4921a1a we replaced `URI.parse` with `URI.open` due to some
issues during our tests with S3.

However, there are some security issues with `URI.open` [1], since it
might allow some users to execute code on the server.

So we're using `URI.parse#open` instead.

[1] https://docs.rubocop.org/rubocop/cops_security.html#securityopen
2021-11-16 12:37:32 +01:00
Javi Martín
e5fbd34eac Extract method to check for a filesystem storage
We'll use this method to write a test dealing with remote storages.
2021-11-16 12:37:14 +01:00
Javi Martín
b548e16ba0 Merge pull request #4735 from consul/rubocop_offenses_1.4
Fix Rubocop convention offenses
2021-11-16 12:36:47 +01:00
Senén Rodero Rodríguez
d9e3ff42ac Update translations from Crowdin 2021-11-15 11:54:26 +01:00
Senén Rodero Rodríguez
e119870e9d Fix typo at source string
Thanks to chkoun.
2021-11-12 13:05:38 +01:00
Senén Rodero Rodríguez
2ccc3d1cac Replace wrong word with the correct one
When referring to budget we use the word headings instead of headers.
2021-11-11 10:45:26 +01:00
Javi Martín
c2410cb461 Fix RSpec/LetSetup Rubocop offense
It was accidentally introduced in commit 756a16f67. Pronto didn't warn
us because in that commit we deleted the code where the `group` method
was used.
2021-11-10 19:50:43 +01:00
Javi Martín
28ee026951 Fix Layout/EmptyLines Rubocop offense
It was accidentally introduced in commit 2b709f1a3. Pronto didn't warn
us because the blank lines were together after removing the blank lines
between them.
2021-11-10 19:50:06 +01:00
Senén Rodero
b0af76efdb Merge pull request #4711 from consul/typos
Fix typos in budget administration texts
2021-11-10 18:39:30 +01:00
Javi Martín
5a9d4aa2f7 Merge pull request #4732 from consul/fix_mobile_investment_layout
Fix investment list layout on small/medium screens
2021-11-09 14:14:14 +01:00
Javi Martín
a8ff04d9b7 Fix investments list layout on small screens
The flex layout didn't work well on small screens, since there was
barely any space for the elements.
2021-11-09 12:27:11 +01:00
Javi Martín
e54b6b3d97 Increase investments width in management section
I'm not sure whether it now looks worse on extra large screens, but I'm
positive it looks much better on medium and large screens, particularly
when investments have images.
2021-11-09 01:36:19 +01:00
Javi Martín
8ec77723ed Use buttons instead of inputs to remove supports
We're starting to use buttons instead of submit inputs where possible
because buttons are easier to style; for instance, buttons allow
pseudoelements. Rails has also changed the `button_to` helper to always
generate a <button> tag in recent versions [1].

In this case, buttons get on better with flex layouts, since by default
some browsers display submit inputs with `white-space: pre`, meaning
some of the text isn't visible on small screens.

[1] See pull request 40747 in https://github.com/rails/rails
2021-11-09 01:35:39 +01:00
Javi Martín
0aa040409d Merge pull request #4730 from consul/budgets_remove_supports
Add setting to allow removing investments supports
2021-11-08 11:41:01 +01:00
decabeza
9979b53994 Add setting to allow remove investments supports 2021-11-08 01:37:41 +01:00
decabeza
1a73b20d9b Fix supported investments layout 2021-11-08 01:15:13 +01:00
Javi Martín
a08886fcf4 Remove obsolete investment-projects-list selector
It isn't used since we deleted spending proposals in commit d0b8fef6b.
2021-11-08 01:14:58 +01:00
raoulkramer
d9bca5ea5d Remove a potentially pre-existing server.pid in entrypoint.sh (Merge pull request #4684)
With this solution we don't need to amend the docker-compose.yml file.
2021-11-06 01:34:42 +01:00
Javi Martín
54f234b876 Merge pull request #4726 from consul/translate_budget_links
Translate budget and budget phase main link url
2021-11-05 19:39:39 +01:00
Javi Martín
048458dce8 Use hints instead of placeholders in URL fields
Placeholders are hard to read due to their low contrast, and users might
want to read them after they're already gone, and so they cause both
accessibility and usability issues.
2021-11-05 16:40:36 +01:00
Javi Martín
3a704005b0 Remove duplicate translation keys for example URLs
They were accidentally introduced in commit db9ac79e0.
2021-11-05 16:40:36 +01:00
Senén Rodero Rodríguez
7ad838c57d Translate budget and budget phase main link url 2021-11-05 16:40:36 +01:00
Senén Rodero Rodríguez
30afb64bac Do not consider attributes using the :unless option as required
Remove some of the factories introduced in commit 66334b5 as now we do
not need them anymore.

Co-Authored-By: Javi Martín <35156+javierm@users.noreply.github.com>
2021-11-05 16:40:36 +01:00
Javi Martín
d1a5bdb949 Merge pull request #4725 from consul/sdg_icons_croatian
Add SDG icons in Croatian
2021-11-05 16:19:11 +01:00
Sebastia
96a3522e10 Merge pull request #4729 from consul/update-deploy-secrets-example
Add consistency between deploy-secrets and installer
2021-11-05 15:50:27 +01:00
taitus
6543009942 Add consistency between deploy-secrets and installer
The installer creates the application in the following path:
home_dir: "/home/{{{ deploy_user }}"

We update the variable "deploy_to" in the deploy-secrets
file to be consistent with the installer.

While we are modifying the file we also update the "user"
variable in staging and preproduction sections with the
installer default value: "deploy_user: deploy" the same as
we already have in the production section.
2021-11-05 12:39:47 +01:00
Sebastia
edbe412837 Merge pull request #4727 from consul/unify-spec-components-expectations
Unify spec components expectations
2021-11-04 13:11:05 +01:00
taitus
934ce21871 Allow passing :with argument to :be_rendered
We need it in order to check the rendered content.
2021-11-04 10:49:36 +01:00
taitus
612872ac7a Define and apply matcher :be_rendered
Add this changes to make components specs clear
2021-11-04 10:49:36 +01:00
taitus
2b35144540 Unify expectations on spec components folder
In this PR (https://github.com/consul/consul/pull/4683) a new syntax was introduced
in the component specs to check that the component was not rendering.
It seems interesting to add this syntax to the rest of the cases and thus unify the way
we check that a component is not rendering.
2021-11-04 10:49:36 +01:00
Javi Martín
21170d0f24 Merge pull request #4721 from consul/sass_warning
Fix Sass deprecation warning
2021-11-03 11:38:35 +01:00
Javi Martín
9e1f28e64e Merge pull request #4718 from consul/single_heading_links
Simplify navigation in single heading budgets
2021-11-03 11:38:12 +01:00
Javi Martín
281bc6dbe9 Add SDG icons in Croatian
The icons have been obtained thanks to one of the SDG ambassadors in
Croatia and the Centar Društvenih Inovacija [1].

[1] https://cdi.hr/
2021-11-02 16:26:25 +01:00
Javi Martín
caebaac1cc Fix investments link in single heading budgets
The link to "See all investments" didn't have the `heading_id`
parameter, which resulted in the ballot information not being displayed
when in the voting phase.

We could modify the link to include the `heading_id` parameter, but IMHO
it's more robust to select the heading automatically when there's only
one heading. That way manually accessing the page without a `heading_id`
parameter will still work as if the heading had been selected.
2021-10-29 15:23:23 +02:00
Javi Martín
f669b476f8 Go to investments list from a single heading group
There's no real point in linking to a page offering users to choose a
heading when there's only one heading to choose.

So we're linking to the investments index instead.
2021-10-29 15:23:22 +02:00
Javi Martín
9f94e95689 Extract methods in ballot component
Assigning variables in the view makes the code harder to read.
2021-10-29 15:23:22 +02:00
Javi Martín
4243de3062 Move ballot partial to a component
This way it'll be easier to extract methods from its code and modify
them.
2021-10-29 15:23:22 +02:00
Javi Martín
19d7e923b4 Merge pull request #4717 from consul/investment_filters_selector
Move investments filters to the sidebar
2021-10-29 15:22:48 +02:00
Javi Martín
756a16f67a Remove investment filters in groups
The interface was a bit confusing, since after clicking on "See
unfeasible investments" (or similar), we were on a page where no
investments were shown.

Besides, since commit 7e3dd47d5, the group page is only linked from the
"my ballot" page, through a link inviting the user to vote in that
group, and it's only possible to vote selected investments (which is the
default filter during the final voting phase).

The only reason we had these links here was these links weren't present
in the investments page. But they're present there since commit
04605d5d5, so we don't need them in the group page anymore.
2021-10-29 15:01:40 +02:00
Javi Martín
28a7aea1c0 Don't show investment filters before valuation
Before the "valuating" phase, all investments have undecided feasibility
and none have been selected, so the filters would return no results
(except the "not_unfeasible" one, which would return everything).
2021-10-29 15:01:37 +02:00
Javi Martín
56ac154d1f Add feasible investments filter again
We removed it in commit c322b2c4a because it was hard to know the
difference between "Feasible" and "Not unfeasible". We're renaming the
"Not unfeasible" filter instead.

We're also moving the "selected" filter so it appears before the
"unselected" filter, just like the "feasible" filter appears before the
"unfeasible" filter.
2021-10-29 14:53:33 +02:00
Javi Martín
1bfcfca2e2 Move method to get available filters to the model
We're naming the method `investments_filters`, with the word
"investments" in plural, to be consistent with the method
`investments_orders`.
2021-10-29 14:53:33 +02:00
Javi Martín
36d795f69c Move investment filters to the sidebar
As mentioned in commit bc0f04075, a <select> field which submits its
form on change causes many accessibility and usability issues. In this
case there was also an incompatibility with the advanced search filter
which caused a bug solved in commit 541a5fa89.

So the question is where to position the filters and how to display
them. One factor to take into the account is how relevant these filters
are, particularly compared to the links to select the prefered order,
since we don't usually give users the choice of both filters and orders.

Our filters don't really make sense until the valuation phase starts,
since before that phase investments aren't selected nor their
feasibility is decided.

After that phase, the only phase where citizens are really involved
is the final voting; the rest of the phases are done by valuators and
administrators. In the final voting, citizens can only vote on selected
projects, and that's the default filter during that phase.

So these filters are mainly there for information purposes, and not to
help citizens in the phases where they're actually involved (accepting
projects, selecting projects and balloting).

Orders, on the other hand, play a crucial role during the final voting
phase. Since citizens might have already voted for a few projects and
have, let's say, 100,000€ left, ordering by price allows them to find
which projects are within their remaining budget.

In conclusion, orders are more important than filters, and so they
should have a more prominent place.

For consistency with the proposals section, where we've got some links
in the sidebar (bottom part of the page on small screens) providing a
similar funcionality, like accessing selected proposals or archived or
retired proposals, we're moving the investments filters to the sidebar
(bottom part of the page on small screens) as well.
2021-10-29 14:53:33 +02:00
Javi Martín
57e727ba60 Fix invalid HTML in investments sidebar
A <div> can't be a direct child of a <ul>. In this case the <ul> tag
didn't make much sense because there isn't a list; just a map.

Note the `z-index` rule which was added in commit 25e1afea48 is ignored
because the map element is statically positioned. I'm not sure why it
was added; can't reproduce the rendering problem both that commit and
commit c5a749212 mention. Maybe back then the element had a `position:
relative` rule or similar somewhere.
2021-10-29 14:53:30 +02:00