X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b0453833b1e699a65ba1e9918eb8a5d8e02eb6e0..7ad58d1411289ad241a49abb87e414ff13b60173:/app/views/browse/start.js.erb diff --git a/app/views/browse/start.js.erb b/app/views/browse/start.js.erb index 73ebff85f..1b57f48a0 100644 --- a/app/views/browse/start.js.erb +++ b/app/views/browse/start.js.erb @@ -35,6 +35,8 @@ function startBrowse() { map.events.register("moveend", map, updateData); map.events.triggerEvent("moveend"); + $("#browse_select_view").click(useMap); + $("#browse_select_box").click(startDrag); $("#browse_hide_areas_box").html("<%=j t 'browse.start_rjs.hide_areas' %>"); @@ -133,8 +135,6 @@ function showAreas() { useMap(true); } -$("#browse_select_view").click(useMap); - function endDrag(bbox) { var bounds = bbox.getBounds(); var projected = bounds.clone().transform(map.getProjectionObject(), epsg4326); @@ -149,13 +149,13 @@ function endDrag(bbox) { $("#browse_select_view").show(); } -function displayFeatureWarning(count, callback) { +function displayFeatureWarning(count, limit, callback) { clearStatus(); var div = document.createElement("div"); var p = document.createElement("p"); - p.appendChild(document.createTextNode(i18n("<%=j t 'browse.start_rjs.loaded_an_area_with_num_features' %>", { num_features: count }))); + p.appendChild(document.createTextNode(I18n.t("browse.start_rjs.loaded_an_area_with_num_features", { num_features: count, max_features: limit }))); div.appendChild(p); var input = document.createElement("input"); @@ -182,7 +182,7 @@ function customDataLoader(resp, options) { if (!this.maxFeatures || resp.features.length <= this.maxFeatures) { options.callback.call(options.scope, resp); } else { - displayFeatureWarning(resp.features.length, function () { + displayFeatureWarning(resp.features.length, this.maxFeatures, function () { options.callback.call(options.scope, resp); }); } @@ -194,7 +194,7 @@ function getData(bounds, reload) { var size = projected.getWidth() * projected.getHeight(); if (size > <%= MAX_REQUEST_AREA %>) { - setStatus(i18n("<%=j t 'browse.start_rjs.unable_to_load_size', :max_bbox_size => MAX_REQUEST_AREA %>", { bbox_size: size })); + setStatus(I18n.t("browse.start_rjs.unable_to_load_size", { max_bbox_size: <%= MAX_REQUEST_AREA %>, bbox_size: size })); } else { loadData("/api/<%= API_VERSION %>/map?bbox=" + projected.toBBOX(), reload); } @@ -295,7 +295,7 @@ function dataLoaded() { browseObjectList.appendChild(list); var link = document.createElement("a"); - link.href = this.url; + link.href = this.protocol.url; link.appendChild(document.createTextNode("<%=j t 'browse.start_rjs.object_list.api' %>")); browseObjectList.appendChild(link); @@ -441,7 +441,7 @@ function displayHistory(request) { table.appendChild(tr); var heading = document.createElement("td"); - heading.appendChild(document.createTextNode(i18n("<%=j t 'browse.start_rjs.history_for_feature' %>", { feature: featureNameHistory(this.feature) }))); + heading.appendChild(document.createTextNode(I18n.t("browse.start_rjs.history_for_feature", { feature: featureNameHistory(this.feature) }))); tr.appendChild(heading); var td = document.createElement("td"); @@ -462,7 +462,7 @@ function displayHistory(request) { var user = nodes[i].getAttribute("user") || "<%=j t 'browse.start_rjs.private_user' %>"; var timestamp = nodes[i].getAttribute("timestamp"); var item = document.createElement("li"); - item.appendChild(document.createTextNode(i18n("<%=j t 'browse.start_rjs.edited_by_user_at_timestamp' %>", { user: user, timestamp: timestamp }))); + item.appendChild(document.createTextNode(I18n.t("browse.start_rjs.edited_by_user_at_timestamp", { user: user, timestamp: timestamp }))); history.appendChild(item); } div.appendChild(history); @@ -502,9 +502,9 @@ function featureNameSelect(feature) { } else if (feature.attributes.name) { return feature.attributes.name; } else if (featureType(feature) == "node") { - return i18n("<%=j t 'browse.start_rjs.object_list.selected.type.node' %>", { id: feature.osm_id }); + return I18n.t("browse.start_rjs.object_list.selected.type.node", { id: feature.osm_id }); } else if (featureType(feature) == "way") { - return i18n("<%=j t 'browse.start_rjs.object_list.selected.type.way' %>", { id: feature.osm_id }); + return I18n.t("browse.start_rjs.object_list.selected.type.way", { id: feature.osm_id }); } } @@ -514,9 +514,9 @@ function featureNameHistory(feature) { } else if (feature.attributes.name) { return feature.attributes.name; } else if (featureType(feature) == "node") { - return i18n("<%=j t 'browse.start_rjs.object_list.history.type.node' %>", { id: feature.osm_id }); + return I18n.t("browse.start_rjs.object_list.history.type.node", { id: feature.osm_id }); } else if (featureType(feature) == "way") { - return i18n("<%=j t 'browse.start_rjs.object_list.history.type.way' %>", { id: feature.osm_id }); + return I18n.t("browse.start_rjs.object_list.history.type.way", { id: feature.osm_id }); } }