#374: added #platforms_for_build action for Platforms API

This commit is contained in:
Vokhmin Alexey V 2012-10-08 22:02:44 +04:00
parent ec0ec5fc32
commit feefe8ed89
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
class Api::V1::PlatformsController < Api::V1::BaseController class Api::V1::PlatformsController < Api::V1::BaseController
before_filter :authenticate_user! before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show] if APP_CONFIG['anonymous_access'] skip_before_filter :authenticate_user!, :only => [:show, :platforms_for_build] if APP_CONFIG['anonymous_access']
load_and_authorize_resource load_and_authorize_resource
@ -12,6 +12,10 @@ class Api::V1::PlatformsController < Api::V1::BaseController
end end
def show def show
end
def platforms_for_build
@platforms = Platform.main.opened.paginate(:page => params[:page], :per_page => 20)
render :index
end end
end end

View File

@ -20,7 +20,9 @@ Rosa::Application.routes.draw do
} }
end end
resources :arches, :only => [:index] resources :arches, :only => [:index]
resources :platforms, :only => [:index, :show] resources :platforms, :only => [:index, :show] do
collection { get :platforms_for_build }
end
resources :repositories, :only => [:show] resources :repositories, :only => [:show]
resources :projects, :only => [:show] do resources :projects, :only => [:show] do
collection { get :get_id } collection { get :get_id }