Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch back to typeahead 0.10.5 #849

Merged
merged 4 commits into from
Sep 3, 2015
Merged
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
1 change: 1 addition & 0 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
".build/externs/angular-1.4-http-promise_templated.js",
"geoportailv3/externs/fuse.js",
"geoportailv3/externs/twbootstrap.js",
"geoportailv3/externs/typeahead.js",
".build/externs/jquery-1.9.js"
],
"define": [
Expand Down
12 changes: 12 additions & 0 deletions geoportailv3/externs/typeahead.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @fileoverview Extern definitions for typeahead.
* @externs
*/


/**
* displayKey was replaced by display in typeahead v0.11.1. So we need this
* extra extern definition so long that we use v0.10.5.
* @type {string|undefined}
*/
TypeaheadDataset.prototype.displayKey;
11 changes: 4 additions & 7 deletions geoportailv3/static/js/search/searchdirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ app.SearchDirectiveController = function($scope, $compile, gettextCatalog,
source: goog.bind(function(query, syncResults) {
return syncResults(this.matchCoordinate_(query));
}, this),
display: function(suggestion) {
displayKey: function(suggestion) {
var feature = /** @type {ol.Feature} */ (suggestion);
return feature.get('label');
},
Expand Down Expand Up @@ -315,7 +315,7 @@ app.SearchDirectiveController = function($scope, $compile, gettextCatalog,
* @param {Object} suggestion
* @return {string}
*/
display: function(suggestion) {
displayKey: function(suggestion) {
return suggestion['translatedName'];
},
templates: /** @type {TypeaheadTemplates} */({
Expand Down Expand Up @@ -351,7 +351,7 @@ app.SearchDirectiveController = function($scope, $compile, gettextCatalog,
* @param {app.BackgroundLayerSuggestion} suggestion
* @return {string}
*/
display: function(suggestion) {
displayKey: function(suggestion) {
return suggestion['translatedName'];
},
templates: /** @type {TypeaheadTemplates} */({
Expand All @@ -376,10 +376,7 @@ app.SearchDirectiveController = function($scope, $compile, gettextCatalog,
},{
name: 'pois',
source: POIBloodhoundEngine.ttAdapter(),
// Use a large number for "limit" here. This is to work around a bug
// in typeahead.js: https://github.com/twitter/typeahead.js/pull/1319
limit: 50,
display: function(suggestion) {
displayKey: function(suggestion) {
var feature = /** @type {ol.Feature} */ (suggestion);
return feature.get('label');
},
Expand Down
6 changes: 3 additions & 3 deletions geoportailv3/static/less/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ span.twitter-typeahead {
padding-left: 32px;
width: auto;
}
.tt-menu {
.tt-dropdown-menu {
position: absolute;
top: 100%;
left: 0;
Expand All @@ -56,7 +56,7 @@ span.twitter-typeahead {
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
}
.tt-suggestion {
.tt-suggestion > p {
display: block;
padding: 3px 20px;
margin-bottom: 0px;
Expand Down Expand Up @@ -134,7 +134,7 @@ span.twitter-typeahead {
width: 100%;
}

span.twitter-typeahead .tt-menu {
span.twitter-typeahead .tt-dropdown-menu {
width: 100%;
}
}
Expand Down
2 changes: 1 addition & 1 deletion geoportailv3/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ <h2 translate>infos</h2>
<script src="${request.static_url('%s/ngeo/utils/watchwatchers.js' % node_modules_path)}"></script>
<script src="${request.static_url('%s/proj4/dist/proj4-src.js' % node_modules_path)}"></script>
<script src="${request.static_url('%s/d3/d3.min.js' % node_modules_path)}"></script>
<script src="${request.static_url('%s/typeahead.js/dist/typeahead.bundle.min.js' % node_modules_path)}"></script>
<script src="${request.static_url('%s/typeahead.js/dist/typeahead.bundle.js' % node_modules_path)}"></script>
<script src="${request.static_url('%s/fuse.js/src/fuse.js' % node_modules_path)}"></script>
% else:
<script src="${request.static_url('geoportailv3:static/build/build.js')}"></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"openlayers": "git+https://github.com/openlayers/ol3#master",
"proj4": "2.3.3",
"phantomjs": "~1.9.7-5",
"typeahead.js": "0.11.1",
"typeahead.js": "~0.10.5",
"temp": "~0.7.0",
"walk": "~2.3.3",
"d3": "3.5.5",
Expand Down