summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2017-09-08 21:08:48 -0600
committermo <mo.khan@gmail.com>2017-09-08 21:08:48 -0600
commita26735d60357b9126cf02489f2897e3b8d9376bd (patch)
tree19c1546a74624678bc622a075d830d861e731c8d
parent2af9191c751b8fe4d0cb4f461d6410b8e306e511 (diff)
connect cards to autoview.
-rw-r--r--app/assets/javascripts/views/cakes/card.js.coffee4
-rw-r--r--app/views/cakes/_index.html.erb3
2 files changed, 5 insertions, 2 deletions
diff --git a/app/assets/javascripts/views/cakes/card.js.coffee b/app/assets/javascripts/views/cakes/card.js.coffee
new file mode 100644
index 00000000..cffd3af8
--- /dev/null
+++ b/app/assets/javascripts/views/cakes/card.js.coffee
@@ -0,0 +1,4 @@
+#= require views/auto_view
+
+class CakeSide.Views.Cakes.Card extends CakeSide.AutoView
+ @viewName 'cake-card'
diff --git a/app/views/cakes/_index.html.erb b/app/views/cakes/_index.html.erb
index c1bc7907..15ba7a31 100644
--- a/app/views/cakes/_index.html.erb
+++ b/app/views/cakes/_index.html.erb
@@ -1,12 +1,11 @@
<div class="card-columns">
<% @cakes.each do |cake| %>
- <div class='card'>
+ <div id="cake-<%= cake.id %>" class='card' data-autoview="cake-card">
<%= link_to cake_path(cake) do %>
<%= image_tag cake.primary_image.url_for(:thumb), alt: cake.name, class: 'card-img-top' %>
<% end %>
<div class="card-body">
<h4 class="card-title"><%= cake.name %></h4>
- <p class="card-text"><%= cake.story %></p>
<p class="card-text"><small class="text-muted"><%= local_time(cake.created_at) %></small></p>
</div>
</div>