localise default poll options before calculating required annotation space
This commit is contained in:
parent
fed60617ae
commit
41e33d9cda
@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import PollService from '/imports/ui/components/poll/service';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import { injectIntl, intlShape } from 'react-intl';
|
||||
|
||||
class PollDrawComponent extends Component {
|
||||
constructor(props) {
|
||||
@ -96,6 +96,28 @@ class PollDrawComponent extends Component {
|
||||
for (let i = 0; i < arrayLength; i += 1) {
|
||||
const _tempArray = [];
|
||||
const _result = result[i];
|
||||
let isDefaultPoll;
|
||||
switch (_result.key.toLowerCase()) {
|
||||
case 'true':
|
||||
case 'false':
|
||||
case 'yes':
|
||||
case 'no':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
isDefaultPoll = true;
|
||||
break;
|
||||
default:
|
||||
isDefaultPoll = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isDefaultPoll) {
|
||||
_result.key = intl.formatMessage({ id: `app.poll.answer.${_result.key.toLowerCase()}` });
|
||||
}
|
||||
|
||||
_tempArray.push(_result.key, `${_result.numVotes}`);
|
||||
if (votesTotal === 0) {
|
||||
_tempArray.push('0%');
|
||||
@ -578,6 +600,7 @@ class PollDrawComponent extends Component {
|
||||
export default injectIntl(PollDrawComponent);
|
||||
|
||||
PollDrawComponent.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
// Defines an annotation object, which contains all the basic info we need to draw a line
|
||||
annotation: PropTypes.shape({
|
||||
id: PropTypes.string.isRequired,
|
||||
|
Loading…
Reference in New Issue
Block a user