diff --git a/assets/globals.d.ts b/assets/globals.d.ts index 7a4a9f060..8618de643 100644 --- a/assets/globals.d.ts +++ b/assets/globals.d.ts @@ -61,6 +61,7 @@ interface IClientConfig { } }; agenda_sort_events_with_coverage_on_top?: boolean; + collapsed_search_by_default?: boolean; show_user_register?: boolean; multimedia_website_search_url?: string; } diff --git a/assets/search/components/SearchResultsBar/index.tsx b/assets/search/components/SearchResultsBar/index.tsx index 17e4eaa9c..152300ab2 100644 --- a/assets/search/components/SearchResultsBar/index.tsx +++ b/assets/search/components/SearchResultsBar/index.tsx @@ -4,7 +4,7 @@ import {connect} from 'react-redux'; import {IAgendaState, IFilterGroup, INavigation, ISearchFields, ISearchParams, ITopic, IUser, ISearchSortValue} from 'interfaces'; -import {gettext} from 'utils'; +import {COLLAPSED_SEARCH_BY_DEFAULT, gettext} from 'utils'; import {searchParamsSelector, navigationsByIdSelector, filterGroupsByIdSelector} from '../../selectors'; import {getAdvancedSearchFields} from '../../utils'; import { @@ -105,8 +105,9 @@ class SearchResultsBarComponent extends React.Component { super(props); this.topicNotNull = new URLSearchParams(window.location.search).get('topic') != null; + this.state = { - isTagSectionShown: this.props.initiallyOpen || this.topicNotNull, + isTagSectionShown: COLLAPSED_SEARCH_BY_DEFAULT === true ? false : (this.props.initiallyOpen || this.topicNotNull), }; this.toggleTagSection = this.toggleTagSection.bind(this); diff --git a/assets/utils.tsx b/assets/utils.tsx index e92d8577b..f97a3f183 100644 --- a/assets/utils.tsx +++ b/assets/utils.tsx @@ -71,6 +71,7 @@ export const DAY_IN_MINUTES = 24 * 60 - 1; export const LIST_ANIMATIONS = getConfig('list_animations', true); export const DISPLAY_NEWS_ONLY = getConfig('display_news_only', true); export const AGENDA_SORT_EVENTS_WITH_COVERAGE_ON_TOP = getConfig('agenda_sort_events_with_coverage_on_top', false); +export const COLLAPSED_SEARCH_BY_DEFAULT = getConfig('collapsed_search_by_default', false); export const DISPLAY_AUTHOR_ROLE = getConfig('display_author_role', true); export const DISPLAY_AGENDA_FEATURED_STORIES_ONLY = getConfig('display_agenda_featured_stories_only', true); export const DISPLAY_ALL_VERSIONS_TOGGLE = getConfig('display_all_versions_toggle', true); diff --git a/newsroom/web/default_settings.py b/newsroom/web/default_settings.py index 338fbdee1..5a7e5660c 100644 --- a/newsroom/web/default_settings.py +++ b/newsroom/web/default_settings.py @@ -398,6 +398,7 @@ }, }, "agenda_sort_events_with_coverage_on_top": False, + "collapsed_search_by_default": False, } # Enable rendering of the date in the base view