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
4a4e49eb
authored
Apr 26, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
WebSocket scene
parent
fff79ad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
4a4e49eb
...
...
@@ -235,7 +235,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
//Socket notify
io
.
socket
.
post
(
'/scene'
,
{
action
:
'delete'
,
data
:
{
id
:
scene
.
id
}
scene
:
{
id
:
scene
.
id
}
},
function
()
{});
//Reload active scene
...
...
@@ -272,7 +272,9 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
active
:
scene
.
active
,
id_stu
:
scene
.
student
})
.
success
(
function
(
scene
)
{
var
data
=
{
name
:
scene
.
name
,
var
data
=
{
id
:
scene
.
id
,
name
:
scene
.
name
,
active
:
scene
.
active
,
categories
:
scene
.
categories
,
student
:
scene
.
student
,
...
...
@@ -641,20 +643,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Add new listener to the event
io
.
socket
.
off
(
'vocabulary'
);
io
.
socket
.
on
(
'vocabulary'
,
function
(
data
)
{
// switch (data.action) {
// case 'add':
// $scope.loadPictos();
// break;
// case 'update':
// $scope.loadPictos();
// break;
// case 'delete':
// $scope.loadPictos();
// break;
// default:
// $scope.loadPictos();
// break;
// }
if
(
data
.
attributes
.
id_scene
==
$scope
.
viewingScene
.
id
){
//Reload scene
$translate
(
'reload_scene'
).
then
(
function
(
translation
)
{
...
...
@@ -665,6 +653,26 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope
.
$apply
();
});
// Add new listener to the event
io
.
socket
.
off
(
'scene'
);
io
.
socket
.
on
(
'scene'
,
function
(
data
)
{
if
(
data
.
action
==
"delete"
&&
data
.
scene
.
id
==
$scope
.
viewingScene
.
id
){
//Scene deleted
$translate
(
'scene_deleted'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
translation
});
});
$scope
.
showActiveScene
();
}
else
if
(
data
.
action
==
"update"
&&
data
.
scene
.
id
==
$scope
.
viewingScene
.
id
){
$translate
(
'scene_updated'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
translation
});
});
$scope
.
showScene
(
data
.
scene
.
id
);
}
$scope
.
loadScenesList
();
$scope
.
$apply
();
});
// Load pictos
$scope
.
showActiveScene
();
$scope
.
loadScenesList
();
...
...
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