mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +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,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