Sha256: a1f1034617698bfe1645253fcee4a46c5ba232a5c20440ab841eabfe575ca44c

Contents?: true

Size: 599 Bytes

Versions: 13

Compression:

Stored size: 599 Bytes

Contents

class Crowdblog.Views.PostFormView extends Backbone.View
  el: 'form'

  initialize: ->
    @$el.find('#post_body').change(@updatePreview)
    @updatePreview()
    $('#uploader').html5Uploader
      postUrl: 'assets'
      name: 'attachment'
      onSuccess: @onUploadSuccess

  events:
    'keyup #post_body' : 'updatePreview'

  updatePreview: (e) ->
    @$el.find('#post-preview .inner').html(markdown.toHTML($('#post_body').val()))

  onUploadSuccess: (request, file, object) ->
    attachmentView = new Crowdblog.Views.AttachmentView(object)
    $('#assets').append attachmentView.render().el

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
crowdblog-0.6.2 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.6.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.5.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.3.3 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.4.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.3.2 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.3.1 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.3.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.2.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.1.3 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.1.2 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.1.1 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
crowdblog-0.1.0 app/assets/javascripts/crowdblog/views/post_form_view.js.coffee