Skip to content

Commit

Permalink
Merge pull request #290 from frontside-folio/jc/craftLayerUrl
Browse files Browse the repository at this point in the history
Copy craftLayerUrl into SearchAndSort
  • Loading branch information
cherewaty authored Oct 3, 2018
2 parents d82e51d + a2753aa commit 89de181
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Change history for stripes-smart-components

## 1.10.0 (IN PROGRESS)

* Copy `craftLayerUrl()` into `<SearchAndSort>`

## [1.9.0](https://github.com/folio-org/stripes-smart-components/tree/v1.9.0) (2018-10-02)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v1.8.3...v1.9.0)

* Introduce `getHelperResourcePath` prop. Fixes STSMACOM-131.
* Remove notes helper app from `<SearchAndSort>`
* Move `stripes-form` to dependencies


## [1.8.3](https://github.com/folio-org/stripes-smart-components/tree/v1.8.3) (2018-09-19)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v1.8.0...v1.8.3)

Expand Down
10 changes: 6 additions & 4 deletions lib/SearchAndSort/SearchAndSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { stripesShape } from '@folio/stripes-core/src/Stripes';
import { withModule } from '@folio/stripes-core/src/components/Modules';
import { withStripes } from '@folio/stripes-core';
import queryString from 'query-string';
import { debounce, get, upperFirst } from 'lodash';
import { debounce, get, includes, upperFirst } from 'lodash';
import FilterGroups, {
filterState,
handleFilterChange,
Expand All @@ -31,7 +31,6 @@ import {
SearchField,
SRStatus
} from '@folio/stripes-components';
import craftLayerUrl from '@folio/stripes-components/util/craftLayerUrl';
import { mapNsKeys, getNsKey } from './nsQueryFunctions';
import Tags from '../Tags';
import css from './SearchAndSort.css';
Expand Down Expand Up @@ -186,8 +185,6 @@ class SearchAndSort extends React.Component {
this.SRStatus = null;
this.lastNonNullReaultCount = undefined;

this.craftLayerUrl = craftLayerUrl.bind(this);

const initialPath = (get(props.packageInfo, ['stripes', 'home']) || get(props.packageInfo, ['stripes', 'route']));
const initialSearch = initialPath.indexOf('?') === -1 ? initialPath :
initialPath.substr(initialPath.indexOf('?') + 1);
Expand Down Expand Up @@ -245,6 +242,11 @@ class SearchAndSort extends React.Component {
}
}

craftLayerUrl = (mode) => {
const url = this.props.location.pathname + this.props.location.search;
return includes(url, '?') ? `${url}&layer=${mode}` : `${url}?layer=${mode}`;
}

onChangeFilter = (e) => {
this.props.parentMutator.resultCount.replace(this.props.initialResultCount);
const newFilters = this.handleFilterChange(e);
Expand Down

0 comments on commit 89de181

Please sign in to comment.