Commit Graph

289 Commits

Author SHA1 Message Date
Javi Martín
cf9e36c767 Replace single quotes with double quotes
Most of these quotes were in the dashboard branch before we added the
rule for double quotes.
2019-09-10 19:21:03 +02:00
Javi Martín
911fe4e481 Simplify calls to render partial
We're also adding a bit of consistency, since most of our calls to
partial rendering omit the `partial` and `locals` keys.
2019-09-04 15:00:36 +02:00
Javi Martín
06be5e132f Fix label in form to add own answer
The label text was always in English, and it wasn't associated with any
input field.

The `SecureRandom` part is a quick hack so we don't get duplicate IDs.
Using "your_answer_#{question.id}" might work as well, but right now I'm
not sure if the form is sometimes rendered twice for the same question.
2019-08-27 17:22:22 +02:00
lalo
c6e4b2480f Add public changes to create and vote Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
decabeza
585f9ea5ab Remove token on views temporally 2019-05-29 15:49:28 +02:00
Javi Martín
45a3d8daf0 Add option to enable advanced stats 2019-05-22 11:50:03 +02:00
Javi Martín
a34b97e843 Extract partials to show advanced stats 2019-05-22 11:50:03 +02:00
Javi Martín
2d29243a9e Simplify code to link to a poll with one question 2019-05-22 11:49:35 +02:00
Javi Martín
5ca528d2ce Extract method to link to a poll 2019-05-21 17:30:46 +02:00
Javi Martín
e146fafb60 Only show "no demographic data" when necessary
If there's demographic data for all participants, it doesn't make sense
to show the message.

We're using translations instead of an `if` in the view because the text
is also different when there's only one participant. In some languages
the text might also be different depending on how many people with no
demographic data participated.

Another possibility would be to use an `if` in the view so we don't
display an empty paragraph when the cont is zero, and then using
translation for `one` and `other`. I haven't gone that way because I
thought the logic would be more complex and the benefits wouldn't be
that great.
2019-05-21 13:50:18 +02:00
Javi Martín
ae4cd06c24 Include no geozone in no demographic data 2019-05-21 13:50:18 +02:00
Javi Martín
6b0b9db969 Display only poll stats for used channels
So if there's no vote using by mail (which is the case in some places),
no stats related to voting via mail are displayed.
2019-05-21 13:50:18 +02:00
Javi Martín
793bfed372 Display only existing stats
So if we don't have information regarding gender, age or geozone, stats
regarding those topics will not be shown.

Note we're using `spec/models/statisticable_spec.rb` because having the
same file in `spec/models/concerns` caused the tests to be executed
twice.

Also note the implementation behind the `gender?`, `age?` and `geozone?`
methods is a bit primitive. We might need to make it more robust in the
future.
2019-05-21 13:50:18 +02:00
Javi Martín
76c7827cf4 Use stats objects instead of hashes
It will make it far easier to call other methods on the stats object,
and we're already caching the methods.

We had to remove the view fragment caching because the stats object
isn't as easy to cache. The good thing about it is the view will
automatically be updated when we change logic regarding which stats to
show, and the methods taking long to execute are cached in the model.
2019-05-21 13:50:18 +02:00
Javi Martín
e3063cd24f Remove complex poll stats
For now we think showing them would be showing too much data and it
would be a bit confusing.

I've been tempted to just remove the view and keep the methods in the
model in case they're used by other institutions using CONSUL. However,
it's probably better to wait until we're asked to re-implement them, and
in the meantime we don't maintain code nobody uses. The code wasn't that
great to start with (I know it because I wrote it).
2019-05-21 13:50:17 +02:00
decabeza
6410d4c3e5 Replace data equalizer with css
Data equalizer was used to show a border to separate sidebar from the content. Now is the same with only css avoiding use js.
2019-05-21 13:50:17 +02:00
Javi Martín
8f69113233 Add poll stats by geozone and channel 2019-05-21 13:50:17 +02:00
Javi Martín
202fb44008 Add poll stats by age and channel 2019-05-21 13:50:17 +02:00
Javi Martín
7b408a4b88 Add poll stats by gender and channel 2019-05-21 13:50:17 +02:00
Javi Martín
553af8e95b Add poll stats by channel
Note we currently don't have a way to get the votes by mail, so that
section is always blank.
2019-05-21 13:50:17 +02:00
Javi Martín
8f0bccf5b3 Add mail votes stub to poll stats
So far we don't know about implemenation details.
2019-05-21 13:50:16 +02:00
Javi Martín
a9bb3eba26 Add headings for advanced statistics 2019-05-21 13:50:16 +02:00
decabeza
70dbbbd1b9 Add stack class to polls stats table
This class improve tables layout on mobile screen sizes.
2019-05-21 13:50:16 +02:00
decabeza
1975b6ae7c Remove sticky on polls stats links 2019-05-21 13:50:16 +02:00
Javi Martín
573e04ef8f Move common stats to partials 2019-05-21 13:50:16 +02:00
decabeza
b91b766e96 Adds styles and updates html markup to stats 2019-05-21 13:50:16 +02:00
Javi Martín
7ce57f649f Use a <meter> tag to display age percentages 2019-05-21 13:50:16 +02:00
Javi Martín
1a1ca13525 Add age stats to polls 2019-05-21 13:50:15 +02:00
Javi Martín
be68c8cdbf Add gender stats to polls 2019-05-21 13:50:15 +02:00
Javi Martín
80486b8193 Use section tags in stats
This way we can easily see the h3 tag's parent is the h2 tag.
2019-05-21 13:50:15 +02:00
Javi Martín
5a3eb70a46 Use same translations for poll and budget stats 2019-05-21 13:50:15 +02:00
Javi Martín
afa8bf8dba Add basic headings and navigaton styles for stats 2019-05-21 13:50:15 +02:00
Javi Martín
1a86f7dbe8 Simplify total participants view logic 2019-05-21 13:49:42 +02:00
Bertocq
b8dbdaf9a7 Move question most voted answer from boolean to a enumerable max by total_votes 2019-05-21 13:26:44 +02:00
decabeza
607b2362a3 adds missing id 2019-05-21 13:26:44 +02:00
Javi Martín
e461c8d0ac Generate navigation links for polls without a slug 2019-05-21 13:04:26 +02:00
Bertocq
65fd88ef32 Use poll slug on stats and results paths 2019-05-17 05:41:09 +02:00
rgarcia
1af472b795 hotfix for polls without slugs 2019-05-16 23:40:50 +02:00
Bertocq
501fe9b682 Fix poll_path links to adding id param 2019-05-16 23:40:50 +02:00
María Checa
e3b16230e6 Added slug to polls for named urls 2019-05-16 23:40:50 +02:00
decabeza
467d05ab98 Replace poll summary to title on social meta tags 2019-04-24 14:03:39 +02:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +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
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
decabeza
88cae1424e Add missing mobile social share message 2019-03-14 11:32:14 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
decabeza
bc1679550b Remove incoming polls filter 2019-02-08 14:28:19 +01:00
decabeza
4498c26ff7 Create helper for active menus and show stats or results on poll subnav 2019-01-24 14:44:11 +01:00
decabeza
62088bc635 Hide poll results and stats to admins 2019-01-24 14:33:41 +01:00