Commit 6909ecb0 by Fernando Martínez Santiago Committed by root

working on issue #630

parent 04d6fe92
...@@ -14,7 +14,6 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta ...@@ -14,7 +14,6 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
// Picto // Picto
$scope.studentPicto = studentPicto; $scope.studentPicto = studentPicto;
// Input expression // Input expression
$scope.expression = (studentPicto.expression != undefined) ? studentPicto.expression.text : '';
if ($scope.studentPicto.attributes.expression==undefined || $scope.studentPicto.attributes.expression==null) if ($scope.studentPicto.attributes.expression==undefined || $scope.studentPicto.attributes.expression==null)
$scope.studentPicto.attributes.expression=studentPicto.expression.text; $scope.studentPicto.attributes.expression=studentPicto.expression.text;
// Enable or Disable the button 'change' if the supervisor is the owner of the picto // Enable or Disable the button 'change' if the supervisor is the owner of the picto
...@@ -29,22 +28,27 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta ...@@ -29,22 +28,27 @@ dashboardControllers.controller('PictoConfigCtrl', function ($scope, $modalInsta
.post(config.backend+'/picto/exp', .post(config.backend+'/picto/exp',
{ 'picto': studentPicto.picto.id, { 'picto': studentPicto.picto.id,
'lang': $scope.sup.lang, 'lang': $scope.sup.lang,
'text': $scope.expression 'text': $scope.studentPicto.expression.text
}) })
.success(function(data, status, headers, config) { .success(function(data, status, headers, config) {
console.log("Expression changed: " + JSON.stringify(data)); console.log("Expression changed: " + JSON.stringify(data)+": "+$scope.studentPicto.expression.text);
$scope.studentPicto.attributes.expression=$scope.studentPicto.expression.text;
// Close the modal instance // Close the modal instance
$modalInstance.close($scope.expression); $modalInstance.close($scope.studentPicto.expression.text);
// Notifcar cambio // Notifcar cambio
io.socket.post('/stu/vocabulary', { io.socket.post('/stu/vocabulary', {
action: 'update', action: 'update',
attributes: { attributes: {
id_stu: $scope.stu.id, id_stu: $scope.stu.id,
stu_picto: studentPicto.id stu_picto: {
id: data.id,
expression: data.expression,
attributes: $scope.studentPicto.attributes,
picto: { id: data.picto }
}
} }
}, function () {}); }, function (res) {console.log("Owned vocabulary emited: " + JSON.stringify(res.msg));});
}) })
.error(function(data, status, headers, config) { .error(function(data, status, headers, config) {
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
<form ng-submit="isOwner ? change() : update_properties()"> <form ng-submit="isOwner ? change() : update_properties()">
<div id="add_label" class="input-group"> <div id="add_label" class="input-group">
<span class="input-group-addon glyphicon glyphicon-comment" aria-hidden="true"></span> <span class="input-group-addon glyphicon glyphicon-comment" aria-hidden="true"></span>
<input type="text" class="form-control" ng-if="isOwner" ng-model="expression" /> <input type="text" class="form-control" ng-if="isOwner" ng-model="studentPicto.expression.text" />
<input type="text" class="form-control" ng-if="!isOwner" ng-model="studentPicto.attributes.expression" /> <input type="text" class="form-control" ng-if="!isOwner" ng-model="studentPicto.attributes.expression" />
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-success" type="submit" translate>save</button> <button class="btn btn-success" type="submit" ng-click="close()" translate>save</button>
</span> </span>
</div> </div>
</form> </form>
......
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