From 224921460a0a3d9c97813e4a64f0903adffff22f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 4 Dec 2010 17:43:39 +0000 Subject: Adds a pseudo format to api template names and overrides ActionController#default_template so that api templates are chosen automatically. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4466 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/users/show.api.rsb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/views/users/show.api.rsb (limited to 'app/views/users/show.api.rsb') diff --git a/app/views/users/show.api.rsb b/app/views/users/show.api.rsb new file mode 100644 index 000000000..6c3dd9018 --- /dev/null +++ b/app/views/users/show.api.rsb @@ -0,0 +1,28 @@ +api.user do + api.id @user.id + api.login @user.login if User.current.admin? + api.firstname @user.firstname + api.lastname @user.lastname + api.mail @user.mail if User.current.admin? || !@user.pref.hide_mail + api.created_on @user.created_on + api.last_login_on @user.last_login_on + + api.array :custom_fields do + @user.visible_custom_field_values.each do |custom_value| + api.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name + end + end unless @user.visible_custom_field_values.empty? + + api.array :memberships do + @memberships.each do |membership| + api.membership do + api.project :id => membership.project.id, :name => membership.project.name + api.array :roles do + membership.roles.each do |role| + api.role :id => role.id, :name => role.name + end + end + end if membership.project + end + end if @memberships.present? +end -- cgit v1.2.3