gem 'http_accept_language', '>= 1.0.2'
gem 'paperclip', '~> 2.0'
gem 'deadlock_retry', '>= 1.2.0'
+ gem 'i18n-js', '>= 3.0.0.rc2'
+gem 'jsonify-rails'
# We need ruby-openid 2.2.0 or later for ruby 1.9 support
gem 'ruby-openid', '>= 2.2.0'
//= require jquery_ujs
//= require jquery.autogrowtextarea
//= require jquery.timers
+ //= require jquery.cookie
+ //= require augment
+ //= require openlayers
+ //= require i18n/translations
+ //= require globals
+ //= require params
+ //= require piwik
+ //= require browse
+ //= require export
+ //= require map
+ //= require key
+ //= require menu
+ //= require sidebar
+ //= require richtext
+ //= require resize
++//= require notes
+
+ function zoomPrecision(zoom) {
+ var decimals = Math.pow(10, Math.floor(zoom/3));
+ return function(x) {
+ return Math.round(x * decimals) / decimals;
+ };
+ }
/*
* Called as the user scrolls/zooms around to aniplate hrefs of the
end
end
end
-
- private
-
- def javascript_strings_for_key(key)
- js = ""
- value = I18n.t(key, :locale => "en")
-
- if value.is_a?(String)
- js << "i18n_strings['#{key}'] = '" << escape_javascript(t(key)) << "';\n"
- else
- value.each_key do |k|
- js << javascript_strings_for_key("#{key}.#{k}")
- end
- end
-
- return js
- end
+
+ def friendly_date(date)
+ content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
+ end
+
+ def note_author(object, link_options = {})
+ if object.author.nil?
+ h(object.author_name)
+ else
+ link_to h(object.author_name), link_options.merge({:controller => "user", :action => "view", :display_name => object.author_name})
+ end
+ end
end
</ul>
</div>
-<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
+<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>
<script type="text/javascript">
- OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
-
function remoteEditHandler(event, bbox, select) {
var left = bbox.left - 0.0001;
var top = bbox.top + 0.0001;
<% unless STATUS == :api_offline or STATUS == :database_offline -%>
<% content_for :editmenu do -%>
- <li><%= link_to t("browse.start_rjs.data_layer_name"), "#", :id => "show_data" %></li>
+ <li><%= link_to t("browse.start_rjs.notes_layer_name"), "#", :id => "show_notes" %></li>
+ <li><%= link_to t("browse.start_rjs.data_layer_name"), { :controller => :browse, :action => :start }, :id => "show_data" %></li>
<% end -%>
<% end -%>
<script type="text/javascript">
var marker;
var map;
-
- OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
+ var params = OSM.mapParams();
+ <% if @user %>
+ var loginName = "<%= @user.display_name %>"
+ <% end %>
+
function mapInit(){
map = createMap("map");
- <% unless object_zoom %>
- <% if bbox %>
- var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
+ <% unless STATUS == :api_offline or STATUS == :database_offline %>
+ map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", {
+ visibility: false,
+ displayInLayerSwitcher: false
+ });
+ map.addLayer(map.dataLayer);
+
+ map.noteLayer = addNoteLayer(map, "<%= notes_url :format => 'json' %>", $("#createnoteanchor"), 11);
+
+ <% if params[:notes] == "yes" -%>
+ map.noteLayer.setVisibility(true);
+ <% end -%>
+ <% end %>
+
+ if (!params.object_zoom) {
+ if (params.bbox) {
+ var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat);
map.zoomToExtent(proj(bbox));
}
$(document).ready(function () {
- $("#show_data").click(function () {
- $.ajax({ url: "<%= url_for :controller => :browse, :action => :start %>" });
+ $("#show_notes").click(function () {
+ map.noteLayer.setVisibility(true);
+ });
+
+ $("#show_data").click(function (e) {
+ $.ajax({ url: $(this).attr('href'), success: function (sidebarHtml) {
+ startBrowse(sidebarHtml);
+ }});
+ e.preventDefault();
});
$("body").on("click", "a.set_position", function () {