From cb57d3550d784422ae9332e6e7c57ac70ffa32df Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 25 Oct 2014 12:20:13 -0500 Subject: [PATCH 1/2] Include ugoira frames in post data attributes. --- app/views/posts/partials/show/_ugoira.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/posts/partials/show/_ugoira.html.erb b/app/views/posts/partials/show/_ugoira.html.erb index 59e5eb407..6c2ad70ae 100644 --- a/app/views/posts/partials/show/_ugoira.html.erb +++ b/app/views/posts/partials/show/_ugoira.html.erb @@ -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, ) %>
From 79395a8b2ad55522ee129fd6258c3a2dddc58823 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 25 Oct 2014 12:21:18 -0500 Subject: [PATCH 2/2] Include ugoira data in post JSON API. --- app/models/post.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index dbe8e896f..35436bd8a 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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]