image change in profiles fixed

parent 0bcffb20
...@@ -224,20 +224,16 @@ module.exports = { ...@@ -224,20 +224,16 @@ module.exports = {
if (!stu) if (!stu)
throw new Error("Student not found"); throw new Error("Student not found");
console.log("->s1" + JSON.stringify(stu));
// Update license // Update license
if (req.body.license_number && (!stu.license[0] || req.body.license_number != stu.license[0].number)) if (req.body.license_number && (!stu.license[0] || req.body.license_number != stu.license[0].number))
current_license = promisifyLicenseActivate(req.body.license_number, stu.id); current_license = promisifyLicenseActivate(req.body.license_number, stu.id);
else else
current_license = Promise.resolve(stu.license); current_license = Promise.resolve(stu.license);
return ([stu, current_license]); return ([stu, current_license]);
}) })
.spread(function(stu, license) { .spread(function(stu, license) {
console.log("->s3" + JSON.stringify(stu));
console.log("->l4" + JSON.stringify(license));
// copy attributes // copy attributes
for (k in req.body) stu[k] = req.body[k]; for (k in req.body) stu[k] = req.body[k];
...@@ -251,7 +247,6 @@ module.exports = { ...@@ -251,7 +247,6 @@ module.exports = {
if (err) if (err)
throw err; throw err;
console.log("->s5" + JSON.stringify(stu));
stu.license = license; stu.license = license;
res.ok(stu); res.ok(stu);
......
...@@ -16,12 +16,13 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -16,12 +16,13 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast) { ngToast) {
// For tab navigation (here too, if the user refresh the page...) // For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup'; $scope.nav.tab = 'setup';
$scope.spin_disabled = true;
// Set upload button to filestyle // Set upload button to filestyle
$(":file").filestyle({ /*$(":file").filestyle({
buttonText: " " + $translate.instant('change_picture'), buttonText: " " + $translate.instant('change_picture'),
input: false input: false
}); });*/
$scope.supsForm = {}; $scope.supsForm = {};
...@@ -35,6 +36,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -35,6 +36,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
var extension; var extension;
var filename; var filename;
console.log("selected!!"); console.log("selected!!");
$scope.spin_disabled = false;
for (i = 0; i < $files.length; i++) { for (i = 0; i < $files.length; i++) {
file = $files[i]; // { name, size, type } file = $files[i]; // { name, size, type }
...@@ -62,6 +64,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl( ...@@ -62,6 +64,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast.success({ content: $translate.instant('student_updated') }); ngToast.success({ content: $translate.instant('student_updated') });
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
$scope.studentData.pic = '/upload/studentAvatar/' + data.file.name; $scope.studentData.pic = '/upload/studentAvatar/' + data.file.name;
$scope.spin_disabled = true;
}); });
} else { } else {
ngToast.danger({ content: $translate.instant('error_only_support_images') }); ngToast.danger({ content: $translate.instant('error_only_support_images') });
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
<img class="thumbnail preview" ng-src="{{studentData.pic}}" /> <img class="thumbnail preview" ng-src="{{studentData.pic}}" />
<!-- Fin Cambiar imagen de perfil --> <!-- Fin Cambiar imagen de perfil -->
<div class="form-group"> <div class="form-group">
<input type="file" class="filestyle" ng-file-select="onFileSelect($files)" ng-model="picFile" accept="image/*"> <!-- input type="file" ng-file-select="onFileSelect($files)" accept="image/*"></input -->
<input type="file" ng-file-select="onFileSelect($files)" accept="image/*" id="selectedFile" style="display: none;" />
<input type="button" value="{{ 'change_picture' | translate }}" onclick="document.getElementById('selectedFile').click();" />
<i ng-class="{'fa fa-spinner fa-spin fa-2x fa-fw margin-bottom': true, 'spin_disabled': spin_disabled}"></i>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment