Commit Graph

60 Commits

Author SHA1 Message Date
e68c1d5ba5 DEV: Use key over the deprecated keyCode (#13795)
Makes the code a bit more readable. Inspired by https://github.com/emberjs/ember.js/pull/19185
2021-08-09 11:41:36 +02:00
573a71fdd9 DEV: Do not skip pages when loading polls (#13649)
In some conditions, pages were skipped. This was implemented in the past
in f490a8d, but then reverted in 04ec543, because sometimes it was stuck
reloading the first page.

The code that loads more results was simplified and a lot of duplicate
code was removed. The logic to remove users who changed their vote was
also introduced again, but just for the regular polls.
2021-07-07 13:06:08 +03:00
04ec5439f3 FIX: Poll wasn't showing all voters (#13620)
Partially revert f490a8d39a12ed2c6b125b3380f08b2d1d43ee7f because we aren't able to
load more than the initially preloaded voters.

We were always trying to load the 1st page of voters.

Also removed the "remove users who changed their vote" logic as it was not properly working in multiple choices polls.

cc @nbianca
2021-07-05 13:52:17 +03:00
f490a8d39a FIX: Do not display twice a user who changed vote (#13284)
* FIX: Fetch last page again if incomplete

The next fetched page number used to increase continuously even if the
last page was incomplete and fetching it again could have new voters.

* FIX: Do not display twice a user who changed vote

A user could appear under two voting options when they changed their
vote because pressing the Load More Voters button updated only the
current option.
2021-06-18 18:56:54 +03:00
8e1448487f FIX: Make poll options tabbable (#13159) 2021-05-26 20:45:10 +03:00
5d8673321f DEV: Add poll:voted event (#12070) 2021-02-12 13:06:27 -05:00
c6a1042950 DEV: prettier 2.2.1 (#11862) 2021-01-27 12:39:20 +01:00
bbe5d8d5cf DEV: Sort imports alphabetically (#11382) 2020-12-01 15:31:26 -03:00
690a38bc9b FIX: Show title on results of all poll types (#11041)
Previously, the title was shown only with pie chart results. Issue originally reported in https://meta.discourse.org/t/keep-the-heading-visible-when-showing-poll-results/167585

Also includes:
UX: Move the "Show breakdown" button (Display it with other poll buttons at the bottom)
FIX: Show the breakdown button only on any votes
2020-10-27 13:48:54 +01:00
34c99da205 FIX: Correctly render title-less poll widgets (#10837)
`RawHtml` does not like receiving undefined values as `html`.
2020-10-06 19:27:03 +02:00
babbebfb35 FEATURE: Add the title attribute to polls (#10759)
Adds an optional title attribute to polls. The rationale for this addition is that polls themselves didn't contain context/question and relied on post body to explain them. That context wasn't always obvious (e.g. when there are multiple polls in a single post) or available (e.g. when you display the poll breakdown - you see the answers, but not the question)

As a side note, here's a word on how the poll plugin works:

> We have a markdown poll renderer, which we use in the builder UI and the composer preview, but… when you submit a post, raw markdown is cooked into html (twice), then we extract data from the generated html and save it to the database. When it's render time, we first display the cooked html poll, and then extract some data from that html, get the data from the post's JSON (and identify that poll using the extracted html stuff) to then render the poll using widgets and the JSON data.
2020-10-02 09:21:24 +02:00
530d9ab071 DEV: enforces eslint’s curly rule to the codebase (#10720)
eslint --fix is capable of fix it automatically for you, ensure prettier is run after eslint as eslint --fix could leave the code in an invalid prettier state.
2020-09-22 16:28:28 +02:00
bf88410126 DEV: apply coding standards to plugins (#10594) 2020-09-04 13:51:53 +02:00
2d56663fc4 REFACTOR: Remove _.clone which is not deep 2020-09-03 10:03:33 -04:00
cd4f251891 FEATURE: Poll breakdown 2.0 (#10345)
The poll breakdown modal replaces the grouped pie charts feature.

Includes:

* MODAL: Untangle `onSelectPanel`
Previously modal-tab component would call on click the onSelectPanel callback with itself (modal-tab) as `this` which severely limited its usefulness. Now showModal binds the callback to its controller.

"The PR includes a fix/change to d-modal (b7f6ec6) that hasn't been extracted to a separate PR because it's not currently possible to test a change like this in abstract, i.e. with dynamically created controllers/components in tests. The percentage/count toggle test for the poll breakdown feature is essentially a test for that d-modal modification."
2020-08-06 17:57:06 +02:00
26260d50b1 DEV: Import I18n in standard plugins (#10098) 2020-06-22 02:36:45 +02:00
029d091ea8 FIX: displays poll's close date in local time (#9656) 2020-05-06 22:18:47 +02:00
330102fd20 FEATURE: Show votes in an "on voted" poll to the creator
This required properly plumbing the guardian into the serializer.

Notably, the default state in the client was not changed - if you haven't voted in
the poll, you need to click the button to view the results instead of the results
being immediately visible on page load.

Implements https://meta.discourse.org/t/-/138108
2020-03-20 13:36:42 -07:00
763a065df9 FIX: Correctly format select options for group poll by fields (#9131) 2020-03-06 12:58:59 -06:00
59db2811b0 FIX: Disable poll options if user groups do not allow them (#8987) 2020-02-18 12:13:19 +02:00
0772a4338b FIX: Remove pie draw animation (#8940) 2020-02-12 07:09:40 -08:00
daaa0a657f FIX: Render HTML for pie chart options (#8912) 2020-02-11 10:02:54 -06:00
07222af7ab FEATURE: Add 'groups' option to polls (#8469)
This options can be used to restrict polls to certain groups.
2020-01-28 14:30:04 +02:00
dbee72e92b FIX: Export poll UI should only show for admins 2019-12-05 17:03:06 -03:00
118fef2353 FIX: Hide pie legend when results are grouped (#8445) 2019-12-02 13:59:52 -06:00
0807751390 REFACTOR: poll-pie-chart widget (#8415)
This commit mostly get rid of the later() call and encapsulate all pie chart display logic inside discourse-poll-pie-canvas widget instead of sharing it between discourse-poll-pie-chart and discourse-poll-pie-canvas
2019-11-27 00:10:43 +01:00
b92a8131c0 FEATURE: Pie chart option for poll results (#8352) 2019-11-25 11:51:01 -06:00
fd0025a735 FEATURE: Add export poll button (#8370)
This PR aims to make poll results easily exportable to staff in a CSV format, so they can be analyzed in external software.

It also makes the export data easily customizable by allowing users to leverage any data explorer query to generate the report. By default, we use a query that ships with data explorer, but user can change the ID in settings or use 0 to disable this feature.

One potential upgrade is using the recent work that allows arbitrary group to run data explorer and allow all the groups with access to the configured query to also export polls, but that can be added later.

Co-Authored-By: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2019-11-22 16:06:39 -03:00
096f932ef2 Lint files
Both needed some prettier tlc
2019-08-16 13:06:51 +10:00
69498a58e9 FEATURE: Staff only poll results (#7984)
* FEATURE: Staff only poll results

These changes allow only staff to see the results of a poll.

Non-staff users will be shown a screen like this:

1b8bd76013.png

The "Votes are public" message has been removed from the info section,
and the button to show the votes has been replaced with a message
stating the results will only be shown to staff.

* Update PR based on feedback

* Update plugins/poll/app/models/poll.rb

make sure we return a boolean

Co-Authored-By: Régis Hanol <regis@hanol.fr>
2019-08-15 12:27:18 -06:00
1d784c7a18 FEATURE: adds support for dates in polls (#7450) 2019-04-29 10:01:19 +02:00
3cf922a58a FIX: URL to user profile in poll results. (#7315) 2019-04-03 22:17:05 +02:00
be5e889b1b UX: Poll style fix, button classes 2019-03-06 20:27:40 -05:00
0a708ba064 FIX: preload poll voters 2019-02-27 17:00:21 +01:00
cba6bdaf52 UX: use solid circle to indicate selected option in polls 2019-01-24 12:25:37 +01:00
d589c66f3e FIX: Fix URL to user profile. (#6881) 2019-01-23 18:27:21 +01:00
80d42b4ea2 icons deprecations fixes (#6920) 2019-01-22 12:02:02 +01:00
e49bcebb35 FIX: Validate poll arguments. (#6740)
* FIX: Validate number poll.
* FEATURE: Poll's min can be 0.
* FIX: Fix URL to user profile.
2018-12-31 10:48:30 +01:00
285ff3bfbd FIX: Show every voter only once. (#6746)
Each voter is represented by an object and Set does not properly check for equality.
2018-12-11 14:00:28 +01:00
03deda2147 Upgrade to FontAwesome 5 (take two) (#6673)
* Add missing icons to set

* Revert FA5 revert

 This reverts commit 42572ff

* use new SVG syntax in locales

* Noscript page changes (remove login button, center "powered by" footer text)

* Cast wider net for SVG icons in settings

- include any _icon setting for SVG registry (offers better support for plugin settings)

- let themes store multiple pipe-delimited icons in a setting

- also replaces broken onebox image icon with SVG reference in cooked post processor

* interpolate icons in locales

* Fix composer whisper icon alignment

* Add support for stacked icons

* SECURITY: enforce hostname to match discourse hostname

This ensures that the hostname rails uses for various helpers always matches
the Discourse hostname

* load SVG sprite with pre-initializers

* FIX: enable caching on SVG sprites

* PERF: use JSONP for SVG sprites so they are served from CDN

This avoids needing to deal with CORS for loading of the SVG

Note, added the svg- prefix to the filename so we can quickly tell in
dev tools what the file is

* Add missing SVG sprite JSONP script to CSP

* Upgrade to FA 5.5.0

* Add support for all FA4.7 icons

- adds complete frontend and backend for renamed FA4.7 icons

- improves performance of SvgSprite.bundle and SvgSprite.all_icons

* Fix group avatar flair preview

- adds an endpoint at /svg-sprites/search/:keyword

- adds frontend ajax call that pulls icon in avatar flair preview even when it is not in subset

* Remove FA 4.7 font files
2018-11-26 16:49:57 -05:00
95d8a421be fixes linting 2018-11-19 16:29:15 +01:00
4459665dee REFACTOR: use tables instead of custom fields for polls (#6359)
Co-authored-by: Guo Xiang Tan <tgx_world@hotmail.com>
2018-11-19 14:50:00 +01:00
Sam
42572ff138 Revert font awesome 5 changes
We are still pushing ahead on this 100% just need a bit longer to prepare
all plugins
2018-11-08 16:12:18 +11:00
005e1ecb9b FEATURE: Update Font Awesome to v5.4.1 and SVGs (#6557)
* First take on subsetting svg icons

* FontAwesome 5 svg subset WIP

* Include icons from plugins/badges into svg sprite subset

* add svg icon support to themes

* Add spec for SvgSprite

* Misc. SVG icon fixes

* Use FA5 svgs in local-dates plugin

* CSS adjustments, fix SVG icons in group flair

* Use SVG icons in poll plugin

* Add SVG icons to /wizard
2018-11-07 13:05:43 -05:00
60ff0e9b8c missing prettified files 2018-06-15 18:42:20 +02:00
5d445fb810 FIX: properly handle invalid auto close date for polls 2018-06-12 15:31:09 +02:00
ef87944a34 UX: show close date on automatically closed polls 2018-05-12 02:14:58 +02:00
ba14c80b9c FEATURE: automatically close a poll on a given date and time 2018-05-03 02:12:19 +02:00
c8a6e5cbb3 If there is a specific error it should be shown to the user (#5323)
e.g. post_is_deleted, or topic_must_be_open_to_vote
2017-11-17 12:12:13 +01:00
e87125b63c FEATURE: Plugins can overwrite and add support for new icons 2017-07-26 13:21:17 -04:00