#671: added Projects#refs_list API action
This commit is contained in:
parent
6b3bf41c7a
commit
8f3ed58cd8
|
@ -2,7 +2,7 @@
|
|||
class Api::V1::ProjectsController < Api::V1::BaseController
|
||||
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:get_id, :show] if APP_CONFIG['anonymous_access']
|
||||
skip_before_filter :authenticate_user!, :only => [:get_id, :show, :refs] if APP_CONFIG['anonymous_access']
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
|
@ -15,6 +15,9 @@ class Api::V1::ProjectsController < Api::V1::BaseController
|
|||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def refs_list
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
json.refs_list (@project.repo.branches + @project.repo.tags) do |json_grit, grit|
|
||||
json_grit.ref grit.name
|
||||
json_grit.object do |json_object|
|
||||
json_object.type (grit.class.name =~ /Tag/ ? 'tag' : 'commit')
|
||||
json_object.sha grit.commit.id
|
||||
end
|
||||
end
|
||||
json.url refs_list_api_v1_project_path(@project.id, :format => :json)
|
|
@ -35,6 +35,9 @@ Rosa::Application.routes.draw do
|
|||
resources :repositories, :only => [:show]
|
||||
resources :projects, :only => [:show] do
|
||||
collection { get :get_id }
|
||||
member {
|
||||
get :refs_list
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue