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
fc8fb44f
authored
Jan 17, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Error getting pictos from symbolstix fixed
parent
ec8594b7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
38 deletions
sails/roles/database/files/triggers-enrolments-integrity-constraints.sql
sails/src/api/controllers/StudentController.js
sails/src/api/models/Student.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/views/collections.html
sails/roles/database/files/triggers-enrolments-integrity-constraints.sql
View file @
fc8fb44f
...
@@ -55,7 +55,7 @@ thisTrigger: BEGIN
...
@@ -55,7 +55,7 @@ thisTrigger: BEGIN
office
.
id
=
new
.
id_off
;
office
.
id
=
new
.
id_off
;
INSERT
INTO
stu_picto
(
id_stu
,
id_pic
,
attributes
)
INSERT
INTO
stu_picto
(
id_stu
,
id_pic
,
attributes
)
SELECT
new
.
id
,
id_pic
,
concat
(
'{"id_cat":'
,
if
(
id_cat_pic
is
null
,
'null'
,
id_cat_pic
),
SELECT
new
.
id
,
id_pic
,
concat
(
'{"id_cat":'
,
if
(
id_cat_pic
is
null
,
'null'
,
id_cat_pic
),
',"coord_x":'
,
coord_x
,
',"coord_x":'
,
coord_x
,
',"coord_y":'
,
coord_y
,
',"coord_y":'
,
coord_y
,
',"status":"invisible"'
,
',"status":"invisible"'
,
...
...
sails/src/api/controllers/StudentController.js
View file @
fc8fb44f
...
@@ -976,35 +976,45 @@ module.exports = {
...
@@ -976,35 +976,45 @@ module.exports = {
var
params
=
req
.
allParams
();
var
params
=
req
.
allParams
();
var
attrs
=
{};
var
attrs
=
{};
// Get previous entry
StuPicto
.
findOne
(
params
.
prev_id_stu_pic
)
StuPicto
.
findOne
(
params
.
prev_id_stu_pic
)
.
then
((
prev
)
=>
{
.
then
((
sp
)
=>
{
if
(
!
prev
)
if
(
!
sp
)
throw
new
Error
(
"error on update"
);
throw
new
Error
(
"error on update"
);
Student
.
findOne
(
params
.
id_stu
)
// Create new one
.
then
((
s
)
=>
{
var
newsp
=
StuPicto
.
create
({
if
(
!
s
)
throw
new
Error
(
"Student not found"
);
student
:
params
.
id_stu
,
console
.
log
(
"id_pic: "
+
sp
.
picto
+
", lang: "
+
s
.
lang
);
picto
:
params
.
new_id_pic
,
PictoExp
.
findOne
({
id_pic
:
sp
.
picto
,
lang
:
s
.
lang
})
attributes
:
prev
.
attributes
.
then
((
pe
)
=>
{
if
(
!
pe
)
throw
new
Error
(
"Expression not found"
);
var
old_picto
=
sp
.
picto
;
sp
.
picto
=
params
.
new_id_pic
;
sp
.
attributes
.
expression
=
pe
.
text
;
// Save modified stu_picto entry for category
sp
.
save
((
err
)
=>
{
if
(
err
)
throw
err
;
// Update attributes.id_cat for all pictos
StuPicto
.
find
({
id_stu
:
params
.
id_stu
})
.
then
(
sps
=>
{
for
(
var
i
=
0
;
i
<
sps
.
length
;
i
++
)
{
if
(
sps
[
i
].
attributes
.
id_cat
==
old_picto
)
{
sps
[
i
].
attributes
.
id_cat
=
params
.
new_id_pic
;
sps
[
i
].
save
();
}
}
return
res
.
ok
(
sp
);
})
.
catch
(
e
=>
{
throw
e
});
});
})
.
catch
(
e
=>
{
throw
e
});
})
})
.
then
(
newsp
=>
newsp
)
.
catch
(
e
=>
{
throw
e
})
.
catch
(
err
=>
{
throw
err
});
var
picto
=
Picto
.
findOne
(
params
.
new_id_pic
)
.
then
(
p
=>
p
)
.
catch
(
err
=>
{
throw
err
});
return
[
prev
,
newsp
,
picto
];
})
.
spread
(
function
(
prev
,
newsp
,
picto
)
{
// Destroy previous entry
StuPicto
.
destroy
({
id
:
prev
.
id
})
.
then
(()
=>
{
res
.
ok
(
newsp
)})
.
catch
(
err
=>
{
throw
err
});
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
return
res
.
serverError
(
'Unable to update category for student: '
+
err
);
return
res
.
serverError
(
'Unable to update category for student: '
+
err
);
});
});
},
},
...
...
sails/src/api/models/Student.js
View file @
fc8fb44f
...
@@ -381,7 +381,7 @@ module.exports = {
...
@@ -381,7 +381,7 @@ module.exports = {
var
stuPictoToAdd
=
{
var
stuPictoToAdd
=
{
"id"
:
stuPicto
.
id
,
"id"
:
stuPicto
.
id
,
"picto"
:
stuPicto
.
picto
,
"picto"
:
stuPicto
.
picto
,
"expression"
:
picto
.
expressions
[
0
]
,
"expression"
:
stuPicto
.
attributes
.
expression
?
stuPicto
.
attributes
.
expression
:
picto
.
expressions
[
0
].
text
,
"attributes"
:
stuPicto
.
attributes
,
"attributes"
:
stuPicto
.
attributes
,
"tags"
:
picto
.
tags
?
picto
.
tags
:
[]
"tags"
:
picto
.
tags
?
picto
.
tags
:
[]
};
};
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
fc8fb44f
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
"categories"
:
"Categories"
,
"categories"
:
"Categories"
,
"category_pictograms"
:
"Category's pictograms"
,
"category_pictograms"
:
"Category's pictograms"
,
"change_password"
:
"Change password"
,
"change_password"
:
"Change password"
,
"change_cat_picto"
:
"Change category pictogram"
,
"change_picture"
:
"Change picture"
,
"change_picture"
:
"Change picture"
,
"child"
:
"Child"
,
"child"
:
"Child"
,
"click"
:
"Click"
,
"click"
:
"Click"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
fc8fb44f
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
"categories"
:
"Categorías"
,
"categories"
:
"Categorías"
,
"category_pictograms"
:
"Pictogramas de la categoría"
,
"category_pictograms"
:
"Pictogramas de la categoría"
,
"change_password"
:
"Cambiar contraseña"
,
"change_password"
:
"Cambiar contraseña"
,
"change_cat_picto"
:
"Cambiar pictograma de la categoría"
,
"change_picture"
:
"Cambiar fotografía"
,
"change_picture"
:
"Cambiar fotografía"
,
"child"
:
"Niño"
,
"child"
:
"Niño"
,
"click"
:
"Clic"
,
"click"
:
"Clic"
,
...
...
sails/src/assets/scripts/modules/student/views/collections.html
View file @
fc8fb44f
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
('empty-' + colIndex + '-' + rowIndex)
('empty-' + colIndex + '-' + rowIndex)
}}"
}}"
draggable
droppable
drop=
"handleDrop"
draggable
droppable
drop=
"handleDrop"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression}}"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression}}"
popover-trigger=
"mouseenter"
popover-trigger=
"mouseenter"
ng-init=
"colIndex = $index"
ng-init=
"colIndex = $index"
ng-repeat=
"studentPicto in studentPictoRow track by $index"
>
ng-repeat=
"studentPicto in studentPictoRow track by $index"
>
...
@@ -41,13 +41,13 @@
...
@@ -41,13 +41,13 @@
<div
<div
class=
"picto-legend-normal"
class=
"picto-legend-normal"
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<div
<div
class=
"picto-legend-full"
class=
"picto-legend-full"
ng-if=
"studentPicto.attributes.legend == 'full'"
>
ng-if=
"studentPicto.attributes.legend == 'full'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<!-- /.picto-legend -->
<!-- /.picto-legend -->
<img
<img
...
@@ -121,19 +121,19 @@
...
@@ -121,19 +121,19 @@
class=
"picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
class=
"picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
ng-repeat=
"studentPicto in studentPictoRow track by $index"
ng-repeat=
"studentPicto in studentPictoRow track by $index"
ng-init=
"colIndex = $index"
ng-init=
"colIndex = $index"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression}}"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression}}"
popover-trigger=
"mouseenter"
>
popover-trigger=
"mouseenter"
>
<!-- picto-legend -->
<!-- picto-legend -->
<div
<div
class=
"picto-legend-normal"
class=
"picto-legend-normal"
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<div
<div
class=
"picto-legend-full"
class=
"picto-legend-full"
ng-if=
"studentPicto.attributes.legend == 'full'"
>
ng-if=
"studentPicto.attributes.legend == 'full'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<!-- /.picto-legend -->
<!-- /.picto-legend -->
<img
<img
...
@@ -178,7 +178,10 @@
...
@@ -178,7 +178,10 @@
ng-click=
"change_category(studentPicto)"
ng-click=
"change_category(studentPicto)"
ng-if=
"studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'"
ng-if=
"studentPicto !== emptyStudentPicto && studentPicto.attributes.coord_y != '0'"
class=
"picto_cat_edit"
>
class=
"picto_cat_edit"
>
<i
class=
"glyphicon glyphicon-picture"
aria-hidden=
"true"
></i>
<i
class=
"glyphicon glyphicon-picture"
aria-hidden=
"true"
title=
"{{ 'change_cat_picto' | translate}}"
>
</i>
</a>
</a>
</div>
</div>
<div
<div
...
@@ -223,7 +226,7 @@
...
@@ -223,7 +226,7 @@
class=
"picto-grid picto-category-grid"
class=
"picto-grid picto-category-grid"
ng-if=
"selectedCategory !== emptyStudentPicto && !showFreeCategory"
ng-if=
"selectedCategory !== emptyStudentPicto && !showFreeCategory"
ng-style=
"{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }"
>
ng-style=
"{ 'background-color': shadeColor(selectedCategory.attributes.color, 0.3) }"
>
<h3
class=
"picto-category-grid__title"
>
{{ selectedCategory.expression
.text
}}
</h3>
<h3
class=
"picto-category-grid__title"
>
{{ selectedCategory.expression }}
</h3>
<div
<div
ng-repeat=
"studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-repeat=
"studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-init=
"rowIndex = $index"
ng-init=
"rowIndex = $index"
...
@@ -237,7 +240,7 @@
...
@@ -237,7 +240,7 @@
('empty-' + colIndex + '-' + rowIndex)
('empty-' + colIndex + '-' + rowIndex)
}}"
}}"
draggable
droppable
drop=
"handleDrop"
draggable
droppable
drop=
"handleDrop"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression}}"
popover=
"{{studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression}}"
popover-trigger=
"mouseenter"
popover-trigger=
"mouseenter"
ng-repeat=
"studentPicto in studentPictoRow track by $index"
ng-repeat=
"studentPicto in studentPictoRow track by $index"
ng-init=
"colIndex = $index"
>
ng-init=
"colIndex = $index"
>
...
@@ -245,13 +248,13 @@
...
@@ -245,13 +248,13 @@
<div
<div
class=
"picto-legend-normal"
class=
"picto-legend-normal"
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
ng-if=
"studentPicto.attributes.legend == 'normal'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<div
<div
class=
"picto-legend-full"
class=
"picto-legend-full"
ng-if=
"studentPicto.attributes.legend == 'full'"
>
ng-if=
"studentPicto.attributes.legend == 'full'"
>
{{ studentPicto.attributes.expression==null ? studentPicto.expression
.text
: studentPicto.attributes.expression }}
{{ studentPicto.attributes.expression==null ? studentPicto.expression : studentPicto.attributes.expression }}
</div>
</div>
<!-- /.picto-legend -->
<!-- /.picto-legend -->
<img
<img
...
...
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