import { Components, registerComponent } from 'meteor/vulcan:lib'; import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import Button from 'react-bootstrap/lib/Button'; import VulcanEmail from 'meteor/vulcan:email'; class Email extends PureComponent { constructor() { super(); this.sendTest = this.sendTest.bind(this); this.state = { loading: false } } sendTest() { this.setState({loading: true}); // TODO fix this // Actions.call("email.test", this.props.name, (error, result) => { // this.setState({loading: false}); // if (error) { // Messages.flash(error.message, "error"); // } else { // Messages.flash(`Test email sent (“${result}”).`, "success"); // } // }); } render() { const { email, name } = this.props; return ( {name} {email.template} {typeof email.subject === 'function' ? email.subject({}) : email.subject} {email.path}
{this.state.loading ? : null}
) } } Email.propTypes = { email: PropTypes.object, name: PropTypes.string }; const Emails = (/* props*/) => { const emails = VulcanEmail.emails; return (

Emails

{_.map(emails, (email, key) => )}
Name Template Subject HTML Preview Send Test
) }; registerComponent('Emails', Emails); export default Emails;