homeflowjs 0.10.7 → 0.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/hf-initialize.jsx
CHANGED
|
@@ -7,6 +7,8 @@ import initCookieConsent from '../cookie-consent/cookie-consent';
|
|
|
7
7
|
import notify from './notify';
|
|
8
8
|
import antiCSRF from './anti-csrf';
|
|
9
9
|
import recaptcha from './recaptcha';
|
|
10
|
+
import { addSearchToLocalStorage } from './user-history';
|
|
11
|
+
|
|
10
12
|
import bookingCalendar from '../booking-calendar/booking-calendar';
|
|
11
13
|
import { setThemePreferences, setThemeSettings, setAuthenticityToken } from '../actions/app.actions';
|
|
12
14
|
import { fetchUser } from '../actions/user.actions';
|
|
@@ -89,16 +91,30 @@ const hfInitialize = () => {
|
|
|
89
91
|
store.dispatch(setThemeSettings(Homeflow.get('theme_settings')));
|
|
90
92
|
store.dispatch(setAuthenticityToken(Homeflow.get('authenticityToken')));
|
|
91
93
|
|
|
94
|
+
const pageRoute = Homeflow.get('page_route');
|
|
95
|
+
|
|
92
96
|
// if we're on the property show page, set next and previous links
|
|
93
|
-
if (
|
|
97
|
+
if (pageRoute === 'properties#show') {
|
|
94
98
|
store.dispatch(setPropertyLinksAsync());
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
// setting articles, pagination and topics on articles index page
|
|
98
|
-
if (
|
|
102
|
+
if (pageRoute === 'articles#index') {
|
|
99
103
|
store.dispatch(setArticles(Homeflow.get('articles')));
|
|
100
104
|
}
|
|
101
105
|
|
|
106
|
+
// Add search to add to userHstory in localStorage if this is a search results page
|
|
107
|
+
if (
|
|
108
|
+
pageRoute === 'properties#index'
|
|
109
|
+
|| pageRoute === 'postcodes#show'
|
|
110
|
+
|| pageRoute === 'locations#show'
|
|
111
|
+
|| pageRoute === 'counties#show'
|
|
112
|
+
|| pageRoute === 'countries#show'
|
|
113
|
+
) {
|
|
114
|
+
const { search: { currentSearch } } = store.getState();
|
|
115
|
+
addSearchToLocalStorage(currentSearch);
|
|
116
|
+
}
|
|
117
|
+
|
|
102
118
|
return null;
|
|
103
119
|
};
|
|
104
120
|
|
package/package.json
CHANGED
package/reducers/app.reducer.js
CHANGED
|
@@ -38,7 +38,7 @@ const appReducer = (state = INITIAL_STATE, action) => {
|
|
|
38
38
|
case AppActionTypes.SET_THEME_SETTINGS:
|
|
39
39
|
// Add default theme settings with values to set values Object
|
|
40
40
|
Object.keys(state.themeSettings).forEach((key) => {
|
|
41
|
-
if (state.themeSettings[key].default) {
|
|
41
|
+
if (typeof state.themeSettings[key].default !== 'undefined') {
|
|
42
42
|
defaultThemeSettingsObject[key] = state.themeSettings[key].default;
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -6,8 +6,6 @@ import { setSearch, setInitialSearch, setSearchField, setPlace } from '../../act
|
|
|
6
6
|
import propertySearch from '../property-search/property-search';
|
|
7
7
|
import parseFragment from '../property-search/parse-fragment';
|
|
8
8
|
import { isEmpty } from '../../utils';
|
|
9
|
-
import { addSearchToLocalStorage } from '../../app/user-history';
|
|
10
|
-
import store from '../../store';
|
|
11
9
|
|
|
12
10
|
class SearchForm extends Component {
|
|
13
11
|
componentDidMount() {
|
|
@@ -57,10 +55,6 @@ class SearchForm extends Component {
|
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
if (defaultChannel) setSearchField({ channel: defaultChannel });
|
|
60
|
-
|
|
61
|
-
// after search has been fully updated, add to userHstory in localStorage
|
|
62
|
-
const { search: { currentSearch } } = store.getState();
|
|
63
|
-
addSearchToLocalStorage(currentSearch);
|
|
64
58
|
}
|
|
65
59
|
|
|
66
60
|
handleSubmit(e) {
|