]> git.openstreetmap.org Git - rails.git/commitdiff
Changeset navigation by a particular user's changesets.
authorThomas Wood <grand.edgemaster@gmail.com>
Fri, 19 Jun 2009 23:56:15 +0000 (23:56 +0000)
committerThomas Wood <grand.edgemaster@gmail.com>
Fri, 19 Jun 2009 23:56:15 +0000 (23:56 +0000)
(Closes #1726)

app/controllers/browse_controller.rb
app/views/browse/_navigation.html.erb

index 8124d4a339ec2d509ff29e2fdffc9fa2cf7039f0..91d8eb84fa4b5e42ea49d45cb118a6565d9e5e10 100644 (file)
@@ -69,7 +69,10 @@ class BrowseController < ApplicationController
       
     @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
     @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] ) 
       
     @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
     @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] ) 
-    @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] ) 
+    @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
+
+    @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
+    @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
   rescue ActiveRecord::RecordNotFound
     @type = "changeset"
     render :action => "not_found", :status => :not_found
   rescue ActiveRecord::RecordNotFound
     @type = "changeset"
     render :action => "not_found", :status => :not_found
index 57e724d4258a7a907f03475ac01f7fa6c02d971a..5cfb1be3a2809c9c0042a7c99c89cd1f6e53018c 100644 (file)
@@ -1,4 +1,21 @@
 <div style="float:right; text-align:center; width: 250px;">
 <div style="float:right; text-align:center; width: 250px;">
+  <% if @next_by_user or @prev_by_user %>
+    <% if @prev_by_user %>
+      &lt;
+      <%= link_to @prev_by_user.id.to_s, :id => @prev_by_user.id %>
+    <% end %>
+    |
+    <%=
+    user = (@prev_by_user || @next_by_user).user.display_name
+    link_to(h(user), :controller => "changeset", :action => "list", :display_name => user)
+    %>
+    |
+    <% if @next_by_user %>
+      <%= link_to @next_by_user.id.to_s, :id => @next_by_user.id %>
+      &gt;
+    <% end %>
+    <br/>
+  <% end %>
   <% if @prev %>
     &lt;
     <%= link_to @prev.id.to_s, :id => @prev.id %>
   <% if @prev %>
     &lt;
     <%= link_to @prev.id.to_s, :id => @prev.id %>