Support JSONP callbacks for the API/v1 endpoints
SeaGL currently uses OSEM as a backend, but still has a static website serving as our public interface. The API endpoints have a great amount of data, but without the jsonp callback paramater, embedding the data is a bit difficult. This change just adds the jsonp callback param to all the API endpoints. This should be a NOOP for anyone using direct json calls, but will allow cross domain requests that require jsonp.
This commit is contained in:
parent
85fcd4e1b7
commit
70e0f42bbb
5 changed files with 7 additions and 7 deletions
|
|
@ -5,11 +5,11 @@ module Api
|
|||
respond_to :json
|
||||
|
||||
def index
|
||||
render json: @conferences, serializer: ConferencesArraySerializer
|
||||
render json: @conferences, serializer: ConferencesArraySerializer, callback: params['callback']
|
||||
end
|
||||
|
||||
def show
|
||||
render json: [@conference], serializer: ConferencesArraySerializer
|
||||
render json: [@conference], serializer: ConferencesArraySerializer, callback: params['callback']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module Api
|
|||
events = events.where(program: @conference.program)
|
||||
end
|
||||
|
||||
respond_with events.confirmed
|
||||
respond_with events.confirmed, callback: params[:callback]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ module Api
|
|||
|
||||
def index
|
||||
if @conference
|
||||
respond_with @conference.venue ? @conference.venue.rooms : Room.none
|
||||
respond_with @conference.venue ? @conference.venue.rooms : Room.none, callback: params[:callback]
|
||||
else
|
||||
respond_with Room.all
|
||||
respond_with Room.all, callback: params[:callback]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module Api
|
|||
end
|
||||
|
||||
users = users.where(event_users: {event_role: :speaker}).uniq
|
||||
render json: users, each_serializer: SpeakerSerializer
|
||||
render json: users, each_serializer: SpeakerSerializer, callback: params['callback']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module Api
|
|||
def index
|
||||
tracks = @conference ? @conference.program.tracks : Track.all
|
||||
|
||||
respond_with tracks
|
||||
respond_with tracks, callback: params[:callback]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue