Issue #627 done

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