Moved show static methods out of modals and into EventHelpers
Этот коммит содержится в:
@@ -159,13 +159,4 @@ export default class DeletePostModal extends React.Component {
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
static show(post, commentCount) {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.TOGGLE_DELETE_POST_MODAL,
|
||||
value: true,
|
||||
post,
|
||||
commentCount: commentCount || 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import * as Client from '../utils/client.jsx';
|
||||
import * as AsyncClient from '../utils/async_client.jsx';
|
||||
import DeletePostModal from './delete_post_modal.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
import Textbox from './textbox.jsx';
|
||||
import BrowserStore from '../stores/browser_store.jsx';
|
||||
import PostStore from '../stores/post_store.jsx';
|
||||
@@ -35,7 +35,7 @@ export default class EditPostModal extends React.Component {
|
||||
delete tempState.editText;
|
||||
BrowserStore.setItem('edit_state_transfer', tempState);
|
||||
$('#edit_post').modal('hide');
|
||||
DeletePostModal.show(PostStore.getPost(this.state.channel_id, this.state.post_id), this.state.comments);
|
||||
EventHelpers.showDeletePostModal(PostStore.getPost(this.state.channel_id, this.state.post_id), this.state.comments);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
||||
import Constants from '../utils/constants.jsx';
|
||||
import GetLinkModal from './get_link_modal.jsx';
|
||||
import ModalStore from '../stores/modal_store.jsx';
|
||||
@@ -43,11 +42,4 @@ export default class GetTeamInviteLinkModal extends React.Component {
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
static show() {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: Constants.ActionTypes.TOGGLE_GET_TEAM_INVITE_LINK_MODAL,
|
||||
value: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
import * as utils from '../utils/utils.jsx';
|
||||
import Constants from '../utils/constants.jsx';
|
||||
const ActionTypes = Constants.ActionTypes;
|
||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
||||
import * as Client from '../utils/client.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
import ModalStore from '../stores/modal_store.jsx';
|
||||
import UserStore from '../stores/user_store.jsx';
|
||||
import TeamStore from '../stores/team_store.jsx';
|
||||
import ConfirmModal from './confirm_modal.jsx';
|
||||
import GetTeamInviteLinkModal from './get_team_invite_link_modal.jsx';
|
||||
|
||||
const Modal = ReactBootstrap.Modal;
|
||||
|
||||
@@ -193,7 +192,7 @@ export default class InviteMemberModal extends React.Component {
|
||||
showGetTeamInviteLinkModal() {
|
||||
this.handleHide(false);
|
||||
|
||||
GetTeamInviteLinkModal.show();
|
||||
EventHelpers.showGetTeamInviteLinkModal();
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -409,13 +408,6 @@ export default class InviteMemberModal extends React.Component {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static show() {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.TOGGLE_INVITE_MEMBER_MODAL,
|
||||
value: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
InviteMemberModal.propTypes = {
|
||||
|
||||
@@ -5,10 +5,9 @@ import * as Utils from '../utils/utils.jsx';
|
||||
import * as client from '../utils/client.jsx';
|
||||
import UserStore from '../stores/user_store.jsx';
|
||||
import TeamStore from '../stores/team_store.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
import AboutBuildModal from './about_build_modal.jsx';
|
||||
import GetTeamInviteLinkModal from './get_team_invite_link_modal.jsx';
|
||||
import InviteMemberModal from './invite_member_modal.jsx';
|
||||
import UserSettingsModal from './user_settings/user_settings_modal.jsx';
|
||||
|
||||
import Constants from '../utils/constants.jsx';
|
||||
@@ -94,7 +93,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={InviteMemberModal.show}
|
||||
onClick={EventHelpers.showInviteMemberModal}
|
||||
>
|
||||
{'Invite New Member'}
|
||||
</a>
|
||||
@@ -106,7 +105,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={GetTeamInviteLinkModal.show}
|
||||
onClick={EventHelpers.showGetTeamInviteLinkModal}
|
||||
>
|
||||
{'Get Team Invite Link'}
|
||||
</a>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import DeletePostModal from './delete_post_modal.jsx';
|
||||
import UserStore from '../stores/user_store.jsx';
|
||||
import TeamStore from '../stores/team_store.jsx';
|
||||
import * as Utils from '../utils/utils.jsx';
|
||||
import TimeSince from './time_since.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
import Constants from '../utils/constants.jsx';
|
||||
|
||||
@@ -74,7 +74,7 @@ export default class PostInfo extends React.Component {
|
||||
<a
|
||||
href='#'
|
||||
role='menuitem'
|
||||
onClick={() => DeletePostModal.show(post, dataComments)}
|
||||
onClick={() => EventHelpers.showDeletePostModal(post, dataComments)}
|
||||
>
|
||||
{'Delete'}
|
||||
</a>
|
||||
|
||||
@@ -8,13 +8,13 @@ import UserStore from '../stores/user_store.jsx';
|
||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
||||
import * as Utils from '../utils/utils.jsx';
|
||||
import Constants from '../utils/constants.jsx';
|
||||
import DeletePostModal from './delete_post_modal.jsx';
|
||||
import FileAttachmentList from './file_attachment_list.jsx';
|
||||
import * as Client from '../utils/client.jsx';
|
||||
import * as AsyncClient from '../utils/async_client.jsx';
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
import * as TextFormatting from '../utils/text_formatting.jsx';
|
||||
import twemoji from 'twemoji';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
export default class RhsComment extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -115,7 +115,7 @@ export default class RhsComment extends React.Component {
|
||||
<a
|
||||
href='#'
|
||||
role='menuitem'
|
||||
onClick={() => DeletePostModal.show(post, 0)}
|
||||
onClick={() => EventHelpers.showDeletePostModal(post, 0)}
|
||||
>
|
||||
{'Delete'}
|
||||
</a>
|
||||
|
||||
@@ -6,11 +6,11 @@ import UserProfile from './user_profile.jsx';
|
||||
import UserStore from '../stores/user_store.jsx';
|
||||
import * as TextFormatting from '../utils/text_formatting.jsx';
|
||||
import * as utils from '../utils/utils.jsx';
|
||||
import DeletePostModal from './delete_post_modal.jsx';
|
||||
import FileAttachmentList from './file_attachment_list.jsx';
|
||||
import twemoji from 'twemoji';
|
||||
import Constants from '../utils/constants.jsx';
|
||||
import PostBodyAdditionalContent from './post_body_additional_content.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
export default class RhsRootPost extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -94,7 +94,7 @@ export default class RhsRootPost extends React.Component {
|
||||
<a
|
||||
href='#'
|
||||
role='menuitem'
|
||||
onClick={() => DeletePostModal.show(post, this.props.commentCount)}
|
||||
onClick={() => EventHelpers.showDeletePostModal(post, this.props.commentCount)}
|
||||
>
|
||||
{'Delete'}
|
||||
</a>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import GetTeamInviteLinkModal from './get_team_invite_link_modal.jsx';
|
||||
import InviteMemberModal from './invite_member_modal.jsx';
|
||||
import UserSettingsModal from './user_settings/user_settings_modal.jsx';
|
||||
import UserStore from '../stores/user_store.jsx';
|
||||
import * as client from '../utils/client.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
import * as utils from '../utils/utils.jsx';
|
||||
|
||||
export default class SidebarRightMenu extends React.Component {
|
||||
@@ -46,7 +45,7 @@ export default class SidebarRightMenu extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={InviteMemberModal.show}
|
||||
onClick={EventHelpers.showInviteMemberModal}
|
||||
>
|
||||
<i className='fa fa-user'></i>Invite New Member
|
||||
</a>
|
||||
@@ -58,7 +57,7 @@ export default class SidebarRightMenu extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={GetTeamInviteLinkModal.show}
|
||||
onClick={EventHelpers.showGetTeamInviteLinkModal}
|
||||
>
|
||||
<i className='glyphicon glyphicon-link'></i>{'Get Team Invite Link'}
|
||||
</a>
|
||||
|
||||
@@ -81,3 +81,26 @@ export function emitPostDeletedEvent(post) {
|
||||
post
|
||||
});
|
||||
}
|
||||
|
||||
export function showDeletePostModal(post, commentCount = 0) {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.TOGGLE_DELETE_POST_MODAL,
|
||||
value: true,
|
||||
post,
|
||||
commentCount
|
||||
});
|
||||
}
|
||||
|
||||
export function showGetTeamInviteLinkModal() {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: Constants.ActionTypes.TOGGLE_GET_TEAM_INVITE_LINK_MODAL,
|
||||
value: true
|
||||
});
|
||||
}
|
||||
|
||||
export function showInviteMemberModal() {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.TOGGLE_INVITE_MEMBER_MODAL,
|
||||
value: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
|
||||
import * as Utils from './utils.jsx';
|
||||
import EditChannelHeaderModal from '../components/edit_channel_header_modal.jsx';
|
||||
import GetTeamInviteLinkModal from '../components/get_team_invite_link_modal.jsx';
|
||||
import InviteMemberModal from '../components/invite_member_modal.jsx';
|
||||
import ToggleModalButton from '../components/toggle_modal_button.jsx';
|
||||
import UserProfile from '../components/user_profile.jsx';
|
||||
import ChannelStore from '../stores/channel_store.jsx';
|
||||
import Constants from '../utils/constants.jsx';
|
||||
import TeamStore from '../stores/team_store.jsx';
|
||||
import * as EventHelpers from '../dispatcher/event_helpers.jsx';
|
||||
|
||||
export function createChannelIntroMessage(channel, showInviteModal) {
|
||||
if (channel.type === 'D') {
|
||||
@@ -91,7 +90,7 @@ export function createDefaultIntroMessage(channel) {
|
||||
<a
|
||||
className='intro-links'
|
||||
href='#'
|
||||
onClick={InviteMemberModal.show}
|
||||
onClick={EventHelpers.showInviteMemberModal}
|
||||
>
|
||||
<i className='fa fa-user-plus'></i>{'Invite others to this team'}
|
||||
</a>
|
||||
@@ -101,7 +100,7 @@ export function createDefaultIntroMessage(channel) {
|
||||
<a
|
||||
className='intro-links'
|
||||
href='#'
|
||||
onClick={GetTeamInviteLinkModal.show}
|
||||
onClick={EventHelpers.showGetTeamInviteLinkModal}
|
||||
>
|
||||
<i className='fa fa-user-plus'></i>{'Invite others to this team'}
|
||||
</a>
|
||||
|
||||
Ссылка в новой задаче
Block a user