summaryrefslogtreecommitdiffstats
path: root/app/views/projects
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-14 20:00:17 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-01-14 20:00:17 +0000
commit68a4cd38f54316e6d93ce69b6e25afc329652013 (patch)
treed2adb8c4aa3fceb2d088c0b31a5913ef60aaa31c /app/views/projects
parent64f4b50139a7ef9e33fc7df00caf4fab028e1cef (diff)
downloadredmine-68a4cd38f54316e6d93ce69b6e25afc329652013.tar.gz
redmine-68a4cd38f54316e6d93ce69b6e25afc329652013.zip
XML REST API for Projects (#296).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3313 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/projects')
-rw-r--r--app/views/projects/index.xml.builder18
-rw-r--r--app/views/projects/show.xml.builder16
2 files changed, 34 insertions, 0 deletions
diff --git a/app/views/projects/index.xml.builder b/app/views/projects/index.xml.builder
new file mode 100644
index 000000000..637ae7ef6
--- /dev/null
+++ b/app/views/projects/index.xml.builder
@@ -0,0 +1,18 @@
+xml.instruct!
+xml.projects :type => 'array' do
+ @projects.each do |project|
+ xml.project :id => project.id do
+ xml.name project.name
+ xml.identifier project.identifier
+ xml.description project.description
+ xml.parent(:id => project.parent_id, :name => project.parent.name) unless project.parent.nil?
+ xml.custom_fields do
+ project.custom_field_values.each do |custom_value|
+ xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
+ end
+ end unless project.custom_field_values.empty?
+ xml.created_on project.created_on
+ xml.updated_on project.updated_on
+ end
+ end
+end
diff --git a/app/views/projects/show.xml.builder b/app/views/projects/show.xml.builder
new file mode 100644
index 000000000..3c4241d4c
--- /dev/null
+++ b/app/views/projects/show.xml.builder
@@ -0,0 +1,16 @@
+xml.instruct!
+xml.project :id => @project.id do
+ xml.name @project.name
+ xml.identifier @project.identifier
+ xml.description @project.description
+ xml.homepage @project.homepage
+
+ xml.custom_fields do
+ @project.custom_field_values.each do |custom_value|
+ xml.custom_field custom_value.value, :id => custom_value.custom_field_id, :name => custom_value.custom_field.name
+ end
+ end unless @project.custom_field_values.empty?
+
+ xml.created_on @project.created_on
+ xml.updated_on @project.updated_on
+end