Commit 41d9a37d authored by Piotr Gawron's avatar Piotr Gawron

Merge branch '383-overview-image-link-to-search-results-doesn-t-work' into 'devel_11.0.x'

Resolve "overview image link to search results doesn't work"

See merge request piotr.gawron/minerva!288
parents f5545817 1bc98c6e
minerva (11.0.10) stable; urgency=medium
* Bug fix: link from overview image to search result was broken
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 16 Apr 2018 15:00:00 +0200
minerva (11.0.9) stable; urgency=medium
* Bug fix: some comment couldn't be loaded
* Bug fix: when adding comment it didn't appear on map immediately
......
......@@ -197,8 +197,9 @@ OverviewDialog.prototype.openLink = function(link) {
self.showOverview(link.imageLinkId);
} else if (link.type === "OverviewSearchLink") {
logger.debug("Sending search query. Query: " + link.query);
GuiConnector.search(link.query);
$(self.getElement()).dialog("close");
return map.getOverlayByName("search").searchByQuery(link.query, false, true).then(function(){
$(self.getElement()).dialog("close");
});
} else {
logger.warn("Unknown type of link: " + link.type + ". Don't know what to do... LinkId: " + link.idObject);
}
......
......@@ -12,17 +12,17 @@ var chai = require('chai');
var assert = chai.assert;
var logger = require('../logger');
describe('OverviewDialog', function() {
describe('OverviewDialog', function () {
it('open image', function() {
it('open image', function () {
helper.setUrl("http://test/?id=complex_model_with_images");
return ServerConnector.getProject().then(function(project) {
return ServerConnector.getProject().then(function (project) {
var options = helper.createOptions(project);
var map = new CustomMap(options);
var dialog = new OverviewDialog({
element : testDiv,
customMap : map
element: testDiv,
customMap: map
});
dialog.showOverview(project.getOverviewImages()[1].idObject);
......@@ -30,15 +30,15 @@ describe('OverviewDialog', function() {
});
});
it('open invalid image', function() {
it('open invalid image', function () {
helper.setUrl("http://test/?id=complex_model_with_images");
return ServerConnector.getProject().then(function(project) {
return ServerConnector.getProject().then(function (project) {
var options = helper.createOptions(project);
var map = new CustomMap(options);
var dialog = new OverviewDialog({
element : testDiv,
customMap : map
element: testDiv,
customMap: map
});
dialog.showOverview(-1123);
......@@ -46,22 +46,22 @@ describe('OverviewDialog', function() {
});
});
describe('openLink', function() {
it('link to map', function() {
describe('openLink', function () {
it('link to map', function () {
helper.setUrl("http://test/?id=complex_model_with_images");
return ServerConnector.getProject().then(function(project) {
return ServerConnector.getProject().then(function (project) {
var options = helper.createOptions(project);
var map = new CustomMap(options);
var dialog = new OverviewDialog({
element : testDiv,
customMap : map
element: testDiv,
customMap: map
});
dialog.openLink({
type : "OverviewModelLink",
modelLinkId : map.getId(),
latLng : new google.maps.LatLng(1, 34)
type: "OverviewModelLink",
modelLinkId: map.getId(),
latLng: new google.maps.LatLng(1, 34)
});
assert.equal(logger.getWarnings().length, 0);
assert.equal(1, map.getGoogleMap().getCenter().lat());
......@@ -69,6 +69,29 @@ describe('OverviewDialog', function() {
dialog.destroy();
});
});
it('link to search result', function () {
var overlay, dialog;
return ServerConnector.getProject().then(function (project) {
var options = helper.createOptions(project);
var map = new CustomMap(options);
overlay = helper.createSearchDbOverlay(map);
dialog = new OverviewDialog({
element: testDiv,
customMap: map
});
return dialog.openLink({
type: "OverviewSearchLink",
query: "s1"
});
}).then(function () {
assert.equal(logger.getWarnings().length, 0);
var query = overlay.decodeQuery(overlay.getQueries()[0]);
assert.equal(query.query, "s1");
dialog.destroy();
});
});
});
});
-- empty file to force directory to be commited to git repo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment