picto status change doesnt reload all the dashboard

parent 5a341b73
......@@ -602,9 +602,16 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
io.socket.off('vocabulary');
io.socket.on('vocabulary', function (data) {
if(data.attributes.id_grid == $scope.viewingGrid.id){
//Reload grid
ngToast.success($translate.instant('reload_grid'));
$scope.showGrid(data.attributes.id_grid, 'menu');
// Reload data
if(data.attributes.all_pictos == true){
// Reload all
$scope.showGrid(data.attributes.id_grid, 'menu');
}else{
// Reload only modified picto
$scope.mainGrid[data.attributes.stu_picto.attributes.coord_x][data.attributes.stu_picto.attributes.coord_y] = data.attributes.stu_picto;
}
}
$scope.$apply();
});
......
......@@ -89,12 +89,17 @@ dashboardControllers.controller('PictoConfigCtrl', function (
.then(function(result) {
return new Promise(function (resolve, reject) {
// If update_all_legend then set attribute true
var all_pictos = false;
if($scope.update_all_legend) all_pictos = true;
io.socket.post('/stu/vocabulary', {
action: 'update',
attributes: {
id_stu: stu.id,
id_grid: viewingGrid.id,
stu_picto: result
stu_picto: result,
all_pictos: all_pictos
}
},
function(res) {});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment