Browse Source

Merge pull request #140 from theurere/chrome-buddypictureupload-same-picture

Clear input type file value for uploaded pictures on cancel.
release-0.22
Simon Eisenmann 11 years ago
parent
commit
edf464417e
  1. 4
      static/js/directives/buddypictureupload.js

4
static/js/directives/buddypictureupload.js

@ -124,6 +124,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi @@ -124,6 +124,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi
$scope.imgData = null;
$scope.prevImage.src = "";
$scope.prevImage.style.cssText = null;
$scope.clearInput();
};
$scope.cancelPictureUpload = function() {
@ -203,6 +204,9 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi @@ -203,6 +204,9 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi
var link = function($scope, $element) {
$scope.prevImage = $element.find("img.preview").get(0);
$scope.clearInput = function() {
$element.find("input[type=file]")[0].value = "";
};
// Bind change event of file upload form.
$element.find("input[type=file]").on("change", $scope.handlePictureUpload);

Loading…
Cancel
Save