mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 12:44:03 +00:00
Use JSON date serializer
Effective API changes:
- nil serializes to null, not empty string
- dates serialize to IETF RFC 3339 with millisecond precision, not
second precision surrounded by spaces
This commit is contained in:
parent
b60257ef59
commit
397341a324
4 changed files with 8 additions and 15 deletions
|
|
@ -3,12 +3,8 @@
|
|||
class EventScheduleSerializer < ActiveModel::Serializer
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
attributes :date, :room
|
||||
|
||||
def date
|
||||
t = object.start_time
|
||||
t.blank? ? '' : %( #{I18n.l t, format: :short}#{t.formatted_offset(false)} )
|
||||
end
|
||||
attribute :start_time, key: :date
|
||||
attributes :room
|
||||
|
||||
def room
|
||||
object.room.guid
|
||||
|
|
|
|||
|
|
@ -3,12 +3,9 @@
|
|||
class EventSerializer < ActiveModel::Serializer
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
attributes :guid, :title, :length, :scheduled_date, :language, :abstract, :speaker_ids, :type, :room, :track
|
||||
|
||||
def scheduled_date
|
||||
t = object.time
|
||||
t.blank? ? '' : %( #{I18n.l t, format: :short}#{t.formatted_offset(false)} )
|
||||
end
|
||||
attributes :guid, :title, :length
|
||||
attribute :time, key: :scheduled_date
|
||||
attributes :language, :abstract, :speaker_ids, :type, :room, :track
|
||||
|
||||
def speaker_ids
|
||||
speakers = object.event_users.select { |i| i.event_role == 'speaker' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue