Skip to content

Commit

Permalink
Merge pull request #11424 from KDSBrowne/bbb-add-YNA-poll
Browse files Browse the repository at this point in the history
Add yes / no / abstention option to updated Poll UI
  • Loading branch information
antobinary committed Feb 18, 2021
2 parents e966d6c + 9aff7ea commit 05354d4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
39 changes: 38 additions & 1 deletion bigbluebutton-html5/imports/ui/components/poll/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ const intlMessages = defineMessages({
id: 'app.poll.answer.d',
description: '',
},
yna: {
id: 'app.poll.yna',
description: '',
},
yes: {
id: 'app.poll.y',
description: '',
},
no: {
id: 'app.poll.n',
description: '',
},
abstention: {
id: 'app.poll.abstention',
description: '',
},
});

const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
Expand Down Expand Up @@ -238,6 +254,12 @@ class Poll extends Component {
isDefault = defaultMatch && pollString.length === defaultMatch[0].length;
if (!isDefault) _type = 'custom';
break;
case 'YNA':
pollString = optList.map(x => x.val).join('');
defaultMatch = pollString.match(/^(YesNoAbstention)$/gi);
isDefault = defaultMatch && pollString.length === defaultMatch[0].length;
if (!isDefault) _type = 'custom';
break;
default:
break;
}
Expand Down Expand Up @@ -326,7 +348,7 @@ class Poll extends Component {
type, optList, question, error,
} = this.state;
const { startPoll, startCustomPoll, intl } = this.props;
const defaultPoll = type === 'TF' || type === 'A-';
const defaultPoll = type === 'TF' || type === 'A-' || type === 'YNA';
return (
<div>
<div className={styles.instructions}>
Expand Down Expand Up @@ -382,6 +404,21 @@ class Poll extends Component {
className={cx(styles.pBtn, { [styles.selectedBtn]: type === 'A-' })}
/>
</div>
<Button
label={intl.formatMessage(intlMessages.yna)}
color="default"
onClick={() => {
this.setState({
type: 'YNA',
optList: [
{ val: intl.formatMessage(intlMessages.yes) },
{ val: intl.formatMessage(intlMessages.no) },
{ val: intl.formatMessage(intlMessages.abstention) },
],
});
}}
className={cx(styles.pBtn, styles.yna, { [styles.selectedBtn]: type === 'YNA' })}
/>
<Button
label={intl.formatMessage(intlMessages.userResponse)}
color="default"
Expand Down
5 changes: 5 additions & 0 deletions bigbluebutton-html5/imports/ui/components/poll/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@
}
}

.yna {
width: 100%;
margin-bottom: 1rem;
}

.selectedBtn {
background-color: var(--poll-blue);
color: var(--color-white);
Expand Down

0 comments on commit 05354d4

Please sign in to comment.