From 3e51a9ea2a3107f7de71059c7a3447d6eded8d75 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 1 Dec 2015 21:04:37 -0800 Subject: PLT-1310 moving permalink to dropdown --- web/react/components/post_info.jsx | 49 ++++++++++++++++++++++++--------- web/sass-files/sass/partials/_post.scss | 2 +- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index cedb2b59b..9c53704b8 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -9,14 +9,15 @@ import * as EventHelpers from '../dispatcher/event_helpers.jsx'; import Constants from '../utils/constants.jsx'; -const OverlayTrigger = ReactBootstrap.OverlayTrigger; +const Overlay = ReactBootstrap.Overlay; const Popover = ReactBootstrap.Popover; export default class PostInfo extends React.Component { constructor(props) { super(props); this.state = { - copiedLink: false + copiedLink: false, + show: false }; this.handlePermalinkCopy = this.handlePermalinkCopy.bind(this); @@ -99,6 +100,20 @@ export default class PostInfo extends React.Component { ); } + dropdownContents.push( +
  • + this.setState({target: e.target, show: !this.state.show})} + > + {'Permalink'} + +
  • + ); + if (dropdownContents.length === 0) { return ''; } @@ -121,6 +136,7 @@ export default class PostInfo extends React.Component { ); } + handlePermalinkCopy() { const textBox = $(ReactDOM.findDOMNode(this.refs.permalinkbox)); textBox.select(); @@ -128,7 +144,7 @@ export default class PostInfo extends React.Component { try { const successful = document.execCommand('copy'); if (successful) { - this.setState({copiedLink: true}); + this.setState({copiedLink: true, show: false}); } else { this.setState({copiedLink: false}); } @@ -167,7 +183,7 @@ export default class PostInfo extends React.Component { var dropdown = this.createDropdown(); const permalink = TeamStore.getCurrentTeamUrl() + '/pl/' + post.id; - const copyButtonText = this.state.copiedLink ? (
    {'Copy '}
    ) : 'Copy'; + const copyButtonText = this.state.copiedLink ? (
    {'Copy X '}
    ) : 'Copy X'; const permalinkOverlay = ( ); + const containerPadding = 20; + return (
    • @@ -206,18 +224,23 @@ export default class PostInfo extends React.Component {
    • {comments} - - - - -
      {dropdown}
      + ReactDOM.findDOMNode(this.refs.dotMenu)} + onHide={() => this.setState({show: false})} + placement='left' + container={this} + containerPadding={containerPadding} + rootClose={true} + > + {permalinkOverlay} +
    ); diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss index ed1632681..4e9c4a9cf 100644 --- a/web/sass-files/sass/partials/_post.scss +++ b/web/sass-files/sass/partials/_post.scss @@ -564,7 +564,6 @@ body.ios { display: inline-block; visibility: hidden; top: -1px; - float: right; .dropdown-menu { right: 0; @@ -794,4 +793,5 @@ body.ios { .permalink-popover { min-width: 320px; + margin-left: 50px !important; } -- cgit v1.2.3-1-g7c22 From 17bd3ffcbd31eb4703355d657d15a85b5aff3c4b Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 1 Dec 2015 21:06:54 -0800 Subject: Fixing typo --- web/react/components/post_info.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index 9c53704b8..dd2b154a0 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -183,7 +183,7 @@ export default class PostInfo extends React.Component { var dropdown = this.createDropdown(); const permalink = TeamStore.getCurrentTeamUrl() + '/pl/' + post.id; - const copyButtonText = this.state.copiedLink ? (
    {'Copy X '}
    ) : 'Copy X'; + const copyButtonText = this.state.copiedLink ? (
    {'Copy '}
    ) : 'Copy'; const permalinkOverlay = ( Date: Tue, 1 Dec 2015 22:46:54 -0800 Subject: re-org'ing list --- web/react/components/post_info.jsx | 62 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index dd2b154a0..0b8b07d8c 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -42,30 +42,37 @@ export default class PostInfo extends React.Component { dataComments = this.props.commentCount; } - if (isOwner) { + if (this.props.allowReply === 'true') { dropdownContents.push(
  • - {'Edit'} + {'Reply'}
  • ); } + dropdownContents.push( +
  • + this.setState({target: e.target, show: !this.state.show})} + > + {'Permalink'} + +
  • + ); + if (isOwner || isAdmin) { dropdownContents.push(
  • - {'Reply'} + {'Edit'}
  • ); } - dropdownContents.push( -
  • - this.setState({target: e.target, show: !this.state.show})} - > - {'Permalink'} - -
  • - ); - if (dropdownContents.length === 0) { return ''; } -- cgit v1.2.3-1-g7c22