Sha256: 41eccaff208c6acdbcdd311fb2985e7fef7302d979bb49cf0d299fa79266da53

Contents?: true

Size: 1.66 KB

Versions: 24

Compression:

Stored size: 1.66 KB

Contents

FORGE.features.S3DirectUpload = class
  constructor: (options) ->
    @options = $.extend(@defaultOptions, options)
    @swfuploadOptions = $.extend(@defaultSwfuploadOptions, @options.swfuploadOptions)

    $(@options.element).swfupload @swfuploadOptions
    $(@options.element)
      .bind('fileQueued',     @options.fileQueued)
      .bind('uploadProgress', @options.uploadProgress)
      .bind('uploadError',    @options.uploadError)
      .bind('uploadSuccess',  @options.uploadSuccess)

  defaultOptions:
    element: '#swfupload-control'
    uploadSuccess: (file, data, response) ->
      alert "Success"
    uploadProgress: (event, file, bytesLoaded) ->
      percentage = Math.round((bytesLoaded/file.size)*100);
      $('#upload_bar').css('width', percentage + '%');
      $('#upload_status').html('Uploading ' + file.name + ': ' + (bytesLoaded / 1024).toFixed(0) + 'kB of ' + (file.size / 1024).toFixed(0) + 'kB.')
    uploadComplete: (event, file) ->
      $(@options.element).swfupload('startUpload')
    uploadError: ->
      alert 'error'

  defaultSwfuploadOptions:
    upload_url: 'http://s3.amazonaws.com'
    flash_url: '/flash/swfupload.swf'
    file_size_limit: '5000 MB'
    file_types: '*'
    file_types_description: 'Flash Videos'
    file_upload_limit: '0'
    file_post_name: "file"                  # FOR AWS
    http_success: [ 200, 201, 204 ]         # FOR AWS
    button_image_url: "/images/forge/browse.png"
    button_width: "110"
    button_height: "30"
    button_placeholder_id : "swfupload-button"
    button_text_left_padding: 12
    button_text_top_padding: 3
    file_queue_limit: "1"
    # debug: true
    button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.9 lib/forge/app/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.8 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.7 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.6 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.5 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.4 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.3 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.2 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.1 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.1.0 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.18 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.17 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.16 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.15 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.14 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.13 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.12 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.11 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee
forge-cli-0.0.10 lib/forge/lib/assets/javascripts/forge/features/s3_direct_upload.js.coffee