]> git.openstreetmap.org Git - rails.git/commitdiff
add support for closing changesets
authorChristopher Schmidt <crschmidt@crschmidt.net>
Sun, 11 May 2008 21:18:42 +0000 (21:18 +0000)
committerChristopher Schmidt <crschmidt@crschmidt.net>
Sun, 11 May 2008 21:18:42 +0000 (21:18 +0000)
app/controllers/changeset_controller.rb
config/routes.rb

index 3e88eeec32b0425b10ca47c92cc90b057814b8fe..9994a6b1e6c989be5968b0157fe263a0ca500921 100644 (file)
@@ -54,6 +54,21 @@ class ChangesetController < ApplicationController
       render :nothing => true, :status => :not_found
     end
   end
       render :nothing => true, :status => :not_found
     end
   end
+  
+  def close 
+    begin
+      if not request.put?
+        render :nothing => true, :status => :method_not_allowed
+        return
+      end
+      changeset = Changeset.find(params[:id])
+      changeset.open = false
+      changeset.save
+      render :nothing => true
+    rescue ActiveRecord::RecordNotFound
+      render :nothing => true, :status => :not_found
+    end
+  end
 
   def upload
     if not request.put?
 
   def upload
     if not request.put?
index 9196fae1bb9ebad870a6223e65e9ae3dd803d935..581310068f4fe2e8c15ff34691929bdb39c7b657 100644 (file)
@@ -3,6 +3,7 @@ ActionController::Routing::Routes.draw do |map|
   # API
   map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
   map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read'
   # API
   map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
   map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read'
+  map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close'
   map.connect "api/#{API_VERSION}/changeset/upload", :controller => 'changeset', :action => 'upload'
   
   map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
   map.connect "api/#{API_VERSION}/changeset/upload", :controller => 'changeset', :action => 'upload'
   
   map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'