diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index bd05e8a0..86e25032 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -1,14 +1,19 @@ class StaticPagesController < ApplicationController skip_before_action :load_tenant_data, only: [:showcase, :pending_tenant, :blocked_tenant] - def roadmap - @post_statuses = PostStatus - .find_roadmap - .select(:id, :name, :color) + def root + @board = Board.find_by(id: Current.tenant.tenant_setting.root_board_id) - @posts = Post - .find_with_post_status_in(@post_statuses) - .select(:id, :title, :board_id, :post_status_id, :user_id, :created_at) + if @board + render 'boards/show' + else + get_roadmap_data + render 'static_pages/roadmap' + end + end + + def roadmap + get_roadmap_data end def showcase @@ -20,4 +25,16 @@ class StaticPagesController < ApplicationController def blocked_tenant end + + private + + def get_roadmap_data + @post_statuses = PostStatus + .find_roadmap + .select(:id, :name, :color) + + @posts = Post + .find_with_post_status_in(@post_statuses) + .select(:id, :title, :board_id, :post_status_id, :user_id, :created_at) + end end \ No newline at end of file diff --git a/app/javascript/actions/Tenant/updateTenant.ts b/app/javascript/actions/Tenant/updateTenant.ts index 9653c084..79202a1c 100644 --- a/app/javascript/actions/Tenant/updateTenant.ts +++ b/app/javascript/actions/Tenant/updateTenant.ts @@ -76,8 +76,6 @@ export const updateTenant = ({ }, }); - console.log(body) - const res = await fetch(`/tenants/0`, { method: 'PATCH', headers: buildRequestHeaders(authenticityToken), diff --git a/app/javascript/components/Board/BoardP.tsx b/app/javascript/components/Board/BoardP.tsx index ddf26081..31c704f8 100644 --- a/app/javascript/components/Board/BoardP.tsx +++ b/app/javascript/components/Board/BoardP.tsx @@ -7,6 +7,7 @@ import PostList from './PostList'; import Sidebar from '../common/Sidebar'; import IBoard from '../../interfaces/IBoard'; +import ITenantSetting from '../../interfaces/ITenantSetting'; import { PostsState } from '../../reducers/postsReducer'; import { PostStatusesState } from '../../reducers/postStatusesReducer'; @@ -14,6 +15,8 @@ import { PostStatusesState } from '../../reducers/postStatusesReducer'; interface Props { board: IBoard; isLoggedIn: boolean; + isPowerUser: boolean; + tenantSetting: ITenantSetting; authenticityToken: string; posts: PostsState; postStatuses: PostStatusesState; @@ -63,6 +66,8 @@ class BoardP extends React.Component { const { board, isLoggedIn, + isPowerUser, + tenantSetting, authenticityToken, posts, postStatuses, @@ -97,6 +102,8 @@ class BoardP extends React.Component { ; + showLikeCount: boolean; + showLikeButtons: boolean; postStatuses: Array; areLoading: boolean; error: string; @@ -27,6 +29,8 @@ interface Props { const PostList = ({ posts, + showLikeCount, + showLikeButtons, postStatuses, areLoading, error, @@ -53,7 +57,9 @@ const PostList = ({ title={post.title} description={post.description} postStatus={postStatuses.find(postStatus => postStatus.id === post.postStatusId)} - likesCount={post.likesCount} + likeCount={post.likeCount} + showLikeCount={showLikeCount} + showLikeButtons={showLikeButtons} liked={post.liked} commentsCount={post.commentsCount} diff --git a/app/javascript/components/Board/PostListItem.tsx b/app/javascript/components/Board/PostListItem.tsx index 3d5e2597..bcb1d411 100644 --- a/app/javascript/components/Board/PostListItem.tsx +++ b/app/javascript/components/Board/PostListItem.tsx @@ -12,7 +12,9 @@ interface Props { title: string; description?: string; postStatus: IPostStatus; - likesCount: number; + likeCount: number; + showLikeCount: boolean; + showLikeButtons: boolean; liked: number; commentsCount: number; @@ -25,7 +27,9 @@ const PostListItem = ({ title, description, postStatus, - likesCount, + likeCount, + showLikeCount, + showLikeButtons, liked, commentsCount, @@ -35,7 +39,9 @@ const PostListItem = ({
window.location.href = `/posts/${id}`} className="postListItem"> { } render() { - const { board, isLoggedIn, authenticityToken } = this.props; + const { + board, + isLoggedIn, + isPowerUser, + tenantSetting, + authenticityToken, + } = this.props; return ( diff --git a/app/javascript/components/LikeButton/LikeButtonP.tsx b/app/javascript/components/LikeButton/LikeButtonP.tsx index 50dc0707..b5a6a344 100644 --- a/app/javascript/components/LikeButton/LikeButtonP.tsx +++ b/app/javascript/components/LikeButton/LikeButtonP.tsx @@ -2,7 +2,9 @@ import * as React from 'react'; interface Props { postId: number; - likesCount: number; + likeCount: number; + showLikeCount?: boolean; + showLikeButton?: boolean; liked: number; handleLikeSubmit( postId: number, @@ -15,7 +17,9 @@ interface Props { const LikeButtonP = ({ postId, - likesCount, + likeCount, + showLikeCount = true, + showLikeButton = true, liked, handleLikeSubmit, authenticityToken, @@ -29,9 +33,10 @@ const LikeButtonP = ({ else window.location.href = `/users/sign_in`; }} className={`likeButton${liked ? ' liked' : ''}`} + hidden={!showLikeButton} >
- {likesCount} + { showLikeCount && {likeCount} } ); diff --git a/app/javascript/components/Post/PostBoardSelect.tsx b/app/javascript/components/Post/PostBoardSelect.tsx index f4c05009..46854472 100644 --- a/app/javascript/components/Post/PostBoardSelect.tsx +++ b/app/javascript/components/Post/PostBoardSelect.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { getLabel } from '../../helpers/formUtils'; import IBoard from '../../interfaces/IBoard'; @@ -25,7 +26,7 @@ const PostBoardSelect = ({ id="selectPickerBoard" className="selectPicker" > - + {boards.map((board, i) => (