Sha256: 3e7170869590dcbc8d35aa93f3e7b0b2fff31b2c27c56b5ccfc3b3443bb28b5e

Contents?: true

Size: 617 Bytes

Versions: 8

Compression:

Stored size: 617 Bytes

Contents

class Crowdblog.Models.Post extends Backbone.Model
  paramRoot: 'post'

  url: ->
    Crowdblog.adminPostsPath + '/' + @id

  publish: ->
    @performTransition 'publish', =>
      @trigger 'post-published'

  finish: ->
    @performTransition 'finish', =>
      @trigger 'post-finished'

  review: ->
    @performTransition 'review', =>
      @trigger 'post-reviewed'

  draft: ->
    @performTransition 'draft', =>
      @trigger 'post-drafted'

  performTransition: (transition, success)->
    $.ajax
      type: 'POST'
      url:  "/admin/posts/#{@id}/#{transition}"
      dataType: 'json'
      success: success

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
crowdblog-0.6.2 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.6.0 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.5.0 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.3.3 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.4.0 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.3.2 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.3.1 app/assets/javascripts/crowdblog/models/post.js.coffee
crowdblog-0.3.0 app/assets/javascripts/crowdblog/models/post.js.coffee