Commit 2495bb02

mo khan <mo@mokhan.ca>
2014-06-29 04:51:17
move default id to thumbnail template instead of model.
1 parent be3c76b
Changed files (3)
app
assets
javascripts
backbone
app/assets/javascripts/backbone/models/photo.js.coffee
@@ -3,7 +3,7 @@ class CakeSide.Models.Photo extends Backbone.Model
   fileAttribute: 'image'
 
   defaults:
-    id: 0
+    id: null
     content_type: null
     original_filename: null
     thumb_url: null
app/assets/javascripts/backbone/templates/cakes/thumbnail.jst.ejs
@@ -1,5 +1,5 @@
 <li class="span2">
-<a href="<%= Routes.creation_photo_path(cake_id, id) %>">
+<a href="<%= Routes.creation_photo_path(cake_id, id || 0) %>">
   <img src="<%= thumb_url %>" class="thumbnail" />
 </a>
 </li>
app/assets/javascripts/backbone/views/photos/new_modal_view.js.coffee
@@ -9,7 +9,7 @@ class CakeSide.Views.Photos.NewModalView extends Backbone.View
 
   constructor: (options) ->
     super(options)
-    @collection = new CakeSide.Collections.PhotosCollection(cake_id: options.cake.id)
+    @collection = CakeSide.Application.request('PhotosRepository', options.cake.id)
     @model = new @collection.model()
     @cake = options.cake