Sha256: e73664d4c4ae429b430422040729c9b3661dded975850586e107f4f3e5e8e424

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

 # Upload photo
$.fn.uploadPhoto = ->
  $(this).fileupload
    dataType: "script"
    singleFileUploads: true
    replaceFileInput: true
    dropZone: $(this).find('.photo-field')
    add: (e, data) ->
      types = /(\.|\/)(gif|jpe?g|png)$/i
      file = data.files[0]
      if types.test(file.type) || types.test(file.name)
        $(this).find('.customfile').addClass('loading')
        data.submit()
      else
        alert("#{file.name} is not gif-, jpeg- or png- file")
    done: (e, data) ->
      $(this).find('.customfile').removeClass('loading')

# Upload document
$.fn.uploadDocument = ->
  $(this).fileupload
    dataType: "script"
    singleFileUploads: true
    dropZone: $(this).find('.attachment-field')
    maxNumberOfFiles: 1
    add: (e, data) ->
      types = /(\.|\/)(pdf|docx?|rtf|txt)$/i
      file = data.files[0]
      if types.test(file.type) || types.test(file.name)
        $(this).find('.customfile').addClass('loading')
        data.submit()
      else
        alert("#{file.name} is not pdf-, word-, txt- or rtf- file")
    done: (e, data) ->
      $(this).find('.customfile').removeClass('loading')

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
spina-2.0.2 app/assets/javascripts/spina/admin/uploads.coffee
spina-2.0.1 app/assets/javascripts/spina/admin/uploads.coffee
spina-2.0.0 app/assets/javascripts/spina/admin/uploads.coffee
spina-2.0.0.beta app/assets/javascripts/spina/admin/uploads.coffee
spina-2.0.0.alpha app/assets/javascripts/spina/admin/uploads.coffee
spina-1.2.0 app/assets/javascripts/spina/admin/uploads.coffee
spina-1.1.4 app/assets/javascripts/spina/admin/uploads.coffee
spina-1.1.3 app/assets/javascripts/spina/admin/uploads.coffee
spina-1.1.2 app/assets/javascripts/spina/admin/uploads.coffee
spina-1.1.1 app/assets/javascripts/spina/admin/uploads.coffee
spina-1.1.0 app/assets/javascripts/spina/admin/uploads.coffee