Support JSONP exports of conference schedules for embedding
Currently, it's rather difficult to use OSEM and embed a schedule into another website. We currently use OSEM for the backend, but still use a different system for our main site. This change allows us to dynamically embed the schedule in our main website as well as allow us a simple way to get data for the use in mobile applications or similar. This limits the JSONP support to only GETS on json formatted requests. This prevents any XSS even though we don't require a authenticity token.
This commit is contained in:
parent
eface6a91b
commit
b9a2a80a75
3 changed files with 82 additions and 1 deletions
|
|
@ -131,6 +131,73 @@ class Conference < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
##
|
||||
# Builds out the model for returning a json response
|
||||
#
|
||||
#
|
||||
def as_json(_options={})
|
||||
super(
|
||||
only: [
|
||||
:description,
|
||||
:end_date,
|
||||
:logo,
|
||||
:short_title,
|
||||
:start_date,
|
||||
:title,
|
||||
],
|
||||
include: {
|
||||
difficulty_levels: {
|
||||
only: [
|
||||
:description,
|
||||
:id,
|
||||
:title,
|
||||
]
|
||||
},
|
||||
event_types: {
|
||||
only: [
|
||||
:description,
|
||||
:id,
|
||||
:length,
|
||||
:title,
|
||||
]
|
||||
},
|
||||
rooms: {
|
||||
only: [
|
||||
:name,
|
||||
:size,
|
||||
],
|
||||
include: {
|
||||
events: {
|
||||
only: [
|
||||
:abstract,
|
||||
:description,
|
||||
:difficulty_level_id,
|
||||
:event_type_id,
|
||||
:guid,
|
||||
:is_highlight,
|
||||
:require_registration,
|
||||
:start_time,
|
||||
:subtitle,
|
||||
:title,
|
||||
:track_id,
|
||||
],
|
||||
methods: [
|
||||
:speaker_names,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
tracks: {
|
||||
only: [
|
||||
:description,
|
||||
:id,
|
||||
:name,
|
||||
]
|
||||
},
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if the user is registered to the conference
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue