[refs #861] move products list to platform

This commit is contained in:
Alexander Machehin 2013-02-01 21:52:41 +06:00
parent 94401d4494
commit 36b258d2a0
4 changed files with 5 additions and 18 deletions

View File

@ -3,13 +3,7 @@ class Api::V1::ProductsController < Api::V1::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform, :only => :index
#load_and_authorize_resource :product, :through => :platform, :only => :index
load_and_authorize_resource :only => [:show, :edit, :update, :destroy, :create]
def index
@products = @platform.products.paginate(paginate_params)
end
load_and_authorize_resource
def create
create_subject @product

View File

@ -8,4 +8,7 @@ json.platform do |json|
json_repos.(repo, :id, :name)
json_repos.url api_v1_repository_path(repo.id, :format => :json)
end
json.products @platform.products do |json_products, product|
json.partial! 'api/v1/products/product', :product => product, :json => json_products
end
end

View File

@ -1,9 +0,0 @@
json.platform do |json_platform|
json.partial! 'api/v1/platforms/platform', :platform => @platform, :json => json_platform
end
json.products @products do |json, product|
json.partial! 'product', :product => product, :json => json
end
json.url api_v1_products_path(@platform.id, :format => :json)

View File

@ -35,7 +35,6 @@ Rosa::Application.routes.draw do
put :clear
}
resources :maintainers, :only => [ :index ]
resources :products, :only => :index
end
resources :repositories, :only => [:show, :update, :destroy] do
member {