Commit Graph

16247 Commits

Author SHA1 Message Date
Javi Martín
4c23f639be Use heading name as link text
Using the name instead of using the name and the price is IMHO more
consistent with the rest of the application, particularly for screen
reader users. Writing texts clicking those links is also easier.

I think the main reason why we used the price as part of the link was so
the clickable area was bigger. We can accomplish the same result with
CSS.
2021-03-18 13:59:09 +01:00
Javi Martín
f1b707f549 Simplify styling headings with the same height
Using flex we don't have to rely on JavaScript to equalize the item.
Besides, we've had problems with JavaScript in the past.

We're also adjusting the width of the elements; previously, even though
we defined a width of 16.666% for each element, only five elements would
be on the same row. It happenend because these elements were styled with
inline-block and the generated HTML contained a newline character
between <li> tags, meaning a space character was introduced between
elements. The width of the mentioned space character wasn't being taken
into account when calculating the width.

Using flex, there's no space character between items and we have to
define the margin between them. We're taking this margin into account
when calculating the width.
2021-03-18 13:59:09 +01:00
Julian Herrero
16c582f282 Extract component for budget groups and headings 2021-03-18 13:59:09 +01:00
Javi Martín
45135bb87e Merge pull request #4396 from consul/investment_filters
Add filters on budget investments index page
2021-03-17 18:05:11 +01:00
decabeza
8e814557bc Remove heading name on unfeasible list
The heading name is already present on the main heading of the page.
2021-03-17 13:44:02 +01:00
Javi Martín
3509b99ce4 Use different filters on different budget phases
We use the same criteria we use when deciding the default filter.
2021-03-17 13:44:02 +01:00
decabeza
04605d5d5b Add filters on budget investments index page
Now it's easier to change the investments filter. Previously we had to
go back to the budget index page, change the filter there, and then
select one heading.

Now the links to change the current filter in the budget index page
aren't needed anymore.
2021-03-17 13:44:01 +01:00
taitus
485d3f8dea Allow display the budgets created in dev seeds
Since this PR (Refactor participatory budgets in draft mode #4369) budgets
have a new field "published" to manage whether they  are displayed or not. We
update this field in dev_seeds to be able to display budgets on the public page
budgets.
2021-03-17 08:51:58 +01:00
Javi Martín
f5c1cfbf8c Fix group investments filters links
They were pointing to the budget page instead of the budget group page,
which made navigation weird.
2021-03-15 18:14:46 +01:00
Javi Martín
12da0f5293 Remove unused partial
It isn't used since commit 5f7269a07 and it wouldn't work if we used it
because we don't use `params[:unfeasible]` anymore.
2021-03-15 17:42:15 +01:00
Javi Martín
c322b2c4a2 Remove unused investments filter
We weren't using the "Feasible" filter anywhere in the
application, and it's hard for users to know the difference between
"Feasible" and "Not unfeasible".
2021-03-15 15:19:18 +01:00
Julian Herrero
5d38e4702f Adjust default budget filter
Apart from 'balloting', there are more phases between
'publishing_prices' and 'finished'. So, it doesn't make sense that the
filter 'selected' is only applied to those two. With this change the
filter will be applied as follow:

'not_unfeasible' for phases:
- informing
- accepting
- reviewing
- selecting
- valuating

selected for phases:
- publishing_prices
- balloting
- reviewing_ballots

winners for phases:
- finished
2021-03-15 15:19:18 +01:00
Javi Martín
6bd20ef5ff Extract concern to handle investments filters
We were defining the same filters in three different controllers. We
were also adding a method in the ApplicationController which only made
sense in the same three controllers.
2021-03-15 13:31:28 +01:00
Javi Martín
313c9eaeba Merge pull request #4374 from consul/budget_phases
Change budget phases design
2021-03-12 17:10:16 +01:00
Javi Martín
fa7e2fe3dd Use same structure on new and edit budget forms
The margin between the heading and the form was different due to margin
collapsing, which applied in one case but not the other.
2021-03-11 19:37:58 +01:00
Javi Martín
4c02317909 Fix enabled/disabled phase text for screen readers
Since we were using an icon font with no text, screen readers were
announcing things like "Enabled, L", trying to read the icon generated
with CSS.

Using text and replacing it with CSS with an icon solves the problem.

We could also use aria-label, but I prefer using "Yes/No" so the text
can be shown/hidden with CSS. Also useful when using
`save_and_open_page` during tests, since the displayed page will not
have any CSS rules applied.

Out of several existing techniques to hide text [1], we're setting the
font size to 1px in combination with moving the content off-screen
because that way we can override it in the `::before` element.

Just moving the content off-screen has the inconvenient of the content
still being taken into account when calculating the text indentation.

And just using a 1px font would make a 1px-sized square appear when
selecting text, which could confuse users.

[1] https://webaim.org/techniques/css/invisiblecontent/
2021-03-11 19:37:58 +01:00
Javi Martín
1ee70464db Use rem units to define off screen content
Using 10000px means content will be visible on screens with ultra-high
resolution (although I don't think they exist nor will exist anytime
soon).

Having screens in the future with a width of 1000rem is less likely,
since a line with 1000 characters would be pretty much impossible to
read.
2021-03-11 19:37:58 +01:00
Julian Herrero
0f6229cc2f Change phase duration texts 2021-03-11 19:37:58 +01:00
Julian Herrero
d2871d7770 Include duration in budgets table 2021-03-11 19:37:58 +01:00
Javi Martín
fe05bfe9ea Extract admin budgets index to a component
We're going to change it a bit, and using a component allows us to use
the `header` method and easily add a title to this page, which lacked
the `<title>` tag.
2021-03-11 19:37:58 +01:00
Javi Martín
6ae4a1cf09 Unify "current phase" text
We were using "actual phase" and then "current phase" right below it.
2021-03-11 19:37:58 +01:00
Javi Martín
65ecae2c45 Use same subheader on budget show view
There was duplication between the index and the show views, and when we
changed the design of the phases in the index we forgot to change the
subheader in the other page as well.
2021-03-11 19:37:58 +01:00
Javi Martín
4896c754a0 Extract budget subheader to a component 2021-03-11 19:37:58 +01:00
decabeza
d912b80e74 Move phases header close to phases section 2021-03-11 19:37:58 +01:00
Javi Martín
27e1721348 Remove unnecessary HTML classes
There are negative margins on .expanded.budget elements, and so these
rules are redundant.
2021-03-11 19:37:58 +01:00
Javi Martín
1d42fe54f0 Simplify HTML class for budget header
There were some issues using `.budget.expanded`, like a link having that
class which would force us to a `:not(.button)` selector or similar,
making the CSS more complex.
2021-03-11 19:37:58 +01:00
Julian Herrero
909071c48b Allow editing the name of budget phases
Co-authored-by: decabeza <alberto@decabeza.es>
2021-03-11 19:37:58 +01:00
Julian Herrero
d20e521ee9 Display the time a phase ends at in admin section 2021-03-11 19:37:58 +01:00
Javi Martín
b37eaf19c6 Use a time HTML tag to display phases dates
Currently this change is barely beneficial (if at all), but it doesn't
harm and might be useful in some cases. For instance, the `datetime`
attributes generates a date containing time zone information, which the
text shown on the screen does not, and styling dates with CSS is now
easier.
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
Javi Martín
f9ecc583ef Extract methods to show a phase start/end 2021-03-11 19:37:58 +01:00
Javi Martín
cbe3d515b9 Extract file with CSS for budget phases table 2021-03-11 19:37:58 +01:00
Javi Martín
fb5b067d00 Extract phases edition to a component 2021-03-11 19:37:58 +01:00
decabeza
c4e7bf0938 Improve budget phases form layout
Dates are grouped in a fieldset and activating the phase is more
prominent.
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
f35a88cf4f Make finished budgets layout wider 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
014d29b991 Extract method to get a budget phase title 2021-03-09 16:37:47 +01:00
Javi Martín
70cf956210 Extract method to check the current phase 2021-03-09 16:37:47 +01:00
Javi Martín
46e80bf430 Extract budget phases to a component 2021-03-09 16:37:47 +01:00
Javi Martín
4f4b2643a7 Merge pull request #4388 from consul/pronto_progress_bar
Do not require Pronto when running the application
2021-03-09 16:37:24 +01:00
Javi Martín
9f394c6c61 Do not require Pronto when running the application
Pronto is an external tool which is use to check code conventions and is
not needed to run the application, just like rubocop or scss-lint.

Loading it caused a couple of issues. First, it loaded BetterHtml, and
we had to disable it in order to avoid crashes in the development
environment.

Second, it loaded ruby-progressbar, which loads the ProgressBar class,
which conflicts with our own ProgressBar class. This made the
application crash whenever the ProgressBar class was used.
2021-03-09 14:31:37 +01:00
Javi Martín
33089d275a Merge pull request #4385 from consul/pronto_eslint
Remove ESLint rules incompatible with Pronto
2021-03-09 14:04:16 +01:00
Javi Martín
f9d04b07c1 Don't install ESLint for github actions
These lines were added when we were trying the pronto-eslint_npm gem,
which isn't maintained anymore and is not compatible with the latest
Pronto version.

Since we're now using the pronto-eslint gem, and this gem depends on the
eslintrb gem (which includes ESLint), we don't need these lines anymore.
2021-03-08 15:49:13 +01:00
Javi Martín
92813be08e Remove ESLint rules incompatible with Pronto
The pronto-eslint gem depends on the eslintrb gem, which uses a very old
version of ESLint which doesn't support some of the rules we use.

The most useful rules here were no-tabs and func-call-spacing. It's a
shame they were added to ESLint just one month after eslintrb stopped
being maintained.
2021-03-08 15:49:13 +01:00
Javi Martín
c2194aeb1f Merge pull request #4386 from consul/sdg-fieldset-fix
Fixing styles for the related list component
2021-03-08 12:56:29 +01:00
Javi Martín
d1675750b8 Fix a chrome bug in versions lower than 86
https://bugs.chromium.org/p/chromium/issues/detail?id=375693
2021-03-08 10:51:22 +01:00
Javi Martín
79efdc6fd3 Merge pull request #4382 from consul/pronto
Use Pronto to check code conventions
2021-03-04 16:05:41 +01:00
Javi Martín
7c4c6d4ee0 Make ESLint configuration compatible with Pronto
pronto-eslint depends on eslintrb, which expects the `.eslintrc` file
in JSON format. So we're migrating the `.eslintrc.yml` file to JSON and
introducing a symbolic link so the `.eslintrc` file points to
`.eslintrc.json`.

We could also use pronto-eslint_npm, but unfortunately it's not
maintained anymore and the latest version is not compatible with Pronto
0.11.
2021-03-04 13:20:08 +01:00