Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d0d80d0f
authored
Dec 28, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
image change in profiles fixed
parent
0bcffb20
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
sails/src/api/controllers/StudentController.js
sails/src/assets/scripts/modules/student/controllers/setup.js
sails/src/assets/scripts/modules/student/views/setup.html
sails/src/api/controllers/StudentController.js
View file @
d0d80d0f
...
...
@@ -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
);
...
...
sails/src/assets/scripts/modules/student/controllers/setup.js
View file @
d0d80d0f
...
...
@@ -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'
)
});
...
...
sails/src/assets/scripts/modules/student/views/setup.html
View file @
d0d80d0f
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment