mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-07 22:06:04 -06:00
Merge pull request #153 from openclassify/dia
Default country in listing #152
This commit is contained in:
commit
b9e9743a3b
@ -35,13 +35,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var select_trans = "{{ trans('visiosoft.module.advs::field.pick_option') }}";
|
var select_trans = "{{ trans('visiosoft.module.advs::field.pick_option') }}";
|
||||||
|
var searchedCountry = {{ searchedCountry }};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if entries('advs').isEnabled('favs') %}
|
{% if entries('advs').isEnabled('favs') %}
|
||||||
|
|||||||
@ -146,6 +146,18 @@ class AdvsController extends PublicController
|
|||||||
$subCats = array();
|
$subCats = array();
|
||||||
|
|
||||||
$param = $this->requestHttp->toArray();
|
$param = $this->requestHttp->toArray();
|
||||||
|
if (!isset($param['country'])) {
|
||||||
|
if (is_null(Cookie::get('country'))) {
|
||||||
|
$param['country'] = setting_value('visiosoft.module.advs::default_country');
|
||||||
|
} else {
|
||||||
|
$param['country'] = Cookie::get('country');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($param['country'] != setting_value('visiosoft.module.advs::default_country')) {
|
||||||
|
Cookie::queue(Cookie::make('country', $param['country'], 84000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$searchedCountry = $param['country'];
|
||||||
|
|
||||||
$countries = $this->country_repository->viewAll();
|
$countries = $this->country_repository->viewAll();
|
||||||
|
|
||||||
@ -213,7 +225,7 @@ class AdvsController extends PublicController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'textfields', 'checkboxes', 'request',
|
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'textfields', 'checkboxes', 'request',
|
||||||
'user', 'userProfile', 'featured_advs', 'type', 'topfields', 'ranges', 'seenList');
|
'user', 'userProfile', 'featured_advs', 'type', 'topfields', 'ranges', 'seenList', 'searchedCountry');
|
||||||
|
|
||||||
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
Cookie::queue(Cookie::make('last_search', $this->requestHttp->getRequestUri(), 84000));
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,15 @@ FindLocations = (id, table, typeDb, divId, paramName = null) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set selected country in the select menu
|
||||||
|
if (searchParams.get('country') == null) {
|
||||||
|
$('#cities').empty();
|
||||||
|
var table = "cities";
|
||||||
|
var typeDb = 'parent_country_id';
|
||||||
|
var id = searchedCountry;
|
||||||
|
var divId = "#cities";
|
||||||
|
FindLocations(id, table, typeDb, divId);
|
||||||
|
}
|
||||||
|
|
||||||
setLocations = (response, id, table, typeDb, divId, paramName) => {
|
setLocations = (response, id, table, typeDb, divId, paramName) => {
|
||||||
|
|
||||||
@ -40,7 +49,7 @@ setLocations = (response, id, table, typeDb, divId, paramName) => {
|
|||||||
//Set Selected Option
|
//Set Selected Option
|
||||||
if (paramName != null) {
|
if (paramName != null) {
|
||||||
if (divId == "#cities") {
|
if (divId == "#cities") {
|
||||||
$('#countries').val(searchParams.get('country'));
|
$('#countries').val(searchedCountry);
|
||||||
$('#countries').select2();
|
$('#countries').select2();
|
||||||
$('#cities').val(findParam("city[]"));
|
$('#cities').val(findParam("city[]"));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user