Sha256: 61c6be412a4c9959b59cc625973260cc4695ae9aaab96a248167a195132bac59

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

class @ImagePreview extends Backbone.View

  className : 'add_new_popup hide'

  events :
    'click' : 'close'

  show : (imagePath) ->
    @render(imagePath)
    @$el.removeClass 'hide'

  close : (e) ->
    e.preventDefault()
    @closePopup()

  closePopup : () ->
    @$el.addClass 'hide'

  render : (imagePath) ->
    @$el.html @_getHTML(imagePath : imagePath)

  _getHTML : (data) ->
    JST['rademade_admin/app/templates/image-preview-popup'](data)

  @init : () ->
    imagePreview = new ImagePreview
    $('#pad-wrapper').append imagePreview.$el
    $('tr .image-preview').click (e) ->
      fullUrl = $(e.currentTarget).attr('full-url')
      imagePreview.show(fullUrl) if fullUrl

$ ->
  $(document).on 'page:load ready init-plugins', ImagePreview.init

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.1.6 app/assets/javascripts/rademade_admin/app/common/image-preview.coffee