Commit Graph

47 Commits

Author SHA1 Message Date
Ziyan Junaideen
1e3e8c1304 Add approval voting to budgets
Co-Authored-By: Javi Martín <javim@elretirao.net>
2020-08-06 12:38:18 +02:00
Javi Martín
82ef5149c5 Remove redundant progress bar
We were displaying two progress bars for the same thing, and hiding one
of them.

Displaying just one of them and readjusting the styles accordingly is a
bit more intuitive IMHO.

We're also getting the text inside the progress bar out of it; its
purpose inside an element with the `progressbar` role is to provide the
same information as the progress bar (which we aren't exactly doing,
although it could be argued that we do), and in order to be accessible
we should provide the same text in the `aria-valuetext` field, which we
aren't doing. This also simplifies our CSS, which was working because we
defined a padding which covered the height of the hidden extra progress
bar and would have needed quite a few changes if we kept just one
progress bar with text inside it. We can also remove a few CSS rules
which we added to override foundation's rules for the
`progress-meter-text` class.
2020-07-30 16:20:00 +02:00
Javi Martín
2216cb91d1 Use local variables in progress bar partial
We were even passing the `ballot` local variable in some places, which
was ignored because we were using instace variables.
2020-07-30 16:20:00 +02:00
Javi Martín
8edcbcfd3b Fix aria-valuenow attibute in ballot progress bar
We were setting it to 0, and so screen reader users might be confused by
it.

The easiest way to reuse the code and using it for both this attribute
and the width of the progress bar is to move this method to the voting
style, just like the other methods used in this view.

Note the progressbar ARIA role might not be right, since this isn't a
task which is "progressing", but an indicator of the amount spent and
amount available, which is exactly what the <meter> HTML5 tag was
designed for.

We might use a <meter> tag in the future. For now, I'm leaving it as it
is because I'm not certain about how well <meter> is supported in
accessibility tools, and because it's definitely not supported in
Internet Explorer 11, which we haven't officially dropped support for.
2020-07-30 16:20:00 +02:00
Javi Martín
ceee25fdc9 Don't re-render the ballot twice
We were rendering an individual ballot, and then rendering all ballots
(including the already rendered one). So we can skip the first part, as
pointed out by microweb10 in the comments of pull request 3036.
2020-07-30 16:20:00 +02:00
Javi Martín
5f726df8be Extract methods showing voting style information
The idea is that different voting styles will display different
information messages.
2020-07-30 16:19:58 +02:00
Javi Martín
ad6d830c1f Make translations more consistent
We're passing the amount as a paramenter to the "remaining" text, so it
makes sense to pass it to the "amount spent" text as well.

Here we're also changing the I18n key to the text saying users can
change their vote, so it's easier to note the text is about changing
their vote, and not about the projects they have voted so far.
2020-07-28 13:06:31 +02:00
Javi Martín
c22e800329 Remove code duplication
We were calling the same method three times.
2020-07-28 13:06:31 +02:00
Javi Martín
a32c0f8154 Remove unused parameter
The `refresh_ballots` partial ignores the `investment` parameter
completely; instead, it iterates over the investments in the
`@investments` instance variable.
2020-07-28 13:06:31 +02:00
Javi Martín
27468b0b7b Use relative URLs where possible
In general, we always use relative URLs (using `_path`), but sometimes
we were accidentally using absolute URLs (using `_url`). It's been
reported i might cause some isuses if accepting both HTTP and HTTPS
connections, although we've never seen the case.

In any case, this change makes the code more consistent and makes the
generated HTML cleaner.
2019-10-20 17:26:14 +02:00
Javi Martín
6b1864fbcd Sanitize translations instead of using _html
Using the `_html` suffix in an i18n key is the same as using `html_safe`
on it, which means that translation could potentially be used for XSS
attacks.
2019-10-09 19:46:47 +02:00
Javi Martín
61bf9a5c73 Use sanitize instead of html_safe
The difference is `html_safe` allows every HTML tag, including the
`<script>` tag, while `sanitize` only allows tags which are considered
safe. In this case, we want to allow a `<span>` tag in a translation,
and links inside flash messages.
2019-10-08 18:46:21 +02:00
Javi Martín
55a190f44a Remove unneeded _html suffix in I18n keys
This suffix does the same thing as calling `.html_safe` on them. So we
don't need to use it in texts that don't use HTML.
2019-10-08 13:20:22 +02:00
voodoorai2000
a932737881 Delete ballots 2019-05-31 15:43:06 +02:00
decabeza
d7bde5818e Update texts on check my ballot links 2019-03-28 17:16:15 +01:00
Javi Martín
3e4e65ead7 Use double quotes inside ERB
We were using single quotes inside ERB code when that code was inside
HTML double quotes.
2019-03-25 14:58:54 +01:00
Julian Herrero
c87267d34f Use double quotes in app/views/budgets 2019-03-19 12:16:50 +01:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Julian Herrero
25e1afea48 fix map rendering for budget headings 2018-12-14 15:37:22 +01:00
decabeza
3c8ec4169f improves messages on header 2018-01-09 19:29:36 +01:00
decabeza
3bcfaeb61a replaces sr-only class to show-for-sr 2017-06-13 17:51:57 +02:00
decabeza
cd4d37470b removes bold on links and make consistent text 2017-05-11 17:24:39 +02:00
decabeza
57d5e40fbb improves ballot list on sidebar 2017-05-11 13:12:26 +02:00
Juanjo Bazán
fce60b9d9a changes heading amount info into a link in ballot view 2017-05-09 13:14:03 +02:00
Juanjo Bazán
4ae6ec75e7 adds links in ballot view to no voted groups 2017-05-09 11:27:07 +02:00
Alberto Garcia Cabeza
c0afb94cfa improves ballot page when shows several groups 2017-05-08 14:33:07 +02:00
Raimond Garcia
aa43d43b73 Merge pull request #1525 from consul/ballot-reviewing
Display correct heading name when reviewing ballot
2017-05-08 13:50:18 +02:00
Juanjo Bazán
216b60f22e orders groups in ballot view 2017-05-08 13:27:17 +02:00
Juanjo Bazán
39ed526b89 displays correct heading name when reviewing ballot 2017-05-08 13:22:53 +02:00
rgarcia
8e7ca16c47 makes ballot's back link point to referer 2017-05-05 20:07:24 +02:00
rgarcia
b84ec0857c fixes specs 2017-01-09 11:02:15 +01:00
kikito
b7a0aa3b57 Fixes i18n errors now that they are detected by i18n-tasks 2017-01-06 19:55:23 +01:00
Alberto Garcia Cabeza
54691fe7f4 improves styles for budgets ballot 2017-01-05 20:37:34 +01:00
Alberto Garcia Cabeza
f503c492f3 improves styles for budgets investments ballot and votes 2017-01-05 17:43:57 +01:00
kikito
28e6a10382 Hides balloting controls when not in the balloting phase 2017-01-05 15:17:49 +01:00
kikito
bbb8ac830c Fixes erroneous i18n param in view 2016-12-23 18:37:02 +01:00
kikito
eb648b7269 Adds missing parameters to partials 2016-12-22 20:27:01 +01:00
kikito
7acedb30f6 fixes parenthesis 2016-12-22 20:26:39 +01:00
kikito
4434a601d3 Implements several helper methods for formatting amounts 2016-12-14 11:49:16 +01:00
kikito
869f7b39d6 fixes i18n 2016-12-08 11:49:13 +01:00
kikito
e1fcaf66ef Moves ballot/_add and ballot/_remove inside _ballot 2016-12-05 17:32:37 +01:00
kikito
703cc72953 Replace helper function by decorator methods 2016-12-05 17:28:30 +01:00
rgarcia
4ded0350a1 removes investments from sidebar 2016-09-10 16:22:42 +02:00
rgarcia
24740578ff displays money remaining in each group 2016-09-10 16:22:42 +02:00
rgarcia
22373c3ddd Review my votes page 2016-09-10 16:22:41 +02:00
rgarcia
1c8f4d5ff0 can remove investment projects 2016-09-10 16:22:41 +02:00
rgarcia
9839d7afd0 can add investments to ballot 2016-09-10 16:22:40 +02:00