##// 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 respond_to do |format|
50 respond_to do |format|
51 format.html { render :layout => !request.xhr? }
51 format.html { render :layout => !request.xhr? }
52 format.json { render :template => 'users/index.apit' }
52 format.api { render :template => 'users/index.apit' }
53 format.xml { render :template => 'users/index.apit' }
54 end
53 end
55 end
54 end
56
55
@@ -72,8 +71,7 class UsersController < ApplicationController
72
71
73 respond_to do |format|
72 respond_to do |format|
74 format.html { render :layout => 'base' }
73 format.html { render :layout => 'base' }
75 format.json { render :template => 'users/show.apit' }
74 format.api { render :template => 'users/show.apit' }
76 format.xml { render :template => 'users/show.apit' }
77 end
75 end
78 rescue ActiveRecord::RecordNotFound
76 rescue ActiveRecord::RecordNotFound
79 render_404
77 render_404
@@ -116,8 +114,7 class UsersController < ApplicationController
116 {:controller => 'users', :action => 'edit', :id => @user}
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) }
117 format.api { 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) }
121 end
118 end
122 else
119 else
123 @auth_sources = AuthSource.find(:all)
120 @auth_sources = AuthSource.find(:all)
@@ -175,8 +172,7 class UsersController < ApplicationController
175 flash[:notice] = l(:notice_successful_update)
172 flash[:notice] = l(:notice_successful_update)
176 redirect_to :back
173 redirect_to :back
177 }
174 }
178 format.json { head :ok }
175 format.api { head :ok }
179 format.xml { head :ok }
180 end
176 end
181 else
177 else
182 @auth_sources = AuthSource.find(:all)
178 @auth_sources = AuthSource.find(:all)
@@ -92,3 +92,13 module I18n
92 end
92 end
93 end
93 end
94 end
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