// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. var UserStore = require('../stores/user_store.jsx'); var ZeroClipboardMixin = require('react-zeroclipboard-mixin'); ZeroClipboardMixin.ZeroClipboard.config({ swfPath: '../../static/flash/ZeroClipboard.swf' }); module.exports = React.createClass({ zeroclipboardElementsSelector: '[data-copy-btn]', mixins: [ZeroClipboardMixin], componentDidMount: function() { var self = this; if (this.refs.modal) { $(this.refs.modal.getDOMNode()).on('show.bs.modal', function(e) { var button = e.relatedTarget; self.setState({title: $(button).attr('data-title'), value: $(button).attr('data-value')}); }); $(this.refs.modal.getDOMNode()).on('hide.bs.modal', function() { self.setState({copiedLink: false}); }); } }, getInitialState: function() { return {copiedLink: false}; }, handleClick: function() { this.setState({copiedLink: true}); }, render: function() { var currentUser = UserStore.getCurrentUser(); var copyLinkConfirm = null; if (this.state.copiedLink) { copyLinkConfirm =
Link copied to clipboard.
; } if (currentUser != null) { return ( ); } return ; } });