Merge pull request #2286 from evazion/fix-ugoira-api

Include ugoira data in data attributes and JSON API
This commit is contained in:
Toks
2014-10-26 15:10:05 -04:00
2 changed files with 9 additions and 1 deletions

View File

@@ -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]

View File

@@ -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">