Sha256: f2270394e428c23922112edbf45bc19cefa865bd4490ee2eeb7efe327d296567
Contents?: true
Size: 1.47 KB
Versions: 20
Compression:
Stored size: 1.47 KB
Contents
@app.controller 'AssetListCtrl', ['$scope', ($scope) -> $scope.assetCount = -> $scope.assets.length $scope.editUrl = (asset) -> $scope.assetUrl.replace(/~id/, asset.id) $scope.afterUpload = (asset) -> $scope.assets.unshift(asset) $scope.assets = $scope.assets.slice(0, 20) ] @app.controller 'AssetUploadCtrl', ['$scope', ($scope) -> $scope.method = -> if $scope.asset['new_record?'] then 'post' else 'patch' $scope.saveUrl = -> if $scope.asset['new_record?'] then $scope.createUrl else $scope.updateUrl.replace(/~id$/, $scope.asset.id) $scope.saveButtonClass = -> if $scope.asset['new_record?'] then 'success' else 'primary' $scope.saveButtonText = -> if $scope.asset['new_record?'] then 'Upload file' else 'Update media' $scope.afterUpload = (asset) -> $scope.asset = asset ] @app.directive 'assetUpload', -> (scope, $el, attrs) -> unless window.FileReader && Modernizr.draganddrop $el.hide() return if attrs.assetFallback scope.hideFileField = true $el.filedrop fallback_id: attrs.assetFallback url: attrs.assetUpload paramname: 'asset[file]' maxfiles: attrs.assetMaxfiles || 1 dragOver: -> $(this).addClass('hover') dragLeave: -> $(this).removeClass('hover') drop: -> $(this).removeClass('hover') uploadFinished: (i, file, response, time) -> scope.afterUpload(response.asset) scope.$apply() unless scope.$$phase
Version data entries
20 entries across 20 versions & 1 rubygems