Issue #627 done

parent ffcf82eb
...@@ -86,8 +86,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -86,8 +86,6 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
grid[i] = []; grid[i] = [];
for (j = 0; j < gridWidth; j++) { for (j = 0; j < gridWidth; j++) {
grid[i][j] = $scope.emptyStudentPicto; grid[i][j] = $scope.emptyStudentPicto;
grid[i][j].attributes.coord_x = j;
grid[i][j].attributes.coord_y = i;
} }
} }
return grid; return grid;
...@@ -305,7 +303,8 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -305,7 +303,8 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}; };
// Modal window to add pictos // Modal window to add pictos
$scope.open_add = function (selectedPictoCell) { $scope.open_add = function (col, row) {
console.log(col + " " +row);
var modalInstance = $modal.open({ var modalInstance = $modal.open({
animation: true, animation: true,
templateUrl: 'modules/student/views/addpicto.html', templateUrl: 'modules/student/views/addpicto.html',
...@@ -322,27 +321,25 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec ...@@ -322,27 +321,25 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
}); });
// Returned data from the modal window // Returned data from the modal window
modalInstance.result.then(function (pictoId) { modalInstance.result.then(function (pictoId) {
// Send the picto to the server // Send the picto to the server
$http.post(config.backend + '/stu/' + student.id + '/picto/' + pictoId, { $http.post(config.backend + '/stu/' + $scope.studentData.id + '/picto/' + pictoId, {
attributes: { attributes: {
id_cat: $scope.selectedCategory.id, coord_x: $scope.showFreeCategory ? null : col,
coord_x: selectedPictoCell.attributes.coord_x, coord_y: $scope.showFreeCategory ? null : row,
coord_y: selectedPictoCell.attributes.coord_y, status: 'enabled',
free_category_coord_x: selectedPictoCell.attributes.free_category_coord_x, free_category_coord_x: $scope.showFreeCategory ? col : null,
free_category_coord_y: selectedPictoCell.attributes.free_category_coord_y free_category_coord_y: $scope.showFreeCategory ? row : null
} }
}) })
.success(function (studentPicto) { .success(function (studentPicto) {
$translate('picto_added').then(function (translation) { console.log(studentPicto.attributes);
ngToast.success({ content: translation });
});
placePicto(studentPicto); placePicto(studentPicto);
io.socket.post('/stu/vocabulary', { io.socket.post('/stu/vocabulary', {
action: 'add', action: 'add',
attributes: { attributes: {
id_stu: student.id, id_stu: $scope.studentData.id,
stu_picto: studentPicto stu_picto: studentPicto
} }
}, function () {}); }, function () {});
......
...@@ -46,18 +46,22 @@ ...@@ -46,18 +46,22 @@
class="picto_peq pull-left" class="picto_peq pull-left"
ng-repeat="p in pictos | filter:srch_term_picto"> ng-repeat="p in pictos | filter:srch_term_picto">
<img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter" /> <img ng-src="{{p.uri}}" popover="{{p.expressions[0].text}}" popover-trigger="mouseenter" />
<a
ng-click="close(p.id)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_white glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
<!-- Options to remove picto (Only for own pictos) --> <!-- Options to remove picto (Only for own pictos) -->
<div class="picto_options" ng-show="source == 'ownpictos'"> <div class="picto_options" ng-show="source == 'ownpictos'">
<a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate}}"> <a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate}}">
<span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span> <span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span>
</a> </a>
</div> </div>
<div class="picto_options">
<a ng-click="remove_own_picto(p.id)" class="picto_remove" title="{{ 'delete' | translate}}">
<a
ng-click="close(p.id)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</a>
</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
......
...@@ -22,18 +22,20 @@ ...@@ -22,18 +22,20 @@
class="picto-grid picto-free-grid"> class="picto-grid picto-free-grid">
<div <div
ng-repeat="studentPictoRow in freeCategoryPictos" ng-repeat="studentPictoRow in freeCategoryPictos"
ng-init="rowIndex = $index"
class="picto-grid__row"> class="picto-grid__row">
<div <div
class="picto pull-left" class="picto pull-left"
data-row="{{ $parent.$index }}" data-row="{{ rowIndex }}"
data-column="{{ $index }}" data-column="{{ colIndex }}"
id="student-picto-{{ id="student-picto-{{
studentPicto.id || studentPicto.id ||
('empty-' + $index + '-' + $parent.$index) ('empty-' + colIndex + '-' + rowIndex)
}}" }}"
draggable droppable drop="handleDrop" draggable droppable drop="handleDrop"
popover="{{studentPicto.expression.text}}" popover="{{studentPicto.expression.text}}"
popover-trigger="mouseenter" popover-trigger="mouseenter"
ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index"> ng-repeat="studentPicto in studentPictoRow track by $index">
<img <img
src="/app/img/redcross.png" src="/app/img/redcross.png"
...@@ -47,9 +49,19 @@ ...@@ -47,9 +49,19 @@
'deactivate': studentPicto.attributes.status == 'disabled' 'deactivate': studentPicto.attributes.status == 'disabled'
}" }"
ng-style="{ ng-style="{
'background-color': studentPicto.attributes.color 'background-color': studentPicto.attributes.color || '#ffffff'
}"/> }"/>
<div <div
class="picto_options"
ng-if="studentPicto == emptyStudentPicto">
<a
ng-click="open_add(rowIndex, colIndex)"
class="picto_add"
title="{{ 'add_picto' | translate}}">
<i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a>
</div>
<div
class="picto_options" class="picto_options"
ng-if="studentPicto !== emptyStudentPicto"> ng-if="studentPicto !== emptyStudentPicto">
<a <a
...@@ -140,18 +152,20 @@ ...@@ -140,18 +152,20 @@
<h3 class="picto-category-grid__title">{{ selectedCategory.expression.text }}</h3> <h3 class="picto-category-grid__title">{{ selectedCategory.expression.text }}</h3>
<div <div
ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]" ng-repeat="studentPictoRow in studentPictos[getCategoryId(selectedCategory)]"
ng-init="rowIndex = $index"
class="picto-grid__row"> class="picto-grid__row">
<div <div
class="picto pull-left" class="picto pull-left"
data-row="{{ $parent.$index }}" data-row="{{ rowIndex }}"
data-column="{{ $index }}" data-column="{{ colIndex }}"
id="student-picto-{{ id="student-picto-{{
studentPicto.id || studentPicto.id ||
('empty-' + $index + '-' + $parent.$index) ('empty-' + colIndex + '-' + rowIndex)
}}" }}"
draggable droppable drop="handleDrop" draggable droppable drop="handleDrop"
popover="{{studentPicto.expression.text}}" popover="{{studentPicto.expression.text}}"
popover-trigger="mouseenter" popover-trigger="mouseenter"
ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index"> ng-repeat="studentPicto in studentPictoRow track by $index">
<img <img
src="/app/img/redcross.png" src="/app/img/redcross.png"
...@@ -165,17 +179,17 @@ ...@@ -165,17 +179,17 @@
'deactivate': studentPicto.attributes.status == 'disabled' 'deactivate': studentPicto.attributes.status == 'disabled'
}" }"
ng-style="{ ng-style="{
'background-color': studentPicto.attributes.color 'background-color': studentPicto.attributes.color || '#ffffff'
}" }"
/> />
<div <div
class="picto_options" class="picto_options"
ng-if="studentPicto == emptyStudentPicto"> ng-if="studentPicto == emptyStudentPicto">
<a <a
ng-click="open_add(studentPicto)" ng-click="open_add(rowIndex, colIndex)"
class="picto_add" class="picto_add"
title="{{ 'add_picto' | translate}}"> title="{{ 'add_picto' | translate}}">
<i class="color_white glyphicon glyphicon-plus-sign" aria-hidden="true"></i> <i class="color_green glyphicon glyphicon-plus-sign" aria-hidden="true"></i>
</a> </a>
</div> </div>
<div <div
......
...@@ -433,7 +433,10 @@ textarea.editable{ ...@@ -433,7 +433,10 @@ textarea.editable{
display: block; display: block;
} }
/* Picto options in own picto (supervisor) collection */ /* Picto options in own picto (supervisor) collection */
#collections .picto_peq .picto_options .picto_remove{ position: absolute; top: 18px; left: 20px; } /* #collections .picto_peq .picto_options .picto_remove{ position: absolute; top: 18px; left: 20px; } */
#collections .picto_peq .picto_options .picto_remove{ position: absolute; top: 2px; left: 2px; }
#collections .picto_peq .picto_options .picto_add{ position: absolute; top: 2px; right: 2px; }
/* Picto options when adding a picto to a category */ /* Picto options when adding a picto to a category */
.picto_cat .picto_peq .picto_options .picto_remove{ position: absolute; top: 4px; left: 7px; } .picto_cat .picto_peq .picto_options .picto_remove{ position: absolute; top: 4px; left: 7px; }
/* Picto options in student collection */ /* Picto options in student collection */
......
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