summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-10-06 08:47:49 -0700
committerCorey Hulen <corey@hulen.com>2015-10-06 08:47:49 -0700
commitc71f56a6668f08bf5f174b4ace102897fb82d26f (patch)
tree40bab87aebaec4c4ccbae96e7b17001a4413328f
parent3543dc5ff329ab19334ad97b1993538aa5be6593 (diff)
parent300f25b31b99894bbbf95f5974d7f775d8f7ff29 (diff)
downloadchat-c71f56a6668f08bf5f174b4ace102897fb82d26f.tar.gz
chat-c71f56a6668f08bf5f174b4ace102897fb82d26f.tar.bz2
chat-c71f56a6668f08bf5f174b4ace102897fb82d26f.zip
Merge pull request #941 from hmhealey/plt515
PLT-515 Hide Copy Link button when unable to copy the team signup link
-rw-r--r--web/react/components/get_link_modal.jsx29
1 files changed, 18 insertions, 11 deletions
diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx
index 1d4aac3e6..6e0728862 100644
--- a/web/react/components/get_link_modal.jsx
+++ b/web/react/components/get_link_modal.jsx
@@ -23,7 +23,7 @@ export default class GetLinkModal extends React.Component {
componentDidMount() {
if (this.refs.modal) {
$(React.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow);
- $(React.findDOMNode(this.refs.modal)).on('hide.bs.modal', this.onShow);
+ $(React.findDOMNode(this.refs.modal)).on('hide.bs.modal', this.onHide);
}
}
handleClick() {
@@ -43,8 +43,23 @@ export default class GetLinkModal extends React.Component {
}
render() {
var currentUser = UserStore.getCurrentUser();
- var copyLinkConfirm = null;
+ let copyLink = null;
+ if (document.queryCommandSupported('copy')) {
+ copyLink = (
+ <button
+ data-copy-btn='true'
+ type='button'
+ className='btn btn-primary pull-left'
+ onClick={this.handleClick}
+ data-clipboard-text={this.state.value}
+ >
+ Copy Link
+ </button>
+ );
+ }
+
+ var copyLinkConfirm = null;
if (this.state.copiedLink) {
copyLinkConfirm = <p className='alert alert-success copy-link-confirm'><i className='fa fa-check'></i> Link copied to clipboard.</p>;
}
@@ -98,15 +113,7 @@ export default class GetLinkModal extends React.Component {
>
Close
</button>
- <button
- data-copy-btn='true'
- type='button'
- className='btn btn-primary pull-left'
- onClick={this.handleClick}
- data-clipboard-text={this.state.value}
- >
- Copy Link
- </button>
+ {copyLink}
{copyLinkConfirm}
</div>
</div>