[refs #374] Small refactoring

This commit is contained in:
Vladimir Sharshov 2012-09-27 17:41:02 +04:00
parent a20e1552cc
commit 7c4c855341
7 changed files with 7 additions and 6 deletions

View File

@ -31,7 +31,7 @@ json.build_list do |json|
json.owner do |json_owner|
json_owner.(@build_list.user, :id, :name)
json_owner.url @build_list.project.owner_type == 'User' ? user_path(@build_list.project.owner.uname) : group_path(@build_list.project.owner.uname)
json_owner.url url_for(@build_list.project.owner)
end
inc_repos = Repository.includes(:platform).where(:id => @build_list.include_repos)

View File

@ -3,7 +3,7 @@ json.platforms @platforms do |json, platform|
json.owner do |json_owner|
json_owner.(platform.owner, :id, :name)
json_owner.type platform.owner_type
json_owner.url platform.owner_type == 'User' ? user_path(platform.owner) : group_path(platform.owner)
json_owner.url url_for(platform.owner)
end
json.repositories do |json_rep|
platform.repositories.each do |repo|

View File

@ -5,7 +5,7 @@ json.platform do |json|
json.owner do |json_owner|
json_owner.(@platform.owner, :id, :name)
json_owner.type @platform.owner_type
json_owner.url @platform.owner_type == 'User' ? user_path(@platform.owner) : group_path(@platform.owner)
json_owner.url url_for(@platform.owner)
end
json.repositories do |json_rep|
@platform.repositories.each do |repo|

View File

@ -3,7 +3,7 @@ json.project do |json|
json.owner do |json_owner|
json_owner.(@project.owner, :id, :name)
json_owner.type @project.owner_type
json_owner.url @project.owner_type == 'User' ? user_path(@project.owner) : group_path(@project.owner)
json_owner.url url_for(@project.owner)
end
json.url api_v1_project_path(@project, :format => :json)
end

View File

@ -3,7 +3,7 @@ json.projects @projects do |json, project|
json.owner do |json_owner|
json_owner.(project.owner, :id, :name)
json_owner.type project.owner_type
json_owner.url project.owner_type == 'User' ? user_path(project.owner) : group_path(project.owner)
json_owner.url url_for(project.owner)
end
json.url api_v1_project_path(project, :format => :json)
end

View File

@ -7,7 +7,7 @@ json.project do |json|
json.owner do |json_owner|
json_owner.(@project.owner, :id, :name)
json_owner.type @project.owner_type
json_owner.url @project.owner_type == 'User' ? user_path(@project.owner) : group_path(@project.owner)
json_owner.url url_for(@project.owner)
end
end

View File

@ -3,6 +3,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'rack/throttle'
require 'redis'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.