Skip to content

Commit

Permalink
Merge branch 'modularization-main' of https://github.com/Sefaria/Sefa…
Browse files Browse the repository at this point in the history
…ria-Project into modularization-main
  • Loading branch information
stevekaplan123 committed Sep 9, 2024
2 parents 4a4523f + ceb966f commit 6409ba4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions sourcesheets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ def sheets_by_ref_api(request, ref):
if include_collections:
sheets = annotate_sheets_with_collections(sheets)
return jsonResponse(sheets)

def sheets_with_ref(request, tref):
"""
Accepts tref as a string which is expected to be in the format of a ref or refs separated by commas, indicating a range.
Expand Down
3 changes: 2 additions & 1 deletion static/js/ElasticSearchQuerier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ ElasticSearchQuerier.propTypes = {
onQueryChange: PropTypes.func,
updateAppliedFilter: PropTypes.func,
updateAppliedOptionSort: PropTypes.func,
updateAppliedOptionField: PropTypes.func
updateAppliedOptionField: PropTypes.func,
resetSearchFilters: PropTypes.func
};

export { ElasticSearchQuerier };
19 changes: 18 additions & 1 deletion static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,21 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
})
});
}
resetSearchFilters(n, type) {
// reset both availableFilters and appliedFilters
const state = this.state.panels[n];
const searchState = this._getSearchState(state, type);
const searchStateName = this._getSearchStateName(type);
searchState.availableFilters.forEach(filterNode => {
if (!filterNode.isUnselected()) {
filterNode.setUnselected(true);
}
})
this.setPanelState(n, {
[searchStateName]: searchState.update({appliedFilters: [], appliedFilterAggTypes: [], filterRegistry: {},
filtersValid: false}),
});
}
updateSearchFilter(n, type, searchState, filterNode) {
const searchStateName = this._getSearchStateName(type);
if (filterNode.isUnselected()) {
Expand Down Expand Up @@ -2147,8 +2162,9 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
var unsetTextHighlight = this.unsetTextHighlight.bind(null, i);
var updateQuery = this.updateQuery.bind(null, i);
var updateAvailableFilters = this.updateAvailableFilters.bind(null, i);
let updateSearchState = this.updateSearchState.bind(null, i);
const updateSearchState = this.updateSearchState.bind(null, i);
var updateSearchFilter = this.updateSearchFilter.bind(null, i);
const resetSearchFilters = this.resetSearchFilters.bind(null, i);
var updateSearchOptionField = this.updateSearchOptionField.bind(null, i);
var updateSearchOptionSort = this.updateSearchOptionSort.bind(null, i);
var openConnectionsPanel = this.openTextListAt.bind(null, i+1);
Expand Down Expand Up @@ -2179,6 +2195,7 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
<ReaderPanel
openPanelAt={this.openPanelAt}
updateSearchState={updateSearchState}
resetSearchFilters={resetSearchFilters}
panelPosition={i}
initialState={panel}
interfaceLang={this.props.interfaceLang}
Expand Down
2 changes: 2 additions & 0 deletions static/js/ReaderPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ class ReaderPanel extends Component {
menu = (<ElasticSearchQuerier
query={this.state.searchQuery}
type={this.state.searchType}
resetSearchFilters={this.props.resetSearchFilters}
searchState={this.state[`${this.state.searchType}SearchState`]}
settings={Sefaria.util.clone(this.state.settings)}
panelsOpen={this.props.panelsOpen}
Expand Down Expand Up @@ -1653,6 +1654,7 @@ ReaderDisplayOptionsMenu.propTypes = {
multiPanel: PropTypes.bool.isRequired,
width: PropTypes.number.isRequired,
settings: PropTypes.object.isRequired,
resetSearchFilters: PropTypes.func,
};


Expand Down
1 change: 1 addition & 0 deletions static/js/SearchPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SearchPage extends Component {
mobileFiltersOpen: false,
};
}

render () {
const classes = classNames({readerNavMenu: 1, compare: this.props.compare});
const isQueryHebrew = Sefaria.hebrew.isHebrew(this.props.query);
Expand Down
1 change: 1 addition & 0 deletions static/js/Sheets/SheetsWithRefPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const SheetsWithRefPage = ({srefs, searchState, updateSearchState, updateApplied
}
return sheets;
}

const updateFilterSelectedValues = (availableFilters) => {
availableFilters.forEach((availableFilter) => {
const selected = searchState.appliedFilters.includes(availableFilter.aggKey);
Expand Down

0 comments on commit 6409ba4

Please sign in to comment.