Use browser detection to decide how many features to show
Modern browsers are quite happy showing far more than 100 features in the data browser, so increase the limit to 2000 by default, but keep it restricted to 500 for IE8 and 100 for older IEs.
This commit is contained in:
parent
417db2c3c8
commit
652e94485f
4 changed files with 11 additions and 1 deletions
3
Gemfile
3
Gemfile
|
@ -25,6 +25,9 @@ gem 'http_accept_language', '>= 1.0.2'
|
|||
gem 'paperclip', '~> 2.0'
|
||||
gem 'deadlock_retry', '>= 1.2.0'
|
||||
|
||||
# Browser detection support
|
||||
gem 'browser'
|
||||
|
||||
# Markdown formatting support
|
||||
gem 'redcarpet'
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ GEM
|
|||
multi_json (~> 1.0)
|
||||
arel (3.0.2)
|
||||
bigdecimal (1.1.0)
|
||||
browser (0.1.3)
|
||||
builder (3.0.0)
|
||||
cocaine (0.2.1)
|
||||
coffee-rails (3.2.2)
|
||||
|
@ -157,6 +158,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
SystemTimer (>= 1.1.3)
|
||||
bigdecimal
|
||||
browser
|
||||
coffee-rails (~> 3.2.1)
|
||||
composite_primary_keys (= 5.0.4)
|
||||
deadlock_retry (>= 1.2.0)
|
||||
|
|
|
@ -7,6 +7,11 @@ class BrowseController < ApplicationController
|
|||
around_filter :web_timeout, :except => [:start]
|
||||
|
||||
def start
|
||||
@max_features = case
|
||||
when browser.ie? && browser.version.to_i < 8 then 100
|
||||
when browser.ie? && browser.version.to_i < 9 then 500
|
||||
else 2000
|
||||
end
|
||||
end
|
||||
|
||||
def relation
|
||||
|
|
|
@ -245,7 +245,7 @@ function loadGML(url, reload) {
|
|||
browseDataLayer = new OpenLayers.Layer.GML("Data", url, {
|
||||
format: OpenLayers.Format.OSM,
|
||||
formatOptions: formatOptions,
|
||||
maxFeatures: 100,
|
||||
maxFeatures: <%= @max_features %>,
|
||||
requestSuccess: customDataLoader,
|
||||
displayInLayerSwitcher: false,
|
||||
styleMap: new OpenLayers.StyleMap({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue