issue #501 fixed

parent b9d580e1
......@@ -12,6 +12,7 @@
* Check out the `tasks` directory instead.
*/
module.exports = function (grunt) {
var includeAll;
var taskConfigurations;
var registerDefinitions;
......
......@@ -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",
......
......@@ -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",
......
......@@ -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 () {});
});
......
......@@ -16,7 +16,8 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$location,
$filter,
$anchorScroll,
$modal) {
$modal,
$translate) {
$scope.emptyStudentPicto = {
id: null,
picto: {
......@@ -134,8 +135,8 @@ 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) {
$translate('confirmation').then(t => {
if ($window.confirm(t)) {
$http.delete(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + studentPicto.id)
.success(function () {
$scope.studentPictos
......@@ -147,16 +148,22 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'delete',
attributes: {
id_stu: $scope.studentData.id,
stu_picto: studentPicto
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) {
$translate('confirmation').then(t => {
if ($window.confirm(t)) {
$http.delete(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + studentPicto.id)
.success(function () {
$scope.freeCategoryPictos
......@@ -167,11 +174,17 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
action: 'delete',
attributes: {
id_stu: $scope.studentData.id,
stu_picto: studentPicto
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;
}
}
});
......
......@@ -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);
......
......@@ -27,8 +27,6 @@ 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);
......
......@@ -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) {
......
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