// jshint ignore:start import React from 'react'; import Button from './button'; import Form from './form'; import FormGroup from './form-group'; import ajax from 'misago/services/ajax'; import modal from 'misago/services/modal'; export default class extends Form { constructor(props) { super(props); this.state = { isLoading: false, bestAnswer: '0', poll: '0', }; } clean() { if (this.props.polls && this.state.poll === '0') { const confirmation = confirm(gettext("Are you sure you want to delete all polls?")); return confirmation } return true; } send() { const data = Object.assign({}, this.props.data, { best_answer: this.state.bestAnswer, poll: this.state.poll }); return ajax.post(this.props.api, data); } handleSuccess = (success) => { this.props.onSuccess(success); modal.hide(); }; handleError = (rejection) => { this.props.onError(rejection); }; onBestAnswerChange = (event) => { this.changeValue('bestAnswer', event.target.value); }; onPollChange = (event) => { this.changeValue('poll', event.target.value); }; render() { return (

{gettext("Merge threads")}

); } } export function BestAnswerSelect({choices, onChange, value}) { if (!choices) return null; return ( ); } export function PollSelect({ choices, onChange, value }) { if (!choices) return null; return ( ); }