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
af574442
authored
Jan 11, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue #774 fixed
parent
21816551
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
6 deletions
sails/src/api/controllers/PictoController.js
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/SupervisorController.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/controllers/setup.js
sails/src/assets/scripts/modules/supervisor/controllers/setup.js
sails/src/api/controllers/PictoController.js
View file @
af574442
...
...
@@ -293,7 +293,7 @@ module.exports = {
sails
.
log
.
debug
(
"Uploading picto with FileName: "
+
pictoFileName
);
req
.
file
(
'file'
).
upload
({
maxBytes
:
10
00000
,
maxBytes
:
10
48576
,
dirname
:
pictoDirectory
,
saveAs
:
pictoFileName
},
function
whenDone
(
err
,
uploadedFiles
)
{
...
...
sails/src/api/controllers/StudentController.js
View file @
af574442
...
...
@@ -1007,12 +1007,12 @@ module.exports = {
newAvatarFileName
=
sails
.
config
.
pictogram
.
paths
.
getStudentAvatarFileName
(
student
.
id
);
req
.
file
(
'file'
).
upload
({
maxBytes
:
10
00000
,
maxBytes
:
10
48576
,
dirname
:
newAvatarDirectory
,
saveAs
:
newAvatarFileName
},
function
whenDone
(
error
,
uploadedFiles
)
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
throw
new
Error
(
"u
pload failed"
);
return
res
.
badRequest
(
"U
pload failed"
);
}
try
{
...
...
sails/src/api/controllers/SupervisorController.js
View file @
af574442
...
...
@@ -530,12 +530,12 @@ module.exports = {
sails
.
log
.
debug
(
"Saving file to "
+
newAvatarDirectory
+
"/"
+
newAvatarFileName
);
req
.
file
(
'file'
).
upload
({
maxBytes
:
10
00000
,
maxBytes
:
10
48576
,
dirname
:
newAvatarDirectory
,
saveAs
:
newAvatarFileName
},
function
whenDone
(
error
,
uploadedFiles
)
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
throw
new
Error
(
"u
pload failed"
);
return
res
.
badRequest
(
"U
pload failed"
);
}
try
{
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
af574442
...
...
@@ -100,6 +100,7 @@
"error_only_support_images"
:
"Only images are supported (JPG, PNG or GIF files)"
,
"error_on_request"
:
"The request has not been processed. Please, check your fields"
,
"error_on_request_sup_not_found"
:
"Account not found or it has not been activated"
,
"error_on_upload"
:
"Error on image upload. The maximum allowed size for images is 1 MB."
,
"error_loading_pictos"
:
"Error loading pictos information"
,
"error_general"
:
"An error has been produced"
,
"expand_navigation"
:
"Expand navigation"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
af574442
...
...
@@ -103,6 +103,7 @@
"error_only_support_images"
:
"Sólo se soportan imágenes (ficheros JPG, PNG o GIF)"
,
"error_on_request"
:
"Se ha producido un error. Por favor, compruebe los valores introducidos."
,
"error_on_request_sup_not_found"
:
"La cuenta no existe o no ha sido activada"
,
"error_on_upload"
:
"Error al subir la imagen. Compruebe que el archivo no supera 1MB de tamaño."
,
"error_loading_pictos"
:
"Error cargando información de los pictos"
,
"error_general"
:
"Se ha producido un error"
,
"February"
:
"Febrero"
,
...
...
sails/src/assets/scripts/modules/student/controllers/setup.js
View file @
af574442
...
...
@@ -63,9 +63,14 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
ngToast
.
success
({
content
:
$translate
.
instant
(
'student_updated'
)
});
$scope
.
studentData
.
pic
=
'/upload/studentAvatar/'
+
data
.
file
.
name
;
$scope
.
spin_disabled
=
true
;
})
.
error
(
function
(
err
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_on_upload'
)});
$scope
.
spin_disabled
=
true
;
});
}
else
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_only_support_images'
)
});
$scope
.
spin_disabled
=
true
;
}
}
};
...
...
sails/src/assets/scripts/modules/supervisor/controllers/setup.js
View file @
af574442
...
...
@@ -62,10 +62,12 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
$scope
.
spin_disabled
=
true
;
})
.
error
(
function
(
err
)
{
console
.
log
(
"ERROR while uploading image: "
+
err
);
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_on_upload'
)});
$scope
.
spin_disabled
=
true
;
});
}
else
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_only_support_images'
)
});
$scope
.
spin_disabled
=
true
;
}
}
};
...
...
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