##// END OF EJS Templates
Dry Users API responders....
Jean-Philippe Lang -
r4340:ea59d93dc82d
parent child
Show More
@@ -49,8 +49,7 class UsersController < ApplicationController
49 49
50 50 respond_to do |format|
51 51 format.html { render :layout => !request.xhr? }
52 format.json { render :template => 'users/index.apit' }
53 format.xml { render :template => 'users/index.apit' }
52 format.api { render :template => 'users/index.apit' }
54 53 end
55 54 end
56 55
@@ -72,8 +71,7 class UsersController < ApplicationController
72 71
73 72 respond_to do |format|
74 73 format.html { render :layout => 'base' }
75 format.json { render :template => 'users/show.apit' }
76 format.xml { render :template => 'users/show.apit' }
74 format.api { render :template => 'users/show.apit' }
77 75 end
78 76 rescue ActiveRecord::RecordNotFound
79 77 render_404
@@ -116,8 +114,7 class UsersController < ApplicationController
116 114 {:controller => 'users', :action => 'edit', :id => @user}
117 115 )
118 116 }
119 format.json { render :template => 'users/show.apit', :status => :created, :location => user_url(@user) }
120 format.xml { render :template => 'users/show.apit', :status => :created, :location => user_url(@user) }
117 format.api { render :template => 'users/show.apit', :status => :created, :location => user_url(@user) }
121 118 end
122 119 else
123 120 @auth_sources = AuthSource.find(:all)
@@ -175,8 +172,7 class UsersController < ApplicationController
175 172 flash[:notice] = l(:notice_successful_update)
176 173 redirect_to :back
177 174 }
178 format.json { head :ok }
179 format.xml { head :ok }
175 format.api { head :ok }
180 176 end
181 177 else
182 178 @auth_sources = AuthSource.find(:all)
@@ -92,3 +92,13 module I18n
92 92 end
93 93 end
94 94 end
95
96 module ActionController
97 module MimeResponds
98 class Responder
99 def api(&block)
100 any(:xml, :json, &block)
101 end
102 end
103 end
104 end
General Comments 0
You need to be logged in to leave comments. Login now