issue #463 fixed

parent 9123e619
......@@ -31,6 +31,10 @@ sails/src/config/ssl/**/*.csr
sails/src/config/local.js
sails/src/node_modules
sails/.vagrant
sails/logs/
sails/npm-debug.log
sails/playbook.retry
sails/upload.zip
# Android #
###########
......
......@@ -31,7 +31,7 @@ android {
resValue "integer", "netservice_timing", "20"
}
debug {
resValue "string", "server", "https://dev.yottacode.com"
//resValue "string", "server", "https://dev.yottacode.com"
resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "false"
resValue "bool", "force_img_download", "false"
......
......@@ -133,6 +133,7 @@ module.exports = {
Student.create(params)
.exec(function (err, created) {
if (err) {
console.log(err);
sails.log.debug(err);
return res.json(500, err);
}
......
......@@ -374,10 +374,9 @@ module.exports = {
student.supervision = req.token.office ? 2 : 1;
return student;
});
if (req.token.isSupAdmin && req.token.office && req.token.office.id) {
Student.find({ office: req.token.office.id }).then(function (officeStudents) {
students.concat(officeStudents);
students = students.concat(officeStudents);
students = students.map((student) => {
student.supervision = student.supervision || 0;
return student;
......
......@@ -169,6 +169,8 @@ module.exports = {
tape_background: '#00ffff'
};
sails.log.verbose('Requested attributes for Student', attributes);
if (typeof attributes === 'object') {
Object.keys(defaultAttributes).forEach((attribute) => {
if (defaultAttributes.hasOwnProperty(attribute) && attributes.hasOwnProperty(attribute)) {
......
......@@ -83,6 +83,7 @@
"error_deleting_picto": "Error deleting picto",
"error_downloading_supervisors": "Error downloading supervisors",
"error_downloading_offices": "Error downloading offices",
"error_fetching_students": "Error when loading students",
"error_only_support_images": "Only images are supported (JPG, PNG or GIF files)",
"error_loading_pictos": "Error loading pictos information",
"expand_navigation": "Expand navigation",
......
......@@ -86,6 +86,7 @@
"error_deleting_picto": "Error borrando el picto",
"error_downloading_supervisors": "Error al descargar los supervisores",
"error_downloading_offices": "Error al descargar las oficinas",
"error_fetching_students": "Error al cargar estudiantes",
"error_only_support_images": "Sólo se soportan imágenes (ficheros JPG, PNG o GIF)",
"error_loading_pictos": "Error cargando información de los pictos",
"February": "Febrero",
......
......@@ -78,6 +78,7 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
*/
$scope.updateStudent = function () {
var password;
var attrs;
if ($scope.formUser.password_confirm || $scope.formUser.password) {
if ($scope.formUser.password_confirm === $scope.formUser.password) {
......@@ -90,7 +91,8 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
}
}
$http.put(config.backend + '/stu/' + $scope.studentData.id, {
attrs = {
birthdate: $scope.formUser.birthdate,
country: $scope.formUser.country,
gender: $scope.formUser.gender,
......@@ -99,8 +101,12 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
notes: $scope.formUser.notes,
surname: $scope.formUser.surname,
username: $scope.formUser.username,
password: password
})
};
if (password)
attrs.password = password;
$http.put(config.backend + '/stu/' + $scope.studentData.id, attrs)
.success(function (data) {
$translate('student_updated').then(function (translation) {
ngToast.success({ content: translation });
......
......@@ -49,7 +49,12 @@
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" id="student_country" placeholder="{{ 'country' | translate }}" ng-model="formUser.country" />
<select class="form-control" name="student_country" id="student_country" ng-model="formUser.country" required>
<option value="ES">España</option>
<option value="US">United States</option>
<option value="UK">United Kingdom</option>
<option value="IE">Ireland</option>
</select>
</div>
</fieldset>
......
......@@ -53,7 +53,9 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl(
$scope.students = data;
})
.error(function () {
// TODO show error with ngToast
$translate('error_fetching_students').then(function (translation) {
ngToast.danger({ content: translation });
});
});
// Reset form Student
......@@ -70,7 +72,6 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl(
gender: 'F',
lang: 'es-es',
notes: '',
pic: '/app/img/default.jpg',
office: $scope.user.office || { name: '' },
current_method: 'no_method',
current_instruction: 'no_instruction'
......
<h3 class="color_green" translate>add_student</h3>
<form name="AddStudentForm" role="form" ng-submit="add_student()" ng-controller="StudentAddCtrl">
<div class="row">
<div class="col-sm-6">
......@@ -45,7 +45,13 @@
</div>
<div class="form-group">
<input type="text" class="form-control" id="student_country" placeholder="{{ 'country' | translate }}" ng-model="formdatastudent.country" />
<legend translate>country</legend>
<select class="form-control" name="student_country" id="student_country" ng-model="formdatastudent.country" required>
<option value="ES" selected>España</option>
<option value="US">United States</option>
<option value="UK">United Kingdom</option>
<option value="IE">Ireland</option>
</select>
</div>
</fieldset>
</div>
......@@ -77,4 +83,4 @@
</div>
</form>
<hr />
\ No newline at end of file
<hr />
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