mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
delete user from list to make it possible for him to resubscribe, default props for the button, style newsletter settings in the UsersEdit
This commit is contained in:
parent
460c81c598
commit
8ad7efae59
5 changed files with 27 additions and 8 deletions
|
@ -80,7 +80,7 @@ class Newsletter extends Component {
|
|||
{this.context.currentUser
|
||||
? <Telescope.components.NewsletterButton
|
||||
successCallback={() => this.successCallbackSubscription}
|
||||
buttonText={this.props.buttonText}
|
||||
subscribeText={this.props.buttonText}
|
||||
user={currentUser}
|
||||
/>
|
||||
: this.renderForm()
|
||||
|
|
|
@ -36,7 +36,7 @@ class NewsletterButton extends Component {
|
|||
onClick={this.subscriptionAction(isSubscribed ? "removeUserFromMailChimpList" : "addUserToMailChimpList")}
|
||||
bsStyle="primary"
|
||||
>
|
||||
{isSubscribed ? "Unsubscribe" : this.props.buttonText}
|
||||
{isSubscribed ? this.props.unsubscribeText : this.props.subscribeText}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
@ -45,7 +45,13 @@ class NewsletterButton extends Component {
|
|||
NewsletterButton.propTypes = {
|
||||
user: React.PropTypes.object.isRequired,
|
||||
successCallback: React.PropTypes.func.isRequired,
|
||||
buttonText: React.PropTypes.string
|
||||
subscribeText: React.PropTypes.string,
|
||||
unsubscribeText: React.PropTypes.string
|
||||
};
|
||||
|
||||
NewsletterButton.defaultProps = {
|
||||
subscribeText: "Subscribe",
|
||||
unsubscribeText: "Unsubscribe"
|
||||
};
|
||||
|
||||
module.exports = NewsletterButton;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { Row, Col } from 'react-bootstrap';
|
||||
|
||||
import NovaForm from "meteor/nova:forms";
|
||||
|
||||
|
@ -23,11 +24,17 @@ const UsersEdit = ({document, currentUser}) => {
|
|||
Messages.flash("User updated.", "success");
|
||||
}}
|
||||
/>
|
||||
<Telescope.components.NewsletterButton
|
||||
successCallback={(result) => Messages.flash("Newsletter subscription updated", "success")}
|
||||
buttonText="Subscribe"
|
||||
user={currentUser}
|
||||
/>
|
||||
<Row className="users-newsletter-settings">
|
||||
<Col sm={3}>
|
||||
Newsletter Settings
|
||||
</Col>
|
||||
<Col sm={9}>
|
||||
<Telescope.components.NewsletterButton
|
||||
successCallback={(result) => Messages.flash("Newsletter subscription updated", "success")}
|
||||
user={user}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</Telescope.components.CanEditUser>
|
||||
)
|
||||
|
|
|
@ -18,4 +18,9 @@
|
|||
display: block;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.users-newsletter-settings {
|
||||
@include flex-center;
|
||||
margin-top: $vmargin;
|
||||
}
|
|
@ -167,6 +167,7 @@ MailChimpList.remove = (user) => {
|
|||
var subscribeOptions = {
|
||||
id: listId,
|
||||
email: {"email": email},
|
||||
delete_member: true // delete the member from the list to make it possible for him to *resubscribe* via API (mailchimp's spam prevention policy)
|
||||
};
|
||||
|
||||
// unsubscribe user
|
||||
|
|
Loading…
Add table
Reference in a new issue