diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 9d156ea1d1..7d95b8f54f 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -274,6 +274,24 @@ def search end end + ## + # Return a list of the latest notes + def latest + # Get any conditions that need to be applied + @notes = closed_condition(Note.all) + + # Find the notes we want to return + @notes = @notes.order("updated_at DESC").limit(result_limit).preload(:comments) + + # Render the result + respond_to do |format| + format.rss { render :action => :index } + format.xml { render :action => :index } + format.json { render :action => :index } + format.gpx { render :action => :index } + end + end + ## # Display a list of notes by a specified user def mine diff --git a/config/routes.rb b/config/routes.rb index 6a3efe3b05..7622ed6f9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,6 +91,7 @@ resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :defaults => { :format => "xml" } do collection do get "search" + get "latest" get "feed", :defaults => { :format => "rss" } end