Project

General

Profile

Feature #13800 ยป projects_show_api.rsb.diff

zhiguo Zhu, 2014-05-31 18:28

View differences:

app/views/projects/show.api.rsb
api.created_on @project.created_on
api.updated_on @project.updated_on
sort_init 'filename', 'asc'
sort_update 'filename' => "#{Attachment.table_name}.filename",
'created_on' => "#{Attachment.table_name}.created_on",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
containers = [ Project.includes(:attachments).reorder(sort_clause).find(@project.id)]
containers += @project.versions.includes(:attachments).reorder(sort_clause).all.sort.reverse
api.array :versions do
containers.each do |container|
next if container.attachments.empty?
if container.is_a?(Version)
attrs = {:id => container.name}
end
api.version attrs do
api.array :files do
container.attachments.each do |file|
api.files(:id => file.id, :filename => file.filename, :created_on => file.created_on,
:filesize => file.filesize, :digest => file.digest)
end
end
end if not attrs.nil?
end
end if include_in_api_response?('attachments')
api.array :trackers do
@project.trackers.each do |tracker|
api.tracker(:id => tracker.id, :name => tracker.name)
    (1-1/1)