Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantacruz committed Jun 13, 2022
2 parents 487e242 + cadae08 commit 3947ac5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions reader/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ def collection_page(request, slug):
"initialMenu": "collection",
"initialCollectionName": collection.name,
"initialCollectionSlug": collection.slug,
"initialCollectionTag": request.GET.get("tag", None),
"initialTab": request.GET.get("tab", None)
})

Expand Down
8 changes: 7 additions & 1 deletion static/js/CollectionPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ class CollectionPage extends Component {
}
componentDidMount() {
this.loadData();
if (!!this.props.tag & !this.props.tab) {
this.props.setTab("sheets");
}
}
componentDidUpdate(prevProps, prevState) {
if (this.props.slug !== prevProps.slug) {
this.setState({collectionData: null});
this.loadData();
}
if (this.props.tab != prevProps.tab) {
this.setState({tab: this.props.tab});
}
if (prevState.sheetFilterTopic !== this.state.sheetFilterTopic && $(".content").scrollTop() > 260) {
$(".content").scrollTop(0);
}
Expand Down Expand Up @@ -249,7 +255,7 @@ class CollectionPage extends Component {

<TabView
tabs={tabs}
currTabName={this.props.tab}
currTabName={this.state.tab}
renderTab={renderTab}
containerClasses={"largeTabs"}
setTab={this.props.setTab} >
Expand Down
4 changes: 2 additions & 2 deletions static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class ReaderApp extends Component {
"About", "AboutSheet", "Navigation", "WebPages", "extended notes", "Topics", "Torah Readings", "manuscripts", "Lexicon"]);
const addTab = (url) => {
if (state.tab && state.menuOpen !== "search") {
return url.includes("?") ? url + `&tab=${state.tab}` : url + `?tab=${state.tab}`;
return url + `&tab=${state.tab}`
} else {
return url;
}
Expand Down Expand Up @@ -506,7 +506,7 @@ class ReaderApp extends Component {
case "collection":
hist.url = "collections/" + state.collectionSlug;
if (states[i].collectionTag) {
hist.url;
hist.url += "&tag=" + state.collectionTag.replace("#","%23");
}
hist.title = (state.collectionName ? state.collectionName + " | " : "") + Sefaria._(siteName + " Collections");
hist.mode = "collection";
Expand Down

0 comments on commit 3947ac5

Please sign in to comment.