diff --git a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx index b5a99007..752b6396 100644 --- a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx +++ b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx @@ -11,6 +11,8 @@ import { TENANT_SETTING_BRAND_DISPLAY_NAME_ONLY, TENANT_SETTING_BRAND_DISPLAY_LOGO_ONLY, TENANT_SETTING_BRAND_DISPLAY_NONE, + TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_NO_COLLAPSE, + TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_ALWAYS_COLLAPSE, } from '../../../interfaces/ITenantSetting'; import { DangerText, SmallMutedText } from '../../common/CustomTexts'; import { getLabel, getValidationMessage } from '../../../helpers/formUtils'; @@ -24,6 +26,8 @@ export interface ISiteSettingsGeneralForm { showVoteCount: boolean; showVoteButtonInBoard: boolean; rootBoardId?: string; + showRoadmapInHeader: boolean; + collapseBoardsInHeader: string; } interface Props { @@ -40,6 +44,8 @@ interface Props { brandDisplaySetting: string, locale: string, rootBoardId: number, + showRoadmapInHeader: boolean, + collapseBoardsInHeader: string, showVoteCount: boolean, showVoteButtonInBoard: boolean, authenticityToken: string @@ -68,6 +74,8 @@ const GeneralSiteSettingsP = ({ showVoteCount: originForm.showVoteCount, showVoteButtonInBoard: originForm.showVoteButtonInBoard, rootBoardId: originForm.rootBoardId, + showRoadmapInHeader: originForm.showRoadmapInHeader, + collapseBoardsInHeader: originForm.collapseBoardsInHeader, }, }); @@ -78,9 +86,11 @@ const GeneralSiteSettingsP = ({ data.brandDisplaySetting, data.locale, Number(data.rootBoardId), + data.showRoadmapInHeader, + data.collapseBoardsInHeader, data.showVoteCount, data.showVoteButtonInBoard, - authenticityToken, + authenticityToken ).then(res => { if (res?.status !== HttpStatus.OK) return; window.location.reload(); @@ -170,6 +180,34 @@ const GeneralSiteSettingsP = ({
+

{ I18n.t('site_settings.general.subtitle_header') }

+ +
+
+ + +
+
+ +
+
+ + +
+ +
+

{ I18n.t('site_settings.general.subtitle_visibility') }

diff --git a/app/javascript/containers/GeneralSiteSettings.tsx b/app/javascript/containers/GeneralSiteSettings.tsx index 40f8f4d4..c5833e1f 100644 --- a/app/javascript/containers/GeneralSiteSettings.tsx +++ b/app/javascript/containers/GeneralSiteSettings.tsx @@ -3,7 +3,7 @@ import { connect } from "react-redux"; import GeneralSiteSettingsP from "../components/SiteSettings/General/GeneralSiteSettingsP"; import { updateTenant } from "../actions/Tenant/updateTenant"; import { State } from "../reducers/rootReducer"; -import { TenantSettingBrandDisplay } from "../interfaces/ITenantSetting"; +import { TenantSettingBrandDisplay, TenantSettingCollapseBoardsInHeader } from "../interfaces/ITenantSetting"; const mapStateToProps = (state: State) => ({ areUpdating: state.siteSettings.general.areUpdating, @@ -17,6 +17,8 @@ const mapDispatchToProps = (dispatch: any) => ({ brandDisplaySetting: TenantSettingBrandDisplay, locale: string, rootBoardId: number, + showRoadmapInHeader: boolean, + collapseBoardsInHeader: TenantSettingCollapseBoardsInHeader, showVoteCount: boolean, showVoteButtonInBoard: boolean, authenticityToken: string @@ -29,6 +31,8 @@ const mapDispatchToProps = (dispatch: any) => ({ show_vote_count: showVoteCount, show_vote_button_in_board: showVoteButtonInBoard, root_board_id: rootBoardId, + show_roadmap_in_header: showRoadmapInHeader, + collapse_boards_in_header: collapseBoardsInHeader, }, locale, authenticityToken, diff --git a/app/javascript/interfaces/ITenantSetting.ts b/app/javascript/interfaces/ITenantSetting.ts index e71dbcba..41be457d 100644 --- a/app/javascript/interfaces/ITenantSetting.ts +++ b/app/javascript/interfaces/ITenantSetting.ts @@ -10,11 +10,22 @@ export type TenantSettingBrandDisplay = typeof TENANT_SETTING_BRAND_DISPLAY_LOGO_ONLY | typeof TENANT_SETTING_BRAND_DISPLAY_NONE; +// Collapse boards in header +export const TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_NO_COLLAPSE = 'no_collapse'; +export const TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_ALWAYS_COLLAPSE = 'always_collapse'; + +export type TenantSettingCollapseBoardsInHeader = + typeof TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_NO_COLLAPSE | + typeof TENANT_SETTING_COLLAPSE_BOARDS_IN_HEADER_ALWAYS_COLLAPSE; + + interface ITenantSetting { brand_display?: TenantSettingBrandDisplay; root_board_id?: number; show_vote_count?: boolean; show_vote_button_in_board?: boolean; + show_roadmap_in_header?: boolean; + collapse_boards_in_header?: TenantSettingCollapseBoardsInHeader; } export default ITenantSetting; \ No newline at end of file diff --git a/app/models/tenant_setting.rb b/app/models/tenant_setting.rb index 2620ca45..3f9f9d3f 100644 --- a/app/models/tenant_setting.rb +++ b/app/models/tenant_setting.rb @@ -9,4 +9,9 @@ class TenantSetting < ApplicationRecord :logo_only, :no_name_no_logo ] + + enum collapse_boards_in_header: [ + :no_collapse, + :always_collapse + ] end diff --git a/app/policies/tenant_setting_policy.rb b/app/policies/tenant_setting_policy.rb index 7f6c592c..b11c49e5 100644 --- a/app/policies/tenant_setting_policy.rb +++ b/app/policies/tenant_setting_policy.rb @@ -1,7 +1,14 @@ class TenantSettingPolicy < ApplicationPolicy def permitted_attributes_for_update if user.admin? - [:brand_display, :root_board_id, :show_vote_count, :show_vote_button_in_board] + [ + :brand_display, + :root_board_id, + :show_vote_count, + :show_vote_button_in_board, + :show_roadmap_in_header, + :collapse_boards_in_header + ] else [] end diff --git a/app/views/layouts/_boards_nav_section.html.erb b/app/views/layouts/_boards_nav_section.html.erb index 1d4423f2..70ddc326 100644 --- a/app/views/layouts/_boards_nav_section.html.erb +++ b/app/views/layouts/_boards_nav_section.html.erb @@ -1,5 +1,19 @@ -<% boards.each do |board| %> - +<% if @tenant_setting.collapse_boards_in_header == 'always_collapse' %> + + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 70909dcd..c8831dec 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -29,6 +29,12 @@