Sha256: 4cae1fa8ffe2c44584ade242b73d755a33295b1b6407e4ea4e03b750ba02691a
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
angular.module('EssayApp.directives').directive "boxcomUploader", ['$timeout', '$window', 'FileKeeper', ($timeout, $window, FileKeeper) -> restrict: 'A' scope: true require: "ngModel" link: (scope, element, attrs, ngModel) -> $timeout (-> scope.root = element scope.root = element.closest(attrs.uploaderRoot) if attrs.uploaderRoot? # filesContainer = $(attrs.filesContainer) if attrs.filesContainer scope.clientId = attrs.clientId scope.guid = attrs.guid scope.endpoint = attrs.url scope.keeper = FileKeeper.build(scope, element, attrs, ngModel) scope.openUploader = -> # console.log 'openUploader' return unless BoxSelect? scope.boxSelect = new BoxSelect( clientId: scope.clientId linkType: 'direct' multiselect: true ) scope.boxSelect.success (response) -> $.each response, (_i, file) -> scope.keeper._add_pending(file) $.post( scope.endpoint, $.param( 'source': 'box' 'link': file.url 'name': file.name 'guid': scope.guid ) ).then ((data)-> scope.keeper.addUploadedFile(data.files[0], file) ), (err)-> scope.keeper._remove_pending(file) scope.boxSelect.cancel -> # called when user canceled selection return return if !scope.boxSelect.isBrowserSupported() scope.boxSelect.launchPopup() $.getScript('https://app.box.com/js/static/select.js') return ), 0, false ]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/assets/javascripts/app/directives/boxcom_uploader.js.coffee |