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
5accdc6f
authored
Apr 07, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merged branch develop into develop
parents
2fde7804
d0caa7d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/models/StuPicto.js
sails/src/api/controllers/StudentController.js
View file @
5accdc6f
...
...
@@ -1199,24 +1199,21 @@ module.exports = {
upload_sound
:
function
(
req
,
res
)
{
var
soundFileName
;
var
soundDirectory
=
sails
.
config
.
pictogram
.
paths
.
pictoSoundDirectory
;
console
.
log
(
"Llega aqui 1"
);
soundFileName
=
sails
.
config
.
pictogram
.
paths
.
getCustomPictoSoundFilename
(
req
.
params
.
id_stu_picto
);
console
.
log
(
"Llega aqui 2"
);
req
.
file
(
'file'
).
upload
({
maxBytes
:
1048576
,
dirname
:
soundDirectory
,
saveAs
:
soundFileName
},
function
whenDone
(
err
,
uploadedFiles
)
{
console
.
log
(
"Llega aqui 3"
);
var
fs
=
require
(
'fs'
);
if
(
err
||
(
uploadedFiles
.
length
===
0
))
return
res
.
serverError
(
"Error uploading "
+
err
?
err
:
""
);
console
.
log
(
"Llega aqui 4"
);
StuPicto
.
findOne
({
id
:
req
.
params
.
id_stu_picto
})
.
then
(
sp
=>
{
console
.
log
(
"Picto encontrado"
)
StuPicto
.
findOne
({
id
:
req
.
params
.
id_stu_picto
})
.
then
((
sp
)
=>
{
if
(
!
sp
)
throw
Error
(
"Not found"
);
sp
.
attributes
.
uri_sound
=
soundFileName
;
sp
.
save
(
function
(
err
)
{
if
(
err
)
throw
err
;
...
...
sails/src/api/models/StuPicto.js
View file @
5accdc6f
...
...
@@ -137,8 +137,8 @@ module.exports = {
if
(
!
((
/^#
([
0-9a-f
]{3}){1,2}
$/i
).
test
(
validAttributes
.
color
)))
{
delete
validAttributes
.
color
;
}
if
(
typeof
validAttributes
.
sound_uri
!==
'string'
)
{
delete
validAttributes
.
sound_uri
;
if
(
typeof
validAttributes
.
uri_sound
!==
'string'
)
{
delete
validAttributes
.
uri_sound
;
}
if
(
typeof
validAttributes
.
user_avatar
!==
'string'
)
{
delete
validAttributes
.
user_avatar
;
...
...
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