Merge pull request #2286 from evazion/fix-ugoira-api
Include ugoira data in data attributes and JSON API
This commit is contained in:
@@ -1229,8 +1229,14 @@ class Post < ActiveRecord::Base
|
||||
list
|
||||
end
|
||||
|
||||
def associated_attributes
|
||||
[ :pixiv_ugoira_frame_data ]
|
||||
end
|
||||
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:include] ||= []
|
||||
options[:include] += associated_attributes
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
unless options[:builder]
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
"data-has-children" => post.has_children?,
|
||||
"data-has-active-children" => post.has_active_children?,
|
||||
"data-score" => post.score,
|
||||
"data-fav-count" => post.fav_count
|
||||
"data-fav-count" => post.fav_count,
|
||||
"data-ugoira-frames" => post.pixiv_ugoira_frame_data.data.to_json,
|
||||
"data-ugoira-content-type" => post.pixiv_ugoira_frame_data.content_type.to_json,
|
||||
) %>
|
||||
|
||||
<div id="ugoira-controls">
|
||||
|
||||
Reference in New Issue
Block a user