Sha256: 7e2ef2ad88686b54ec844dfd29284c93a7992e9378f4a0f53e31f42b10720a9b

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

class Application.Routers.PhotosRouter extends Backbone.Router
  initialize: (options) ->
    @photos = new Application.Collections.PhotosCollection()
    @photos.url = options.collectionUrl
    @photos.reset options.photos

  routes:
    "new"      : "newPhoto"
    "index"    : "index"
    "upload_index" : "upload_index"
    ":id/edit" : "edit"
    ":id"      : "show"
    ".*"        : "upload_index"

  newPhoto: ->
    @view = new Application.Views.Photos.NewView(collection: @photos)
    $("#upload-container").html(@view.render().el)

  index: ->
    @view = new Application.Views.Photos.IndexView(photos: @photos)
    $("#upload-container").html(@view.render().el)

  upload_index: ->
    @view = new Application.Views.Photos.UploadIndexView(photos: @photos)
    $("#upload-container").html(@view.render().el)

  show: (id) ->
    photo = @photos.get(id)

    @view = new Application.Views.Photos.ShowView(model: photo)
    $("#upload-container").html(@view.render().el)

  edit: (id) ->
    photo = @photos.get(id)

    @view = new Application.Views.Photos.EditView(model: photo)
    $("#upload-container").html(@view.render().el)

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mix-rails-0.15.0 mix-rails-albums/app/assets/javascripts/backbone/routers/photos_router.js.coffee
mix-rails-albums-0.15.0 app/assets/javascripts/backbone/routers/photos_router.js.coffee