Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage filters #1840

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion geonode_mapstore_client/client/js/actions/gnsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const GET_FACET_ITEMS = 'GEONODE:GET_FACET_ITEMS';
export const SET_FACET_ITEMS = 'GEONODE:SET_FACET_ITEMS';
export const GET_FACET_FILTERS = 'GEONODE:GET_FACET_FILTERS';
export const SET_FILTERS = "SET_FILTERS";
export const SHOW_FILTER_FORM = "GEONODE:SHOW_FILTER_FORM";

/**
* Actions for GeoNode resource featured items
Expand Down Expand Up @@ -140,6 +141,13 @@ export function setFilters(filters) {
};
}

export function showFilterForm(show) {
return {
type: SHOW_FILTER_FORM,
show
};
}

export default {
SEARCH_RESOURCES,
searchResources,
Expand All @@ -151,5 +159,7 @@ export default {
requestResource,
setFeaturedResources,
SET_SEARCH_CONFIG,
setSearchConfig
setSearchConfig,
SHOW_FILTER_FORM,
showFilterForm
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const FiltersMenu = forwardRef(({
loading,
hideCardLayoutButton,
cardLayoutStyle,
setCardLayoutStyle
setCardLayoutStyle,
disableFilters
}, ref) => {

const { isMobile } = getConfigProp('geoNodeSettings');
Expand All @@ -50,22 +51,24 @@ const FiltersMenu = forwardRef(({
<div className="gn-menu-container">
<div className="gn-menu-content">
<div className="gn-menu-fill">
{totalFilters > 0 ? <ButtonWithTooltip
variant="primary"
size="sm"
onClick={onClick}
className="gn-success-changes-icon"
tooltip={<Message msgId="gnhome.filterApplied" msgParams={{ count: totalFilters }}/>}
>
{isMobile ? <FaIcon name="filter" /> : <Message msgId="gnhome.filter"/>}
</ButtonWithTooltip> : <Button
variant="primary"
size="sm"
onClick={onClick}
>
{isMobile ? <FaIcon name="filter" /> : <Message msgId="gnhome.filter"/>}
</Button>}
{' '}
{!disableFilters && <>
{totalFilters > 0 ? <ButtonWithTooltip
variant="primary"
size="sm"
onClick={onClick}
className="gn-success-changes-icon"
tooltip={<Message msgId="gnhome.filterApplied" msgParams={{ count: totalFilters }}/>}
>
{isMobile ? <FaIcon name="filter" /> : <Message msgId="gnhome.filter"/>}
</ButtonWithTooltip> : <Button
variant="primary"
size="sm"
onClick={onClick}
>
{isMobile ? <FaIcon name="filter" /> : <Message msgId="gnhome.filter"/>}
</Button>}
{' '}
</>}
{loading ? <span className="resources-count-loading"><Spinner /></span> : <Badge>
<span className="resources-count"> <Message msgId="gnhome.resourcesFound" msgParams={{ count: totalResources }}/> </span>
</Badge>}
Expand Down
Loading