diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-20 01:28:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-20 01:28:25 +0200 |
commit | de475cf8d32744330f8029f13c539237a6567029 (patch) | |
tree | eaad397dac2ea78230500fd3a7e150021b960d57 /app/javascript/mastodon/components/dropdown_menu.js | |
parent | b369fc2de4ab0242775a56fb6208d9dbf2109d91 (diff) |
Add account media gallery view to web UI (#3120)
* Add account media gallery view to web UI * Link media view from account dropdown * Adjust link
Diffstat (limited to 'app/javascript/mastodon/components/dropdown_menu.js')
-rw-r--r-- | app/javascript/mastodon/components/dropdown_menu.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index 4b6168f43..03595318c 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -4,6 +4,10 @@ import PropTypes from 'prop-types'; class DropdownMenu extends React.PureComponent { + static contextTypes = { + router: PropTypes.object + }; + static propTypes = { icon: PropTypes.string.isRequired, items: PropTypes.array.isRequired, @@ -26,13 +30,17 @@ class DropdownMenu extends React.PureComponent { handleClick = (e) => { const i = Number(e.currentTarget.getAttribute('data-index')); - const { action } = this.props.items[i]; + const { action, to } = this.props.items[i]; + + e.preventDefault(); if (typeof action === 'function') { - e.preventDefault(); action(); - this.dropdown.hide(); + } else if (to) { + this.context.router.push(to); } + + this.dropdown.hide(); } renderItem = (item, i) => { |