Skip to content

Commit

Permalink
Add email-to option in action buttons for dashboard and slice (#1705)
Browse files Browse the repository at this point in the history
* Add email-to option in explore action buttons

* email to option for dashboard
  • Loading branch information
vera-liu authored Dec 14, 2016
1 parent e1e20b8 commit fa9c066
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions superset/assets/javascripts/dashboard/components/Controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class Controls extends React.PureComponent {
render() {
const dashboard = this.props.dashboard;
const canSave = dashboard.context.dash_save_perm;
const emailBody = `Checkout this dashboard: ${window.location.href}`;
const emailLink = 'mailto:?Subject=Superset%20Dashboard%20'
+ `${dashboard.dashboard_title}&Body=${emailBody}`;
return (
<ButtonGroup>
<Button
Expand Down Expand Up @@ -93,6 +96,11 @@ class Controls extends React.PureComponent {
<i className="fa fa-save" />
}
/>
<Button
onClick={() => { window.location = emailLink; }}
>
<i className="fa fa-envelope"></i>
</Button>
</ButtonGroup>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ export default class URLShortLinkButton extends React.Component {
}

renderPopover() {
const emailBody = `Check out this slice: ${this.state.shortUrl}`;
return (
<Popover id="shorturl-popover">
<CopyToClipboard
text={this.state.shortUrl}
copyNode={<i className="fa fa-clipboard" title="Copy to clipboard"></i>}
/>
&nbsp;&nbsp;
<a href={`mailto:?Subject=Superset%20Slice%20&Body=${emailBody}`}>
<i className="fa fa-envelope"></i>
</a>
</Popover>
);
}
Expand Down

0 comments on commit fa9c066

Please sign in to comment.