about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-02-03 13:21:16 -0600
committermultiple creatures <dev@multiple-creature.party>2020-02-03 13:21:16 -0600
commit2198000607c6478d51784a526b472434efe17c63 (patch)
tree97cc49ddfa63daf4890d8b0189b4fb5538786f40 /app/javascript
parent0a5e08ebe765fe9b3d23b4aaef647368d8810b21 (diff)
button to add the spiderman discard option to polls
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/flavours/glitch/features/compose/components/poll_form.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/components/poll_form.js b/app/javascript/flavours/glitch/features/compose/components/poll_form.js
index a47b3799d..8c8a3b4be 100644
--- a/app/javascript/flavours/glitch/features/compose/components/poll_form.js
+++ b/app/javascript/flavours/glitch/features/compose/components/poll_form.js
@@ -11,7 +11,8 @@ import { pollLimits } from 'flavours/glitch/util/initial_state';
 
 const messages = defineMessages({
   option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Choice {number}' },
-  add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add a choice' },
+  add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add choice' },
+  add_spiderman: { id: 'compose_form.poll.add_spiderman', defaultMessage: 'Add spiderman' },
   remove_option: { id: 'compose_form.poll.remove_option', defaultMessage: 'Remove this choice' },
   poll_duration: { id: 'compose_form.poll.duration', defaultMessage: 'Poll duration' },
   single_choice: { id: 'compose_form.poll.single_choice', defaultMessage: 'Allow one choice' },
@@ -57,7 +58,7 @@ class Option extends React.PureComponent {
     this.props.onSuggestionSelected(tokenStart, token, value, ['poll', 'options', this.props.index]);
   }
 
-  render () {
+  render() {
     const { isPollMultiple, title, index, intl } = this.props;
 
     return (
@@ -110,6 +111,10 @@ class PollForm extends ImmutablePureComponent {
     this.props.onAddOption('');
   };
 
+  handleAddSpiderman = () => {
+    this.props.onAddOption('spiderman');
+  }
+
   handleSelectDuration = e => {
     this.props.onChangeSettings(e.target.value, this.props.isMultiple);
   };
@@ -118,7 +123,7 @@ class PollForm extends ImmutablePureComponent {
     this.props.onChangeSettings(this.props.expiresIn, e.target.value === 'true');
   };
 
-  render () {
+  render() {
     const { options, expiresIn, isMultiple, onChangeOption, onRemoveOption, intl, ...other } = this.props;
 
     if (!options) {
@@ -133,6 +138,7 @@ class PollForm extends ImmutablePureComponent {
             <label className='poll__text editable'>
               <span className={classNames('poll__input')} style={{ opacity: 0 }} />
               <button className='button button-secondary' onClick={this.handleAddOption}><Icon icon='plus' /> <FormattedMessage {...messages.add_option} /></button>
+              <button className='button button-secondary' onClick={this.handleAddSpiderman}><Icon icon='asterisk' /> <FormattedMessage {...messages.add_spiderman} /></button>
             </label>
           )}
         </ul>