mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add Boards management to sitesettings (#107)
This commit is contained in:
committed by
GitHub
parent
7b8a4d6709
commit
6be2394dc5
64
app/javascript/containers/BoardsSiteSettings.tsx
Normal file
64
app/javascript/containers/BoardsSiteSettings.tsx
Normal file
@@ -0,0 +1,64 @@
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import BoardsSiteSettingsP from "../components/SiteSettings/Boards/BoardsSiteSettingsP";
|
||||
import { requestBoards } from "../actions/Board/requestBoards";
|
||||
import { updateBoardOrder } from "../actions/Board/updateBoardOrder";
|
||||
import IBoard from "../interfaces/IBoard";
|
||||
import { State } from "../reducers/rootReducer";
|
||||
import { submitBoard } from "../actions/Board/submitBoard";
|
||||
import HttpStatus from "../constants/http_status";
|
||||
import { deleteBoard } from "../actions/Board/deleteBoard";
|
||||
import { updateBoard } from "../actions/Board/updateBoard";
|
||||
|
||||
const mapStateToProps = (state: State) => ({
|
||||
boards: state.boards,
|
||||
settingsAreUpdating: state.siteSettings.boards.areUpdating,
|
||||
settingsError: state.siteSettings.boards.error,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch: any) => ({
|
||||
requestBoards() {
|
||||
dispatch(requestBoards());
|
||||
},
|
||||
|
||||
submitBoard(
|
||||
name: string,
|
||||
description: string,
|
||||
onSuccess: Function,
|
||||
authenticityToken: string,
|
||||
) {
|
||||
dispatch(submitBoard(name, description, authenticityToken)).then(res => {
|
||||
if (res && res.status === HttpStatus.Created) onSuccess();
|
||||
});
|
||||
},
|
||||
|
||||
updateBoard(
|
||||
id: number,
|
||||
name: string,
|
||||
description: string,
|
||||
onSuccess: Function,
|
||||
authenticityToken: string,
|
||||
) {
|
||||
dispatch(updateBoard(id, name, description, authenticityToken)).then(res => {
|
||||
if (res && res.status === HttpStatus.OK) onSuccess();
|
||||
});
|
||||
},
|
||||
|
||||
updateBoardOrder(
|
||||
id: number,
|
||||
boards: Array<IBoard>,
|
||||
sourceIndex: number,
|
||||
destinationIndex: number,
|
||||
authenticityToken: string) {
|
||||
dispatch(updateBoardOrder(id, boards, sourceIndex, destinationIndex, authenticityToken));
|
||||
},
|
||||
|
||||
deleteBoard(id: number, authenticityToken: string) {
|
||||
dispatch(deleteBoard(id, authenticityToken));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(BoardsSiteSettingsP);
|
||||
@@ -1,11 +1,12 @@
|
||||
import { connect } from "react-redux";
|
||||
import { deletePostStatus } from "../actions/PostStatus/deletePostStatus";
|
||||
|
||||
import PostStatusesSiteSettingsP from "../components/SiteSettings/PostStatuses/PostStatusesSiteSettingsP";
|
||||
|
||||
import { requestPostStatuses } from "../actions/PostStatus/requestPostStatuses";
|
||||
import { submitPostStatus } from "../actions/PostStatus/submitPostStatus";
|
||||
import { updatePostStatus } from "../actions/PostStatus/updatePostStatus";
|
||||
import { updatePostStatusOrder } from "../actions/PostStatus/updatePostStatusOrder";
|
||||
import PostStatusesSiteSettingsP from "../components/SiteSettings/PostStatuses/PostStatusesSiteSettingsP";
|
||||
import { deletePostStatus } from "../actions/PostStatus/deletePostStatus";
|
||||
import HttpStatus from "../constants/http_status";
|
||||
import IPostStatus from "../interfaces/IPostStatus";
|
||||
import { State } from "../reducers/rootReducer";
|
||||
|
||||
Reference in New Issue
Block a user