Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MM-19902 - Added example of channel header dropdown menu item #77

Merged
merged 5 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Demo Plugin",
"description": "This plugin demonstrates the capabilities of a Mattermost plugin.",
"version": "0.4.0",
"min_server_version": "5.18.0",
"min_server_version": "5.20.0",
"server": {
"executables": {
"linux-amd64": "server/dist/plugin-linux-amd64",
Expand Down
6 changes: 6 additions & 0 deletions webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ This plugin registers a main menu action that, when clicked, triggers the root c

![main menu](docs/main_menu.png)

## Channel Header Dropdown Menu Action

This plugin registers a channel header dropdown menu action that, when clicked, triggers the root component:

![channel header dropdown](docs/channel_header_dropdown.png)

## Post Dropdown

This plugin registers a post dropdown action that, when clicked, triggers the root component:
Expand Down
Binary file added webapp/docs/channel_header_dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions webapp/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const mainMenuAction = openRootModal;
export const fileUploadMethodAction = openRootModal;
export const postDropdownMenuAction = openRootModal;
export const postDropdownSubMenuAction = openRootModal;
export const channelHeaderMenuAction = openRootModal;

// TODO: Move this into mattermost-redux or mattermost-webapp.
export const getPluginServerRoute = (state) => {
Expand Down
10 changes: 10 additions & 0 deletions webapp/src/plugin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
fileUploadMethodAction,
postDropdownMenuAction,
postDropdownSubMenuAction,
channelHeaderMenuAction,
websocketStatusChange,
getStatus,
} from './actions';
Expand Down Expand Up @@ -83,6 +84,15 @@ export default class DemoPlugin {
<MainMenuMobileIcon/>,
);

registry.registerChannelHeaderMenuAction(
<FormattedMessage
id='plugin.name'
defaultMessage='Demo Plugin'
/>,
(channelId) => store.dispatch(channelHeaderMenuAction(channelId)),
<MainMenuMobileIcon/>,
);

registry.registerMainMenuAction(
<FormattedMessage
id='sample.confirmation.dialog'
Expand Down