52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
context = window
|
|
|
|
var broadcastActions = window.JK.Actions.Broadcast;
|
|
var rest = window.JK.Rest();
|
|
|
|
var Broadcast = React.createClass({
|
|
displayName: 'Broadcast Notification',
|
|
|
|
handleNavigate: function (e) {
|
|
|
|
var href = $(e.currentTarget).attr('href')
|
|
|
|
if (href.indexOf('http') == 0) {
|
|
e.preventDefault()
|
|
window.JK.popExternalLink(href)
|
|
}
|
|
|
|
broadcastActions.hide.trigger()
|
|
},
|
|
|
|
notNow: function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
rest.quietBroadcastNotification({broadcast_id: this.props.notification.id})
|
|
|
|
broadcastActions.hide.trigger()
|
|
},
|
|
|
|
createMarkup: function() {
|
|
return {__html: this.props.notification.message};
|
|
},
|
|
|
|
render: function () {
|
|
return <div className="broadcast-notification">
|
|
<div className="message" dangerouslySetInnerHTML={this.createMarkup()}/>
|
|
<div className="actions">
|
|
<div className="actionsAligner">
|
|
<a className="button-orange" onClick={this.handleNavigate}
|
|
href={this.props.notification.button_url}>{this.props.notification.button_label}</a>
|
|
<br/>
|
|
<a className="not-now" href="#" onClick={this.notNow}>not now, thanks</a>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
});
|
|
|
|
// each file will export exactly one component
|
|
context.JK.Components.Broadcast = Broadcast
|
|
context.Broadcast = Broadcast |