Commit Graph

241 Commits

Author SHA1 Message Date
Robin Ward f07443b488 Migrate Discourse Polls to use vdom instead of embedded ember 2016-12-09 10:42:56 -05:00
Robin Ward ffae39912f FIX: Remove the old poll view before replacing it 2016-12-02 16:41:51 -05:00
Régis Hanol 28b7ef7142 FIX: rendering multiple polls in the same post was broken 2016-11-30 22:59:58 +01:00
Robin Ward d8a69e6bb2 FIX: Use the register within the poll plugin 2016-11-25 11:58:06 -05:00
Robin Ward 054c428ba3 FIX: Don't modify variables when rendering 2016-11-24 11:34:14 -05:00
Robin Ward 28061316ad Migrate poll plugin to use components 2016-11-21 14:49:46 -05:00
Robin Ward 06254d3163 Remove the last of the `ModalBodyView` uses 2016-11-18 12:13:21 -05:00
Régis Hanol 71fa9541fa Merge pull request #4531 from rizka10/master
Improve summing of poll percentages to 100
2016-11-03 10:42:59 +01:00
rizka10 4ce99c998b Improve summing poll percentages to 100
My first JavaScript! I have little experience with C++ and even less with Java, but that was enough to figure out a way to solve the task. The solution is rather good, but there may be better ways. I'm going to start a pull request. Even if it gets rejected, an expert can use the idea.

NOTE: The code needs some serious testing before potential merging. I did some testing and it worked, but don't trust in my skills.
2016-11-03 11:11:17 +02:00
Robin Ward fab36e6cf7 Fix more deprecations:
- Remove all `needs:` code
2016-10-21 17:28:37 -04:00
Robin Ward be1d74d207 Split out common functions into `discourse-common` module 2016-09-22 09:52:19 -04:00
Guo Xiang Tan ad44a64c5b UX: Fixes for poll option bars on dark theme. 2016-08-02 09:48:06 +08:00
Guo Xiang Tan dc2cf996af UX: Styles for poll options on dark theme. 2016-08-01 22:07:57 +08:00
Guo Xiang Tan 1171936850 FIX: Don't escape strings from polls. 2016-07-29 16:35:57 +08:00
Guo Xiang Tan f9454088c3 FIX: Missing icons on polls preview. 2016-07-29 16:15:52 +08:00
Guo Xiang Tan 89d2340e37 UX: Add margins for poll links in preview. 2016-07-29 15:19:56 +08:00
Guo Xiang Tan e336e56153 FIX: Incorrect sort for poll results. 2016-07-29 14:42:55 +08:00
Guo Xiang Tan 32c962cfd8 UX: Remove button styles on polls. 2016-07-29 11:09:23 +08:00
Guo Xiang Tan 8e30ab31c2 Merge pull request #4351 from tgxworld/allow_non_number_poll_results_to_be_sorted
FEATURE: Allow poll results to be sorted.
2016-07-29 10:38:29 +08:00
Guo Xiang Tan a7f2b2ded6 FEATURE: Allow poll results to be sorted. 2016-07-29 10:37:27 +08:00
Guo Xiang Tan bb3f4a10f3 UX: Polls should take up full width of post's container. 2016-07-28 23:06:25 +08:00
Guo Xiang Tan 85a91c8b81 Remove unused property. 2016-07-28 21:28:49 +08:00
Guo Xiang Tan 33a628b0b0 UX: Vote now button to show up as primary once options have been selected. 2016-07-21 06:05:06 +08:00
Robin Ward f38347400c FIX: `currentUser` can be null 2016-07-19 12:48:52 -04:00
Guo Xiang Tan 89e28c12ed UX: Fix polls on dark theme. 2016-07-19 13:01:54 +08:00
Guo Xiang Tan 5f481ec097 Merge pull request #4328 from dachary/wip-poll-empty-lines
FIX: poll builder should ignore empty lines
2016-07-17 09:24:36 +08:00
Loic Dachary f152900969 FIX: poll builder should ignore empty lines
Although pollOptionsCount skips empty lines, pollOutput inserts empty
lines. Skip them instead.

Signed-off-by: Loic Dachary <loic@dachary.org>
2016-07-14 09:27:43 +02:00
Guo Xiang Tan c3cab98998 FEATURE: Admins should be able to create polls even when plugin is disabled. 2016-07-13 18:05:19 +08:00
Robin Ward ff4e60808a FIX: Polls were broken server side 2016-07-11 12:57:05 -04:00
Robin Ward b8125b3512 REFACTOR: Remove `Discourse.Ajax` 2016-07-11 12:57:05 -04:00
Robin Ward 56f07529bb REFACTOR: Migrate more legacy JS to ES6 2016-07-11 12:57:05 -04:00
Robin Ward a546395397 REFACTOR: Migrate markdown functionality in ES6 2016-07-11 12:57:05 -04:00
Guo Xiang Tan 6e385f11b3 UX: Render polls within the same run loop.
* Rendering polls in a seperate run loops causes
our topic list page to be jumpy because of changing
heights after polls have been rendered.
2016-07-11 10:19:00 +08:00
Guo Xiang Tan 3cb8bbb851 UX: Automatically generate poll name for poll builder. 2016-07-05 22:15:52 +08:00
Guo Xiang Tan a382d5d2d2
FIX: Don't reopen instance of controller. 2016-07-05 12:22:14 +08:00
Guo Xiang Tan d102a079b1
FIX: Bump plugin API version. 2016-07-01 09:32:30 +08:00
Guo Xiang Tan 5ba12840e0 Merge pull request #4285 from tgxworld/fix_polls_not_cooked
FIX: Incorrect model for embedded post widget.
2016-06-27 13:31:03 +08:00
Guo Xiang Tan 63b8797667
FIX: Incorrect model for embedded post widget. 2016-06-27 13:15:26 +08:00
Guo Xiang Tan 789a6aeb21 FIX: Public poll not showing. 2016-06-24 11:20:35 +08:00
Guo Xiang Tan 3646d45110
FIX: Voters arrow shown on polls with invalid public config. 2016-06-22 23:34:39 +08:00
Jeff Atwood 7337b2953f slightly less giant poll percentages 2016-06-21 17:01:27 -07:00
Guo Xiang Tan 6416ea9e09
FIX: Make sure we reset poll builder after inserting a poll. 2016-06-20 18:16:18 +08:00
Guo Xiang Tan 01c563ca85
FIX: Use internal value for poll builder. 2016-06-20 12:40:44 +08:00
Guo Xiang Tan adecdbee56
UX: Display number combobox as an input group so it looks nice on mobile too. 2016-06-16 17:08:00 +08:00
Guo Xiang Tan 4df224bb79
FIX: Trim whitespaces and do a global replace. 2016-06-16 16:35:23 +08:00
Guo Xiang Tan fd91a8eee6
Bunch of UX changes for polls builder. 2016-06-15 23:47:19 +08:00
Guo Xiang Tan e1cfe7536c
FIX: Add default values when no value has been selected. 2016-06-15 12:54:52 +08:00
Guo Xiang Tan ae5a033469
Start checking eslint in plugins. 2016-06-15 11:14:24 +08:00
Guo Xiang Tan 8d46727d67
FEATURE: Poll UI Builder. 2016-06-15 11:14:24 +08:00
Guo Xiang Tan a36203ff78
PERF: Paginate public polls. 2016-06-12 16:14:53 +08:00
Guo Xiang Tan 5a03eca74a
UX: Add info when poll is public. 2016-06-09 22:15:08 +08:00
Guo Xiang Tan 7b6fb17bbb
One line import. 2016-06-08 17:23:05 +08:00
Guo Xiang Tan 3caf696d3a
FIX: Ignore title in user avatar. 2016-06-08 17:04:18 +08:00
Guo Xiang Tan 8ecde35df3
FEATURE: Add public type to polls. 2016-06-08 16:19:13 +08:00
Guo Xiang Tan 7aac5baeed
FIX: Make sure model is updated when polls change. 2016-06-08 14:42:23 +08:00
Guo Xiang Tan 35337cd687
FIX: Previous polls are being removed when adding a poll in a new post. 2016-06-07 11:23:38 +08:00
Robin Ward 7c0fb41ec0
Deprecation: Use `Ember.Helper` for later versions of Ember 2016-05-11 14:26:09 -04:00
Robin Ward 9ea32bf7d8
Deprecation: Change `{{#each x in y}}` to `{{#each y as |x|}}` 2016-05-04 16:18:09 -04:00
Robin Ward ef4877e009 FIX: Stability issues with multiple polls 2016-03-28 12:17:37 -04:00
Régis Hanol b575f97ece FIX: allows polls on closed topics 2016-03-21 12:12:25 +01:00
Robin Ward 6935925f10 Update Polls plugin to work with new Plugin API 2016-02-18 15:23:43 -05:00
Régis Hanol fc92166d5f FIX: when rouding numbers in poll resuls, *don't* select a never-been-voted-for option to round up from zero 2016-01-14 01:59:46 +01:00
Sam Saffron 57944a0694 PERF: only subscribe to a topic once for polls
in the past as views were created and destroyed poll subscriptions would change

this caused a lot of load on messaging bus and uneeded traffic
2016-01-06 20:36:09 +11:00
Régis Hanol 08ae5f89bd FIX: rounding issue might appear when summing up all the decimals 2015-11-30 11:24:25 +01:00
Régis Hanol 68a44a1d59 FIX: use an algorithm that doesn't re-order percentages when rounding them up to 100% in single choice polls 2015-11-25 00:14:24 +01:00
Régis Hanol 4f25278b39 FIX: round down percentages when using multiple choices polls 2015-11-23 15:28:24 +01:00
Régis Hanol 9d2128dad3 FIX: don't round up to 100% when using multiple choices poll 2015-11-23 11:34:24 +01:00
Régis Hanol 32b6ccd622 FIX: properly round % so they add up to 100 in polls 2015-11-19 18:23:38 +01:00
Régis Hanol cc75890cd4 UX: disable 'Hide results' button when poll is closed 2015-09-16 13:01:08 +02:00
Régis Hanol 26c743a962 FIX: disable poll dialect when poll plugin is disabled 2015-09-14 20:11:03 +02:00
Régis Hanol 969f6ad1d0 Revert "make polls unselectable"
This reverts commit 9b819d9245.
2015-07-31 12:46:30 +02:00
Jeff Atwood 9b819d9245 make polls unselectable
https://meta.discourse.org/t/disabling-text-selection-in-polls/31586
2015-07-31 03:43:07 -07:00
Régis Hanol 233cdc011d FIX: disable text selection in polls 2015-07-31 12:42:53 +02:00
Robin Ward 8be37193ee Trivial changes to poll plugin, including a small typo fix. 2015-07-07 10:51:51 -04:00
Régis Hanol b25a16ee3e FEATURE: 2 new reports: time to first response, topics with no response
FIX: relativeAgeMediumSpan was off by 1
REFACTOR: extracted decimalAdjust & round functions from the poll plugin
2015-06-22 19:46:51 +02:00
Régis Hanol 7afe78eec0 FIX: don't use a table for poll results 2015-06-03 16:49:20 +02:00
Régis Hanol 50a39f7e98 use bigger bottom padding instead of line-height to vertical center 2015-06-03 12:35:49 +02:00
Régis Hanol 0013a94692 FIX: use pastel color for background of the selected poll options 2015-06-03 12:28:03 +02:00
Jeff Atwood 1a9da9133e switch back to line-height based centering on polls 2015-06-03 02:58:52 -07:00
Régis Hanol f736b6face FIX: validate poll parameters when type=multiple 2015-06-01 19:28:05 +02:00
Jeff Atwood 9ce6603864 better poll option alignment for multi-line 2015-05-29 16:32:44 -07:00
Robin Ward 78abf85087 FIX: IE9 issues with latest discourse 2015-05-25 12:32:42 -04:00
Régis Hanol 3859273ff7 FIX: prevent span abuse in polls 2015-05-20 15:55:27 +02:00
Régis Hanol 42be2b431f ooops, we actually need that :fired: 2015-05-15 11:51:10 +02:00
Régis Hanol a3fb2c002c FIX: remove dangerous support for style/background attributes in polls 2015-05-15 11:08:51 +02:00
riking 9d232dac9a FIX: Properly whitelist li styles 2015-05-14 16:43:01 -07:00
Régis Hanol 635b31af7b FIX: editing a post with a poll breaks sometimes 2015-05-14 17:18:45 +02:00
Régis Hanol 7c545537a6 FIX: prevent pollception 2015-05-13 23:12:53 +02:00
Régis Hanol b8005f0b1b FIX: link starting with '[poll' should not break polls 2015-05-13 17:50:25 +02:00
Régis Hanol 3a9907f392 FIX: prevent self-xss in poll attributes 2015-05-11 20:09:17 +02:00
Robin Ward 585583d38c Upgrade polls to Ember 1.11 2015-05-11 11:20:45 -04:00
Robin Ward aee12fd6ef Ember Deprecations for Topics 2015-05-11 11:18:37 -04:00
Régis Hanol c2ffe255c3 FIX: add borders on polls on mobile 2015-05-08 11:13:32 +02:00
Régis Hanol 875a013ec7 FIX: poll design on mobile 2015-05-07 19:49:06 +02:00
Régis Hanol 9b0ca60f52 FIX: support quotes for poll parameters 2015-05-07 16:40:14 +02:00
Régis Hanol 78cff468bc FIX: poll options display issues 2015-05-07 15:19:23 +02:00
Régis Hanol 033761d2f6 FIX: reset all votes when the # of options changes 2015-05-06 18:52:09 +02:00
Régis Hanol 2d3a090060 FIX: poll design on mobile 2015-05-05 20:14:38 +02:00
Régis Hanol 73703dd557 FIX: poll fake 3D button effect with custom background color 2015-05-05 20:00:42 +02:00
Sam b4f666630e make jshint happy 2015-05-05 10:10:50 +10:00
Régis Hanol 90c05ff045 FIX: two-column poll 2015-05-04 22:29:45 +02:00
Gerhard Schlager 409a367ab7 Replace all occurrences of totalVotes 2015-05-04 16:20:13 +02:00
Régis Hanol 86d7412f30 REFACTOR: rename "total_votes" poll field to the more accurate "voters"
FEATURE: automagically load plugin's migrations
2015-05-04 16:01:57 +02:00
Gerhard Schlager c9e4fd578d FIX: closed polls with no votes showed NaN as percentage and average 2015-05-02 01:58:23 +02:00
Régis Hanol 6af71bd601 FIX: polls requires a refresh to work when inserted in the stream 2015-04-27 18:59:29 +02:00
Régis Hanol 151dea4088 FIX: editing a poll/post with a poll wasn't working properly 2015-04-26 00:12:19 +02:00
Régis Hanol 8129cce104 FIX: clicking "show results" wasn't working after casting a vote 2015-04-24 17:24:13 +02:00
Régis Hanol 7085c7db12 make jshint happy 2015-04-23 19:52:37 +02:00
Régis Hanol a737090442 - FEATURE: revamped poll plugin
- add User.staff scope
- inject MessageBus into Ember views (so it can be used by the poll plugin)
- REFACTOR: use more accurate is_first_post? method instead of post_number == 1
- FEATURE: add support for JSON-typed custom fields
- FEATURE: allow plugins to add validation
- FEATURE: add post_custom_fields to PostSerializer
- FEATURE: allow plugins to whitelist post_custom_fields
- FIX: don't bump when post did not save successfully
- FEATURE: polls are supported in any post
- FEATURE: allow for multiple polls in the same post
- FEATURE: multiple choice polls
- FEATURE: rating polls
- FEATURE: new dialect allowing users to preview polls in the composer
2015-04-23 19:33:29 +02:00
Régis Hanol 4714a562d9 FIX: Poll requires logged in user to log in again
FIX: Open/Closing the poll wasn't updating the UI
REFACTOR: ES6 FTW
2015-03-03 16:17:07 +01:00
riking 06f02ce9fc FIX: 🈂️ Allow closing polls in multi-locale sites 2015-02-05 19:55:03 -08:00
Robin Ward 28f702a5b6 Refactor app events to more efficiently handle post highlighting 2015-01-14 15:50:19 -05:00
Robin Ward f21d34df24 FIX: Polls were broken after Ember upgrade 2014-12-18 11:42:47 -05:00
Robin Ward f3babdb319 Fixes many Ember 1.9.0 deprecations 2014-12-17 09:31:42 -05:00
Robin Ward 4de412365e The `{{i18n}}` helper should use quotes when looking up keys, always. 2014-12-08 16:36:18 -05:00
Robin Ward e035b07e92 Put Ember 1.8.1 + fixes back. 2014-12-04 08:51:35 -05:00
Sam 8977d5917b revert 2014-12-04 09:35:11 +11:00
Robin Ward 39fde5b9fb Upgrade to 1.8.1: So long, metamorphs! 2014-12-03 10:49:18 -05:00
Robin Ward 0d12ed2231 UX: More spinner upgrades 2014-11-13 15:40:28 -05:00
Régis Hanol 22525ff74c FIX: changing title of a poll should close/open the poll 2014-10-31 12:01:47 +01:00
Robin Ward e55b437eb9 Replace the rest of the deprecated `{{action xyz}}` with `{{action
"xyz"}}`
2014-10-03 14:43:27 -04:00
Robin Ward d0fb8bbcfc Instead of `.js.handlebars` use `.hbs` for handlebars templates 2014-09-26 15:23:15 -04:00
Sam 244323d218 FEATURE: restyle poll buttons 2014-08-23 10:50:45 +10:00
Robin Ward 0adfeb1cff ES6: Mega update of controllers 2014-08-13 10:22:47 -04:00
Vikhyat Korrapati 5cb2df8f09 Set up poll plugin javascript using an Ember initializer. 2014-05-18 13:36:27 +05:30
Robin Ward 41a4a58af1 FIX: Thanks .gitignore, I missed a necessary file! 2014-05-15 17:57:13 -04:00
Robin Ward ba8b45792c Plugins: Prefix `discourse/plugins/PLUGINNAME` for plugin export names. 2014-05-15 16:31:45 -04:00
Vikhyat Korrapati a0b7637f5e Extract poll plugin controller into an ES6 module. 2014-05-15 23:54:53 +05:30
Vikhyat Korrapati 11297efed5 Get rid of unnecessary controller reference in poll template. 2014-04-16 12:11:41 +05:30
Vikhyat Korrapati 83b46a6b88 Disable the close poll functionality if allow_user_locale is enabled. 2014-04-12 23:00:51 +05:30
Vikhyat Korrapati 5de7d889fd Add close/open poll buttons to poll UI. 2014-04-12 22:53:21 +05:30
Vikhyat Korrapati cc607dc0b5 Poll style improvements. 2014-04-11 12:26:55 +05:30
Vikhyat Korrapati edfea2f801 Update poll when title is changed. 2014-04-11 09:05:07 +05:30
Vikhyat Korrapati edbbf7ffbb Switch the awkward poll.post.poll_details.closed to poll.closed. 2014-04-11 08:13:02 +05:30
Kane York 6e8392bf8e Show results by default for closed polls 2014-04-10 01:00:52 -07:00
Burke Mamlin 765cf700e3 allow polls to be closed independently of topic 2014-04-08 21:16:29 -04:00
Vikhyat Korrapati 9ef104bbce Poll Plugin: Don't allow voting on closed topics. 2014-03-16 19:21:17 +05:30
Nick Schonning 9f51ab347a JSHint: Add strict comparisons to poll_ui.js 2014-03-08 01:35:12 -05:00
Benjamin Kampmann a2512ecf74 Allow poll options to contain rendered code by not escaping it. 2014-03-05 10:45:49 +01:00
Vikhyat Korrapati 33cb4bc5ac Fallback to using the first list if [poll] isn't present. 2014-02-20 13:46:27 +05:30
Vikhyat Korrapati 74ab14de19 Add poll plugin. 2014-02-13 07:39:01 +05:30