Commit 3bf1ebc0
Changed files (6)
app
assets
javascripts
backbone
views
api
v1
cakes
categories
photos
profiles
tutorials
app/assets/javascripts/backbone/cakeside.js.coffee
@@ -37,9 +37,7 @@ window.CakeSide =
@cakes = new CakeSide.Collections.CakesCollection()
@categories = new CakeSide.Collections.CategoriesCollection()
- @categories.fetch(reset: true)
@tutorials = new CakeSide.Collections.TutorialsCollection()
- @tutorials.fetch(reset: true)
#@disqus_view = new CakeSide.Views.DisqusView
#disqus_shortname: data.disqus_shortname
@@ -65,3 +63,5 @@ window.CakeSide =
@cakes.fetch(reset: true).done ->
CakeSide.Application.start()
+ @categories.fetch(reset: true)
+ @tutorials.fetch(reset: true)
app/views/api/v1/cakes/_cake.json.jbuilder
@@ -1,24 +1,26 @@
-json.id cake.id
-json.name cake.name
-json.slug cake.to_param
-json.story cake.story
-json.category do
- json.id cake.category.id
- json.name cake.category.name
-end
-json.user do
- json.id cake.user.id
- json.name cake.user.name
-end
-json.created_at cake.created_at
-json.updated_at cake.updated_at
-json.photos cake.photos do |photo|
- json.id photo.id
- json.large_url "https:#{photo.url_for(:large)}"
- json.thumb_url "https:#{photo.url_for(:thumb)}"
- json.created_at photo.created_at
- json.updated_at photo.updated_at
-end
-json.tags cake.tags do |tag|
- json.name tag.name
+json.cache! ['v1', cake] do
+ json.id cake.id
+ json.name cake.name
+ json.slug cake.to_param
+ json.story cake.story
+ json.created_at cake.created_at
+ json.updated_at cake.updated_at
+ json.category do
+ json.id cake.category.id
+ json.name cake.category.name
+ end
+ json.user do
+ json.id cake.user.id
+ json.name cake.user.name
+ end
+ json.photos cake.photos do |photo|
+ json.id photo.id
+ json.large_url "https:#{photo.url_for(:large)}"
+ json.thumb_url "https:#{photo.url_for(:thumb)}"
+ json.created_at photo.created_at
+ json.updated_at photo.updated_at
+ end
+ json.tags cake.tags do |tag|
+ json.name tag.name
+ end
end
app/views/api/v1/categories/_category.json.jbuilder
@@ -1,3 +1,5 @@
-json.id category.id
-json.name category.name
-json.slug category.slug
+json.cache! ['v1', category] do
+ json.id category.id
+ json.name category.name
+ json.slug category.slug
+end
app/views/api/v1/photos/_photo.json.jbuilder
@@ -1,9 +1,11 @@
-json.id photo.id
-json.cake_id photo.imageable_id
-json.content_type photo.content_type
-json.original_filename photo.original_filename
-json.thumb_url photo.url_for(:thumb)
-json.large_url photo.url_for(:large)
-json.original_url photo.url_for(:original)
-json.created_at photo.created_at
-json.updated_at photo.updated_at
+json.cache! ['v1', photo] do
+ json.id photo.id
+ json.cake_id photo.imageable_id
+ json.content_type photo.content_type
+ json.original_filename photo.original_filename
+ json.thumb_url photo.url_for(:thumb)
+ json.large_url photo.url_for(:large)
+ json.original_url photo.url_for(:original)
+ json.created_at photo.created_at
+ json.updated_at photo.updated_at
+end
app/views/api/v1/profiles/_profile.json.jbuilder
@@ -1,8 +1,10 @@
-json.id profile.id
-json.email profile.email
-json.name profile.name
-json.website profile.website
-json.twitter profile.twitter
-json.facebook profile.facebook
-json.city profile.city
-json.errors profile.errors
+json.cache! ['v1', profile] do
+ json.id profile.id
+ json.email profile.email
+ json.name profile.name
+ json.website profile.website
+ json.twitter profile.twitter
+ json.facebook profile.facebook
+ json.city profile.city
+ json.errors profile.errors
+end
app/views/api/v1/tutorials/_tutorial.json.jbuilder
@@ -1,12 +1,14 @@
-json.id tutorial.id
-json.heading tutorial.heading
-json.description tutorial.description
-json.url tutorial.url
-json.image_url tutorial.image_url
-json.author tutorial.author
-json.author_url tutorial.author_url
-json.created_at tutorial.created_at
-json.updated_at tutorial.updated_at
-json.tags tutorial.tags do |tag|
- json.name tag.name
+json.cache! ['v1', tutorial] do
+ json.id tutorial.id
+ json.heading tutorial.heading
+ json.description tutorial.description
+ json.url tutorial.url
+ json.image_url tutorial.image_url
+ json.author tutorial.author
+ json.author_url tutorial.author_url
+ json.created_at tutorial.created_at
+ json.updated_at tutorial.updated_at
+ json.tags tutorial.tags do |tag|
+ json.name tag.name
+ end
end