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
bbe52b30
authored
Jan 17, 2018
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue
#455
fixed
parent
ca331421
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
19 deletions
sails/src/api/controllers/GridController.js
sails/src/api/controllers/StudentController.js
sails/src/api/models/Grid.js
sails/src/api/models/StuPicto.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/controllers/pictoconfig.js
sails/src/assets/scripts/modules/student/views/collections.html
sails/src/assets/scripts/modules/student/views/pictoconfig.html
sails/src/api/controllers/GridController.js
View file @
bbe52b30
...
...
@@ -139,21 +139,25 @@ module.exports = {
duplicate
:
function
(
req
,
res
){
Grid
.
findOne
({
id
:
req
.
params
.
id
})
.
populate
(
'stuPictos'
).
then
(
function
(
grid
){
.
populate
(
'stuPictos'
)
.
then
(
function
(
grid
)
{
Grid
.
create
({
name
:
grid
.
name
,
//categories: grid.categories,
supervisor
:
grid
.
supervisor
,
student
:
grid
.
student
}).
then
(
newGrid
=>
{
})
.
then
((
newGrid
)
=>
{
grid
.
stuPictos
.
forEach
(
function
(
stuPicto
,
cb
)
{
StuPicto
.
create
({
student
:
stuPicto
.
student
,
picto
:
stuPicto
.
picto
,
grid
:
newGrid
.
id
,
childGrid
:
stuPicto
.
childGrid
,
attributes
:
stuPicto
.
attributes
}).
catch
(
function
(
err
){
console
.
log
(
"Error creating stu_picto "
+
err
.
details
);
})
.
catch
(
function
(
err
){
console
.
log
(
"Error creating stu_picto "
+
err
.
details
);
sails
.
log
.
error
(
err
.
details
);
});
});
...
...
sails/src/api/controllers/StudentController.js
View file @
bbe52b30
...
...
@@ -1189,7 +1189,7 @@ module.exports = {
StuPicto
.
update
(
query
,
{
attributes
:
params
.
attributes
,
id_child_grid
:
params
.
id_child_g
rid
||
null
childGrid
:
params
.
childG
rid
||
null
})
.
then
(
updated
=>
{
if
(
!
updated
)
...
...
sails/src/api/models/Grid.js
View file @
bbe52b30
...
...
@@ -101,12 +101,12 @@ module.exports = {
stuPicto
.
attributes
.
uri_sound
=
stuPicto
.
attributes
.
uri_sound
?
stuPicto
.
attributes
.
uri_sound
:
null
;
stuPicto
.
attributes
.
user_avatar
=
stuPicto
.
attributes
.
user_avatar
?
stuPicto
.
attributes
.
user_avatar
:
null
;
var
stuPictoToAdd
=
{
"id"
:
stuPicto
.
id
,
"picto"
:
stuPicto
.
picto
,
"id_grid"
:
stuPicto
.
grid
,
"id_child_grid"
:
stuPicto
.
id_child_g
rid
,
"attributes"
:
stuPicto
.
attributes
,
"tags"
:
picto
.
tags
?
picto
.
tags
:
[]
id
:
stuPicto
.
id
,
picto
:
stuPicto
.
picto
,
grid
:
stuPicto
.
grid
,
childGrid
:
stuPicto
.
childG
rid
,
attributes
:
stuPicto
.
attributes
,
tags
:
picto
.
tags
?
picto
.
tags
:
[]
};
l
.
push
(
stuPictoToAdd
);
next_cb
();
...
...
sails/src/api/models/StuPicto.js
View file @
bbe52b30
...
...
@@ -37,7 +37,7 @@ module.exports = {
type
:
'integer'
,
model
:
'Grid'
},
id_child_g
rid
:
{
childG
rid
:
{
columnName
:
'id_child_grid'
,
type
:
'integer'
,
model
:
'Grid'
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
bbe52b30
...
...
@@ -396,7 +396,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$http
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/picto/'
+
studentPicto
.
id
,
{
attributes
:
studentPicto
.
attributes
,
id_child_grid
:
studentPicto
.
id_child_g
rid
childGrid
:
studentPicto
.
childG
rid
})
.
success
(
function
(
newStuPicto
)
{
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
...
...
sails/src/assets/scripts/modules/student/controllers/pictoconfig.js
View file @
bbe52b30
...
...
@@ -57,8 +57,8 @@ dashboardControllers.controller('PictoConfigCtrl', function (
$http
.
put
(
config
.
backend
+
'/stu/'
+
stu
.
id
+
'/picto/'
+
$scope
.
studentPicto
.
id
,
{
'attributes'
:
$scope
.
studentPicto
.
attributes
,
'id_child_grid'
:
$scope
.
studentPicto
.
id_child_g
rid
||
null
attributes
:
$scope
.
studentPicto
.
attributes
,
childGrid
:
$scope
.
studentPicto
.
childG
rid
||
null
})
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
resolve
(
data
);
...
...
sails/src/assets/scripts/modules/student/views/collections.html
View file @
bbe52b30
...
...
@@ -59,14 +59,14 @@
<!-- Red cross -->
<img
src=
"/app/img/redcross.png"
ng-click=
"showGrid(studentPicto.
id_child_g
rid,'parentPicto')"
ng-click=
"showGrid(studentPicto.
childG
rid,'parentPicto')"
class=
"red-cross-visibility disabled"
ng-if=
"studentPicto.attributes.status == 'disabled'"
>
<!--./ Red cross -->
<!-- Picto -->
<img
class=
"unselectable"
ng-click=
"showGrid(studentPicto.
id_child_g
rid,'parentPicto')"
ng-click=
"showGrid(studentPicto.
childG
rid,'parentPicto')"
ng-src=
"{{studentPicto.picto.uri}}"
ng-class=
"{ 'novisible': studentPicto.attributes.status == 'invisible', 'deactivate': studentPicto.attributes.status == 'disabled' }"
ng-style=
"{ 'background-color': studentPicto.attributes.color || '#ffffff' }"
>
...
...
sails/src/assets/scripts/modules/student/views/pictoconfig.html
View file @
bbe52b30
...
...
@@ -64,12 +64,12 @@
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<select
class=
"form-control"
ng-model=
"studentPicto.
id_child_g
rid"
>
<select
class=
"form-control"
ng-model=
"studentPicto.
childG
rid"
>
<option
value=
""
>
--- Ninguno ---
</option>
<option
ng-repeat=
"grid in gridsList track by $index"
ng-if=
"grid.id != viewingGrid.id"
ng-selected=
"(grid.id == studentPicto.
id_child_g
rid)"
ng-selected=
"(grid.id == studentPicto.
childG
rid)"
value=
"{{ grid.id }}"
>
{{ grid.name }}
</option>
</select>
...
...
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