Add javascript callback for "assignee"

To make intrgration with external trackers easier, add JS API for
assignee retrieval.  It returns a script that calls a function that
should act somehow depending on how it was defined.
This commit is contained in:
Pavel Shved 2012-06-01 15:47:39 +04:00 committed by George Vinogradov
parent e75a676895
commit 8629d67030
3 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,10 @@ class Platforms::MaintainersController < ApplicationController
ret[:error] = 'Not found'
end
end
render :json => ret
respond_to do |format|
format.json {render :json => ret}
format.js {@ret = ret}
end
end
protected

View File

@ -0,0 +1 @@
doHandleAbfAssignee(<%= @ret.to_json.html_safe %>);

View File

@ -51,6 +51,7 @@ Rosa::Application.routes.draw do
# Maintainer Database API
# (package name may contain dots, numbers, and all kinds of weird symbols, hence the :constraints relaxation)
match 'api/json/maintdb/assignee/:platform_id/:package' => 'platforms/maintainers#assignee', :format => :json, :constraints => { :package => /.*/ }
match 'api/js/maintdb/assignee/:platform_id/:package' => 'platforms/maintainers#assignee', :format => :js, :constraints => { :package => /.*/ }
scope :module => 'platforms' do
resources :platforms do