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
de5310af
authored
Aug 01, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue #501 fixed
parent
b9d580e1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
130 additions
and
47 deletions
sails/src/Gruntfile.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/controllers/addpicto.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/controllers/pictoexp.js
sails/src/assets/scripts/modules/student/controllers/tags.js
sails/src/Gruntfile.js
View file @
de5310af
...
...
@@ -12,6 +12,7 @@
* Check out the `tasks` directory instead.
*/
module
.
exports
=
function
(
grunt
)
{
var
includeAll
;
var
taskConfigurations
;
var
registerDefinitions
;
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
de5310af
...
...
@@ -184,6 +184,7 @@
"picto_added"
:
"Picto successfully added"
,
"picto_behavior"
:
"Behavior of a pictogram when it is selected (without phrase tape)"
,
"picto_labels"
:
"Pictogram labels"
,
"picto_removed"
:
"Picto has been removed from vocabulary"
,
"picto_style"
:
"Pictogram style"
,
"picto_upload_error"
:
"Error uploading picto"
,
"picto_upload_limit"
:
"Image size is too large"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
de5310af
...
...
@@ -184,6 +184,7 @@
"picto_added"
:
"Picto añadido correctamente"
,
"picto_behavior"
:
"Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)"
,
"picto_labels"
:
"Etiquetas del pictograma"
,
"picto_removed"
:
"El pictograma se ha eliminado del vocabulario"
,
"picto_style"
:
"Aspecto de los pictogramas"
,
"picto_upload_error"
:
"Hubo un error al guardar el picto"
,
"picto_upload_limit"
:
"El tamaño del picto es demasiado grande"
,
...
...
sails/src/assets/scripts/modules/student/controllers/addpicto.js
View file @
de5310af
...
...
@@ -338,6 +338,37 @@ dashboardControllers.controller('AddPictoCtrl', function (
};
//
// Delete picto added to free category
//
$scope
.
removeFreePicto
=
function
(
studentPicto
)
{
$http
.
delete
(
config
.
backend
+
'/stu/'
+
student
.
id
+
'/picto/'
+
studentPicto
.
id
)
.
success
(
function
()
{
var
i
;
freeCategoryPictos
[
studentPicto
.
attributes
.
free_category_coord_x
]
[
studentPicto
.
attributes
.
free_category_coord_y
]
=
emptyStudentPicto
;
for
(
i
=
0
;
i
<
$scope
.
freeAddedPictos
.
length
;
i
++
)
{
if
(
studentPicto
===
$scope
.
freeAddedPictos
[
i
])
{
$scope
.
freeAddedPictos
.
splice
(
i
,
1
);
break
;
}
}
// websocket emit vocabulary delete action
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
student
.
id
,
stu_picto
:
studentPicto
}
},
function
()
{});
})
.
error
(
function
()
{});
};
//
// Delete own picto
//
$scope
.
remove_own_picto
=
function
(
pictoId
)
{
...
...
@@ -351,6 +382,16 @@ dashboardControllers.controller('AddPictoCtrl', function (
$scope
.
pictos
.
splice
(
i
,
1
);
}
}
// websocket emit vocabulary delete action
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
student
.
id
,
stu_picto
:
pictoId
}
},
function
()
{});
})
.
error
(
function
()
{});
});
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
de5310af
...
...
@@ -16,7 +16,8 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$location
,
$filter
,
$anchorScroll
,
$modal
)
{
$modal
,
$translate
)
{
$scope
.
emptyStudentPicto
=
{
id
:
null
,
picto
:
{
...
...
@@ -134,44 +135,56 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Delete student picto
$scope
.
delete_picto
=
function
(
studentPicto
)
{
var
deleteStuPicto
=
$window
.
confirm
(
'Are you absolutely sure you want to delete?'
);
if
(
deleteStuPicto
)
{
$http
.
delete
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/picto/'
+
studentPicto
.
id
)
.
success
(
function
()
{
$scope
.
studentPictos
[
$scope
.
getCategoryId
(
studentPicto
)]
[
studentPicto
.
attributes
.
coord_x
]
[
studentPicto
.
attributes
.
coord_y
]
=
$scope
.
emptyStudentPicto
;
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
$scope
.
studentData
.
id
,
stu_picto
:
studentPicto
}
},
function
()
{});
}).
error
(
function
()
{});
}
$translate
(
'confirmation'
).
then
(
t
=>
{
if
(
$window
.
confirm
(
t
))
{
$http
.
delete
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/picto/'
+
studentPicto
.
id
)
.
success
(
function
()
{
$scope
.
studentPictos
[
$scope
.
getCategoryId
(
studentPicto
)]
[
studentPicto
.
attributes
.
coord_x
]
[
studentPicto
.
attributes
.
coord_y
]
=
$scope
.
emptyStudentPicto
;
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
$scope
.
studentData
.
id
,
stu_picto
:
studentPicto
.
id
}
},
function
()
{});
$translate
(
'picto_removed'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
translation
});
});
}).
error
(
function
()
{});
}
});
};
$scope
.
deleteFreePicto
=
function
(
studentPicto
)
{
var
deleteStuPicto
=
$window
.
confirm
(
'Are you absolutely sure you want to delete?'
);
if
(
deleteStuPicto
)
{
$http
.
delete
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/picto/'
+
studentPicto
.
id
)
.
success
(
function
()
{
$scope
.
freeCategoryPictos
[
studentPicto
.
attributes
.
free_category_coord_x
]
[
studentPicto
.
attributes
.
free_category_coord_y
]
=
$scope
.
emptyStudentPicto
;
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
$scope
.
studentData
.
id
,
stu_picto
:
studentPicto
}
},
function
()
{});
}).
error
(
function
()
{});
}
$translate
(
'confirmation'
).
then
(
t
=>
{
if
(
$window
.
confirm
(
t
))
{
$http
.
delete
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/picto/'
+
studentPicto
.
id
)
.
success
(
function
()
{
$scope
.
freeCategoryPictos
[
studentPicto
.
attributes
.
free_category_coord_x
]
[
studentPicto
.
attributes
.
free_category_coord_y
]
=
$scope
.
emptyStudentPicto
;
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'delete'
,
attributes
:
{
id_stu
:
$scope
.
studentData
.
id
,
stu_picto
:
studentPicto
.
id
}
},
function
()
{});
$translate
(
'picto_removed'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
translation
});
});
}).
error
(
function
()
{});
}
});
};
// View student picto
...
...
@@ -248,6 +261,8 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
attributes
:
studentPicto
.
attributes
})
.
success
(
function
(
newStudentPicto
)
{
// notify
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'update'
,
attributes
:
{
...
...
@@ -312,6 +327,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
},
sup
:
function
()
{
return
$scope
.
user
;
},
stu
:
function
()
{
return
$scope
.
studentData
;
}
}
});
...
...
sails/src/assets/scripts/modules/student/controllers/pictoconfig.js
View file @
de5310af
...
...
@@ -9,7 +9,7 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
// Student
$scope
.
stu
=
stu
;
// Supervisor
// Supervisor
$scope
.
sup
=
sup
;
// Picto
$scope
.
studentPicto
=
studentPicto
;
...
...
@@ -24,7 +24,7 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
// Comprobación del supervisor propietario del picto
if
(
studentPicto
.
picto
.
owner
==
sup
.
id
){
$http
.
post
(
config
.
backend
+
'/picto/exp'
,
.
post
(
config
.
backend
+
'/picto/exp'
,
{
'picto'
:
studentPicto
.
picto
.
id
,
'lang'
:
$scope
.
sup
.
lang
,
'text'
:
$scope
.
expression
...
...
@@ -36,6 +36,14 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
$modalInstance
.
close
(
$scope
.
expression
);
// Notifcar cambio
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'update'
,
attributes
:
{
id_stu
:
student
.
id
,
stu_picto
:
studentPicto
.
id
}
},
function
()
{});
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
...
...
@@ -48,7 +56,7 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
console
.
log
(
"Atributos: "
+
JSON
.
stringify
(
$scope
.
studentPicto
.
attributes
));
$http
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
stu
.
id
+
'/picto/'
+
.
put
(
config
.
backend
+
'/stu/'
+
$scope
.
stu
.
id
+
'/picto/'
+
$scope
.
studentPicto
.
id
,
{
'attributes'
:
$scope
.
studentPicto
.
attributes
})
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Properties updated"
);
...
...
@@ -58,15 +66,15 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'update'
,
attributes
:
{
id_stu
:
$scope
.
stu
.
id
,
id_stu
:
$scope
.
stu
.
id
,
picto
:
data
}
},
},
function
(
res
)
{
console
.
log
(
"Vocabulary emited: "
+
JSON
.
stringify
(
res
.
msg
));
});
///////////////////////////////////////////////////////////////
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
...
...
sails/src/assets/scripts/modules/student/controllers/pictoexp.js
View file @
de5310af
...
...
@@ -15,9 +15,9 @@ dashboardControllers.controller('PictoExpCtrl', function ($scope, $modalInstance
// Save expression
$scope
.
save
=
function
()
{
$http
.
post
(
config
.
backend
+
'/picto/exp'
,
.
post
(
config
.
backend
+
'/picto/exp'
,
{
'picto'
:
picto
.
id
,
'lang'
:
$scope
.
sup
.
lang
,
'text'
:
$scope
.
expression
...
...
@@ -27,13 +27,11 @@ dashboardControllers.controller('PictoExpCtrl', function ($scope, $modalInstance
// Close the modal instance
$modalInstance
.
close
(
data
);
// Notifcar cambio
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
});
};
$scope
.
close
=
function
()
{
...
...
sails/src/assets/scripts/modules/student/controllers/tags.js
View file @
de5310af
...
...
@@ -12,12 +12,16 @@ dashboardControllers.controller('TagsCtrl', function TagsCtrl(
config
,
studentPicto
,
sup
,
stu
,
$translate
,
ngToast
)
{
// Supervisor
$scope
.
sup
=
sup
;
// Student
$scope
.
stu
=
stu
;
// List of tags
$scope
.
tags
=
[];
// tags we don't own
$scope
.
ownTags
=
[];
// tags we own
...
...
@@ -43,6 +47,17 @@ dashboardControllers.controller('TagsCtrl', function TagsCtrl(
$scope
.
ownTags
.
push
(
data
);
studentPicto
.
tags
.
push
(
data
);
$scope
.
tagToAdd
=
''
;
// Notifcar cambio
io
.
socket
.
post
(
'/stu/vocabulary'
,
{
action
:
'update'
,
attributes
:
{
id_stu
:
$scope
.
stu
,
stu_picto
:
studentPicto
.
id
}
},
function
()
{});
})
.
error
(
function
()
{
$translate
(
'error_adding_tag'
).
then
(
function
(
translation
)
{
...
...
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