homeflowjs 0.11.10 → 0.12.0
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 +36 -0
- package/package.json +1 -1
- package/reducers/search.reducer.js +1 -0
- package/search/property-search/constants.js +1 -0
- package/search/property-search/parse-fragment.js +5 -0
- package/search/property-search/property-search.js +2 -0
- package/search/search-form/search-form.component.jsx +0 -24
package/app/hf-initialize.jsx
CHANGED
@@ -14,7 +14,10 @@ import { fetchUser } from '../actions/user.actions';
|
|
14
14
|
import {
|
15
15
|
setProperties, setPagination, setProperty, setPropertyLinksAsync,
|
16
16
|
} from '../actions/properties.actions';
|
17
|
+
import { setSearch, setInitialSearch, setSearchField, setPlace } from '../actions/search.actions';
|
17
18
|
import { setArticles } from '../actions/articles.actions';
|
19
|
+
import parseFragment from '../search/property-search/parse-fragment';
|
20
|
+
import { isEmpty } from '../utils';
|
18
21
|
|
19
22
|
const hfInitialize = () => {
|
20
23
|
if (!window.Homeflow) {
|
@@ -102,6 +105,39 @@ const hfInitialize = () => {
|
|
102
105
|
store.dispatch(setArticles(Homeflow.get('articles')));
|
103
106
|
}
|
104
107
|
|
108
|
+
if (pageRoute === 'properties#index') {
|
109
|
+
const searchFromFragment = parseFragment(window.location.pathname);
|
110
|
+
const defaultStatus = store.getState().app.themePreferences.default_search_status;
|
111
|
+
|
112
|
+
if (!isEmpty(searchFromFragment)) {
|
113
|
+
if (defaultStatus && !searchFromFragment.status) {
|
114
|
+
searchFromFragment.status = defaultStatus;
|
115
|
+
}
|
116
|
+
|
117
|
+
const branchID = Homeflow.get('branch_id');
|
118
|
+
if (branchID) searchFromFragment.branch_id = branchID;
|
119
|
+
|
120
|
+
store.dispatch(setInitialSearch(searchFromFragment));
|
121
|
+
store.dispatch(setSearch(searchFromFragment));
|
122
|
+
} else {
|
123
|
+
if (defaultStatus && !search.status) store.dispatch(setSearchField({ status: defaultStatus }));
|
124
|
+
}
|
125
|
+
|
126
|
+
const place = Homeflow.get('place');
|
127
|
+
if (place) {
|
128
|
+
store.dispatch(setPlace(place));
|
129
|
+
store.dispatch(setInitialSearch({
|
130
|
+
q: place.name + (place.county_name ? `, ${place.county_name}` : ''),
|
131
|
+
place,
|
132
|
+
}));
|
133
|
+
}
|
134
|
+
const expandedPolygon = Homeflow.get('expanded_polygon');
|
135
|
+
if (expandedPolygon) {
|
136
|
+
store.dispatch(setSearchField({ expandedPolygon }));
|
137
|
+
store.dispatch(setInitialSearch({ expandedPolygon }));
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
105
141
|
return null;
|
106
142
|
};
|
107
143
|
|
package/package.json
CHANGED
@@ -41,6 +41,11 @@ export default (fragment) => {
|
|
41
41
|
return;
|
42
42
|
}
|
43
43
|
|
44
|
+
if (part.startsWith('auction-date-')) {
|
45
|
+
search.auctionDate = part.replace('auction-date-', '');
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
44
49
|
if (part.startsWith('gid-')) {
|
45
50
|
search.placeId = part.replace(/^gid-/, '');
|
46
51
|
return;
|
@@ -12,6 +12,8 @@ const fragmentize = (key, value) => {
|
|
12
12
|
|
13
13
|
if (key === 'poly') return pattern[0] + base64.encode(value);
|
14
14
|
|
15
|
+
if (key === 'auctionDate') return `${pattern}${value}`;
|
16
|
+
|
15
17
|
if (typeof pattern === 'string') return pattern;
|
16
18
|
|
17
19
|
return `${pattern[0] ? pattern[0] : ''}${value}${pattern[1] ? pattern[1] : ''}`;
|
@@ -26,32 +26,8 @@ class SearchForm extends Component {
|
|
26
26
|
if (defaultSort && !searchFromFragment.sorted) {
|
27
27
|
searchFromFragment.sorted = defaultSort;
|
28
28
|
}
|
29
|
-
if (defaultStatus && !searchFromFragment.status) {
|
30
|
-
searchFromFragment.status = defaultStatus;
|
31
|
-
}
|
32
|
-
|
33
|
-
const branchID = Homeflow.get('branch_id');
|
34
|
-
if (branchID) searchFromFragment.branch_id = branchID;
|
35
|
-
|
36
|
-
setInitialSearch(searchFromFragment);
|
37
|
-
setSearch(searchFromFragment);
|
38
29
|
} else {
|
39
30
|
if (defaultSort && !search.sorted) setSearchField({ sorted: defaultSort });
|
40
|
-
if (defaultStatus && !search.status) setSearchField({ status: defaultStatus });
|
41
|
-
}
|
42
|
-
|
43
|
-
const place = Homeflow.get('place');
|
44
|
-
if (place) {
|
45
|
-
setPlace(place);
|
46
|
-
setInitialSearch({
|
47
|
-
q: place.name + (place.county_name ? `, ${place.county_name}` : ''),
|
48
|
-
place,
|
49
|
-
});
|
50
|
-
}
|
51
|
-
const expandedPolygon = Homeflow.get('expanded_polygon');
|
52
|
-
if (expandedPolygon) {
|
53
|
-
setSearchField({ expandedPolygon });
|
54
|
-
setInitialSearch({ expandedPolygon });
|
55
31
|
}
|
56
32
|
|
57
33
|
if (defaultChannel) setSearchField({ channel: defaultChannel });
|