diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index a77b0f94a..cb866eb3f 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -78,6 +78,15 @@ class BrowseController < ApplicationController render :action => "not_found", :status => :not_found end + def bug + @type = "bug" + @bug = MapBug.find(params[:id]) + @next = MapBug.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @bug.id }] ) + @prev = MapBug.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @bug.id }] ) + rescue ActiveRecord::RecordNotFound + render :action => "not_found", :status => :not_found + end + private def timeout diff --git a/app/models/map_bug.rb b/app/models/map_bug.rb index 18e6ab270..74b6b3191 100644 --- a/app/models/map_bug.rb +++ b/app/models/map_bug.rb @@ -49,4 +49,8 @@ class MapBug < ActiveRecord::Base end + def visible + return status != "hidden" + end + end diff --git a/app/models/map_bug_comment.rb b/app/models/map_bug_comment.rb index 9839cae45..945b1b2f7 100644 --- a/app/models/map_bug_comment.rb +++ b/app/models/map_bug_comment.rb @@ -3,8 +3,7 @@ class MapBugComment < ActiveRecord::Base set_table_name 'map_bug_comment' belongs_to :map_bug, :foreign_key => 'bug_id' - - + belongs_to :user, :foreign_key => 'commenter_id' validates_presence_of :id, :on => :update validates_uniqueness_of :id diff --git a/app/views/browse/_map.html.erb b/app/views/browse/_map.html.erb index 5bb83b6bf..5d7285840 100644 --- a/app/views/browse/_map.html.erb +++ b/app/views/browse/_map.html.erb @@ -40,6 +40,14 @@ $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes'; $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>"; + <% else if map.instance_of? MapBug %> + $("loading").innerHTML = ""; + var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>); + var zoom = 16; + setMapCenter(centre, zoom); + marker = addMarkerToMap(centre); + $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>'; + $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>"; <% else %> var obj_type = "<%= map.class.name.downcase %>"; var obj_id = <%= map.id %>; @@ -66,7 +74,7 @@ $("small_map").style.display = "none"; } }); - <% end %> + <% end end %> } window.onload = init; diff --git a/app/views/browse/bug.html.erb b/app/views/browse/bug.html.erb new file mode 100644 index 000000000..5c65b3e41 --- /dev/null +++ b/app/views/browse/bug.html.erb @@ -0,0 +1,87 @@ +
+ + <% if @bug.status == "closed" %> + <%= image_tag("closed_bug_marker.png", :alt => 'closed') %> + <%= t'browse.bug.closed_title', :bug_name => @bug.id %> + <% else %> + <%= image_tag("open_bug_marker.png", :alt => 'open') %> + <%= t'browse.bug.open_title', :bug_name => @bug.id %> + <% end %> ++ |
+ + <%= render :partial => "navigation" %> + | +||||||||||||||||||
+
+ + <%if @bug.map_bug_comment.length > 1 %> + +
+ + |
+ <%= render :partial => "map", :object => @bug %>
+