Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Add new URL placeholder in Attachment list
Browse files Browse the repository at this point in the history
  • Loading branch information
ottosichert committed Oct 4, 2017
1 parent 6b9d750 commit fc54a3f
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/components/header/Attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Attachments extends Component {
state = {
data: null,
attachmentHovered: null,
isAddUrlOpen: false,
}

componentDidMount = () => {
Expand All @@ -35,6 +36,15 @@ class Attachments extends Component {
})
}

handleAddUrlClick = () => {
this.setState({ isAddUrlOpen: true });
}

handleAddUrlClose = (e) => {
e.stopPropagation();
this.setState({ isAddUrlOpen: false });
}

handleAttachmentClick = (id) => {
const {windowType, docId} = this.props;
openFile('window', windowType, docId, 'attachments', id);
Expand Down Expand Up @@ -85,12 +95,21 @@ class Attachments extends Component {
}

renderActions = () => {
const { isAddUrlOpen } = this.state;

return (
<div className="subheader-item js-subheader-item">
{'Add URL'}
<div
className="subheader-item js-subheader-item"
onClick={this.handleAddUrlClick}
>
Add URL
{/* TODO: find out how to add translations and use this instead:
{counterpart.translate('window.sideList.attachments.addurl')}
*/}

{isAddUrlOpen && (
<div onClick={this.handleAddUrlClose}>New URL</div>
)}
</div>
);
}
Expand Down

0 comments on commit fc54a3f

Please sign in to comment.