Commit f266ab78

mo khan <mo@mokhan.ca>
2014-07-01 01:03:11
remove unused photo backbone views and templates.
1 parent 4d9ad61
Changed files (5)
app
app/assets/javascripts/backbone/routers/photos_router.js.coffee
@@ -1,29 +1,16 @@
 class CakeSide.Routers.PhotosRouter extends Backbone.Router
   routes:
     "cakes/:cake_id/photos/new"      : "newPhoto"
-    "cakes/:cake_id/photos/index"    : "index"
-    "cakes/:cake_id/photos/:id/edit" : "edit"
     "cakes/:cake_id/photos/:id"      : "show"
-    "cakes/:cake_id/photos/.*"        : "index"
 
   newPhoto: (cake_id) ->
     @photos = CakeSide.Application.request('PhotosRepository', cake_id)
     @view = new CakeSide.Views.Photos.NewView(collection: @photos)
     $("#backbone-content").html(@view.render().el)
 
-  index: (cake_id) ->
-    @photos = CakeSide.Application.request('PhotosRepository', cake_id)
-    @view = new CakeSide.Views.Photos.IndexView(photos: @photos)
-    $("#backbone-content").html(@view.render().el)
-
   show: (cake_id, id) ->
     @photos = CakeSide.Application.request('PhotosRepository', cake_id)
     photo = new CakeSide.Models.Photo({cake_id: cake_id, id: id})
     photo.fetch()
     @view = new CakeSide.Views.Photos.ShowView(model: photo, collection: @photos)
     $("#backbone-content").html(@view.render().el)
-
-  edit: (cake_id, id) ->
-    @photos = CakeSide.Application.request('PhotosRepository', cake_id)
-    @view = new CakeSide.Views.Photos.EditView(model: @photos.get(id))
-    $("#backbone-content").html(@view.render().el)
app/assets/javascripts/backbone/templates/photos/edit.jst.ejs
@@ -1,20 +0,0 @@
-<h1>Edit photo</h1>
-
-<form id="edit-photo" name="photo">
-  <div class="field">
-    <label for="thumb_url"> thumb_url:</label>
-    <input type="text" name="thumb_url" id="thumb_url" value="<%= thumb_url %>" >
-  </div>
-
-  <div class="field">
-    <label for="large_url"> large_url:</label>
-    <input type="text" name="large_url" id="large_url" value="<%= large_url %>" >
-  </div>
-
-  <div class="actions">
-    <input type="submit" value="Update Photo" />
-  </div>
-
-</form>
-
-<a href="#/index">Back</a>
\ No newline at end of file
app/assets/javascripts/backbone/templates/photos/index.jst.ejs
@@ -1,15 +0,0 @@
-<h1>Listing photos</h1>
-
-<table id="photos-table">
-  <tr>
-    <th>Thumb url</th>
-    <th>Large url</th>
-    <th></th>
-    <th></th>
-    <th></th>
-  </tr>
-</table>
-
-<br/>
-
-<a href="#/new">New Photo</a>
\ No newline at end of file
app/assets/javascripts/backbone/views/photos/edit_view.js.coffee
@@ -1,24 +0,0 @@
-CakeSide.Views.Photos ||= {}
-
-class CakeSide.Views.Photos.EditView extends Backbone.View
-  template : JST["backbone/templates/photos/edit"]
-
-  events :
-    "submit #edit-photo" : "update"
-
-  update : (e) ->
-    e.preventDefault()
-    e.stopPropagation()
-
-    @model.save(null,
-      success : (photo) =>
-        @model = photo
-        window.location.hash = "/#{@model.id}"
-    )
-
-  render : ->
-    $(@el).html(@template(@model.toJSON() ))
-
-    this.$("form").backboneLink(@model)
-
-    return this
app/assets/javascripts/backbone/views/photos/index_view.js.coffee
@@ -1,20 +0,0 @@
-CakeSide.Views.Photos ||= {}
-
-class CakeSide.Views.Photos.IndexView extends Backbone.View
-  template: JST["backbone/templates/photos/index"]
-
-  initialize: () ->
-    @options.photos.bind('reset', @addAll)
-
-  addAll: () =>
-    @options.photos.each(@addOne)
-
-  addOne: (photo) =>
-    view = new CakeSide.Views.Photos.PhotoView({model : photo})
-    @$("tbody").append(view.render().el)
-
-  render: =>
-    $(@el).html(@template(photos: @options.photos.toJSON() ))
-    @addAll()
-
-    return this