issue #463 fixed

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