image change in profiles fixed

parent 0bcffb20
......@@ -224,20 +224,16 @@ module.exports = {
if (!stu)
throw new Error("Student not found");
console.log("->s1" + JSON.stringify(stu));
// Update license
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);
else
current_license = Promise.resolve(stu.license);
return ([stu, current_license]);
})
.spread(function(stu, license) {
console.log("->s3" + JSON.stringify(stu));
console.log("->l4" + JSON.stringify(license));
// copy attributes
for (k in req.body) stu[k] = req.body[k];
......@@ -251,7 +247,6 @@ module.exports = {
if (err)
throw err;
console.log("->s5" + JSON.stringify(stu));
stu.license = license;
res.ok(stu);
......
......@@ -16,12 +16,13 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast) {
// For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup';
$scope.spin_disabled = true;
// Set upload button to filestyle
$(":file").filestyle({
/*$(":file").filestyle({
buttonText: " " + $translate.instant('change_picture'),
input: false
});
});*/
$scope.supsForm = {};
......@@ -35,6 +36,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
var extension;
var filename;
console.log("selected!!");
$scope.spin_disabled = false;
for (i = 0; i < $files.length; i++) {
file = $files[i]; // { name, size, type }
......@@ -62,6 +64,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast.success({ content: $translate.instant('student_updated') });
console.log(JSON.stringify(data));
$scope.studentData.pic = '/upload/studentAvatar/' + data.file.name;
$scope.spin_disabled = true;
});
} else {
ngToast.danger({ content: $translate.instant('error_only_support_images') });
......
......@@ -15,7 +15,10 @@
<img class="thumbnail preview" ng-src="{{studentData.pic}}" />
<!-- Fin Cambiar imagen de perfil -->
<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>
......
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