diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-04 17:43:39 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-04 17:43:39 +0000 |
commit | 224921460a0a3d9c97813e4a64f0903adffff22f (patch) | |
tree | 76234577050b11dec0f6b79af2461b8e2359a199 /app/views/users/show.api.rsb | |
parent | 915748204965bb7f9704b55554e30f091934138e (diff) | |
download | redmine-224921460a0a3d9c97813e4a64f0903adffff22f.tar.gz redmine-224921460a0a3d9c97813e4a64f0903adffff22f.zip |
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
Diffstat (limited to 'app/views/users/show.api.rsb')
-rw-r--r-- | app/views/users/show.api.rsb | 28 |
1 files changed, 28 insertions, 0 deletions
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 |