Skip to content

Commit

Permalink
fix(accounts): issue not showing upload dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Apr 13, 2019
1 parent 746d5c0 commit 38a4c85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/controllers/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ accountsController.uploadImage = function (req, res) {
})

busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
console.log(file)
if (mimetype.indexOf('image/') === -1) {
error = {
status: 400,
Expand Down
18 changes: 17 additions & 1 deletion src/public/js/angularjs/controllers/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

define(['angular', 'underscore', 'jquery'], function (angular, _, $) {
return angular.module('trudesk.controllers.accounts', []).controller('accountsCtrl', function ($scope) {
return angular.module('trudesk.controllers.accounts', []).controller('accountsCtrl', function ($scope, $timeout) {
$scope.selectAccountsImport = function (event, type) {
if ($(event.currentTarget).hasClass('card-disabled')) {
return false
Expand Down Expand Up @@ -46,5 +46,21 @@ define(['angular', 'underscore', 'jquery'], function (angular, _, $) {
$('#json-import-selector').removeClass('card-disabled')
$('#ldap-import-selector').removeClass('card-disabled')
}

$scope.accountEditPic = function () {
throttledAccountPicClick()
}

function throttledAccountPicClick () {
$timeout(function () {
var $profileImageInput = $('#profileImageInput')
$profileImageInput.on('click', function (event) {
// This function is a firefox hack to stop it from spawning 100000 file dialogs
event.stopPropagation()
})

$profileImageInput.trigger('click')
}, 0)
}
})
})

0 comments on commit 38a4c85

Please sign in to comment.