Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function index(): TemplateResponse {
$this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());

$params = array('user' => $this->userId);
$searchString = $this->request->getParam('search');
$params['search'] = $searchString;
$this->initialStateService->provideInitialState($this->appName, 'photos', $this->config->getAppValue('photos', 'enabled', 'no') === 'yes');
$response = new TemplateResponse('maps', 'index', $params);

Expand Down
19 changes: 15 additions & 4 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ import { brify, getUrlParameter, formatAddress } from './utils';
});
},

restoreOptions: function () {
restoreOptions: function (afterRestore) {
var that = this;
var url = generateUrl('/apps/maps/getOptionsValues');
var req = {};
var optionsValues = {};
afterRestore = afterRestore || function() {};
$.ajax({
type: 'POST',
url: url,
Expand Down Expand Up @@ -366,10 +367,15 @@ import { brify, getUrlParameter, formatAddress } from './utils';
//if (optionsValues.hasOwnProperty('routingEnabled') && optionsValues.routingEnabled === 'true') {
// routingController.toggleRouting();
//}

afterRestore();

}).fail(function() {
OC.Notification.showTemporary(
t('maps', 'Failed to restore options values')
);

afterRestore();
});
}
};
Expand Down Expand Up @@ -2139,8 +2145,14 @@ import { brify, getUrlParameter, formatAddress } from './utils';
searchController.initController(mapController.map);

// once controllers have been set/initialized, we can restore option values from server
optionsController.restoreOptions();
geoLinkController.showLinkLocation();
optionsController.restoreOptions(function() {
geoLinkController.showLinkLocation();
if ($('#search-term').val() !== '') {
mapController.locControl.stop();
searchController.setSearchAutocomplete(searchController.SEARCH_BAR);
searchController.submitSearchForm();
}
});

// Popup
$(document).on('click', '#opening-hours-header', function() {
Expand Down Expand Up @@ -2240,4 +2252,3 @@ import { brify, getUrlParameter, formatAddress } from './utils';
});

})(jQuery, OC);

2 changes: 1 addition & 1 deletion templates/content/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
?>
<div id="search">
<form id="search-form">
<input type="text" placeholder="<?php p($l->t('Search…')); ?>" id="search-term" />
<input type="text" placeholder="<?php p($l->t('Search…')); ?>" id="search-term" value="<?php p($_['search']); ?>" />
<input type="submit" id="search-submit" value="" class="icon-search">
<button id="route-submit" class=""><i class="fas fa-route" aria-hidden="true"></i></button>
</form>
Expand Down