Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
56628339
authored
Aug 28, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on issue #527
parent
155a26ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/student/controllers/instructions.js
sails/src/assets/app/i18n/en-gb.json
View file @
56628339
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
"birthdate"
:
"Birthdate"
,
"birthdate"
:
"Birthdate"
,
"cancel"
:
"Cancel"
,
"cancel"
:
"Cancel"
,
"cannot_delete_method"
:
"Method could not be deleted, maybe due to existing recorded sessions."
,
"cannot_delete_method"
:
"Method could not be deleted, maybe due to existing recorded sessions."
,
"cannot_delete_instruction"
:
"Instruction could not be deleted, maybe due to existing recorded sessions."
,
"categories"
:
"Categories"
,
"categories"
:
"Categories"
,
"category_pictograms"
:
"Category's pictograms"
,
"category_pictograms"
:
"Category's pictograms"
,
"change_password"
:
"Change password"
,
"change_password"
:
"Change password"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
56628339
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
"birthdate"
:
"Fecha de nacimiento"
,
"birthdate"
:
"Fecha de nacimiento"
,
"cancel"
:
"Cancelar"
,
"cancel"
:
"Cancelar"
,
"cannot_delete_method"
:
"No se pudo eliminar el método, tal vez porque existen sesiones asociadas."
,
"cannot_delete_method"
:
"No se pudo eliminar el método, tal vez porque existen sesiones asociadas."
,
"cannot_delete_instruction"
:
"No se pudo eliminar la instrucción, tal vez porque existen sesiones asociadas."
,
"categories"
:
"Categorías"
,
"categories"
:
"Categorías"
,
"category_pictograms"
:
"Pictogramas de la categoría"
,
"category_pictograms"
:
"Pictogramas de la categoría"
,
"change_password"
:
"Cambiar contraseña"
,
"change_password"
:
"Cambiar contraseña"
,
...
...
sails/src/assets/scripts/modules/student/controllers/instructions.js
View file @
56628339
...
@@ -34,12 +34,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -34,12 +34,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
});
});
//
//
// Array with student methods (with instructions)
// Array with student methods (with instructions)
//
//
$scope
.
methods
=
[];
$scope
.
methods
=
[];
// Query to obtain an array of student methods
// Query to obtain an array of student methods
$http
$http
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/methods'
)
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/methods'
)
...
@@ -53,7 +53,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -53,7 +53,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
});
});
//
//
// Get last method/instruction for this student
// Get last method/instruction for this student
//
//
/* $http
/* $http
...
@@ -75,7 +75,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -75,7 +75,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
if
(
$scope
.
method_selected
.
id
==
0
){
if
(
$scope
.
method_selected
.
id
==
0
){
$http
$http
.
post
(
config
.
backend
+
'/method/new'
,
{
.
post
(
config
.
backend
+
'/method/new'
,
{
'id_stu'
:
$scope
.
studentData
.
id
,
'id_stu'
:
$scope
.
studentData
.
id
,
'name'
:
"Nuevo método (cambiar nombre)"
'name'
:
"Nuevo método (cambiar nombre)"
})
})
...
@@ -92,8 +92,8 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -92,8 +92,8 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
}
else
{
}
else
{
// Add method from templates
// Add method from templates
$http
$http
.
post
(
config
.
backend
+
'/method'
,
{
.
post
(
config
.
backend
+
'/method'
,
{
'id_mmethod'
:
$scope
.
method_selected
.
id
,
'id_mmethod'
:
$scope
.
method_selected
.
id
,
'id_stu'
:
$scope
.
studentData
.
id
'id_stu'
:
$scope
.
studentData
.
id
})
})
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
...
@@ -120,7 +120,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -120,7 +120,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
.
delete
(
config
.
backend
+
'/method/template/'
+
$scope
.
method_selected
.
id
)
.
delete
(
config
.
backend
+
'/method/template/'
+
$scope
.
method_selected
.
id
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
'Delete Method Template and its Instructions'
);
console
.
log
(
'Delete Method Template and its Instructions'
);
var
myToastMsg
=
ngToast
.
success
({
var
myToastMsg
=
ngToast
.
success
({
content
:
'Eliminado método de plantillas'
,
content
:
'Eliminado método de plantillas'
,
timeout
:
6000
// By default 4000
timeout
:
6000
// By default 4000
...
@@ -141,12 +141,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -141,12 +141,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
}
}
};
};
// Update method
// Update method
$scope
.
update_method
=
function
(
method
){
$scope
.
update_method
=
function
(
method
){
// Remove instructions as we only update title or description
// Remove instructions as we only update title or description
var
method_to_save
=
{};
var
method_to_save
=
{};
Object
.
assign
(
method_to_save
,
method
);
Object
.
assign
(
method_to_save
,
method
);
delete
method_to_save
.
instructions
;
delete
method_to_save
.
instructions
;
$http
$http
...
@@ -158,8 +158,8 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -158,8 +158,8 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
console
.
log
(
"Error from API: "
+
JSON
.
stringify
(
data
));
console
.
log
(
"Error from API: "
+
JSON
.
stringify
(
data
));
});
});
};
};
// Save method and its instructions as template in metamethods and metainstructions
// Save method and its instructions as template in metamethods and metainstructions
$scope
.
save_as_template
=
function
(
method
){
$scope
.
save_as_template
=
function
(
method
){
$http
$http
...
@@ -167,10 +167,10 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -167,10 +167,10 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
.
then
(
//success
.
then
(
//success
function
(
data
,
status
,
headers
,
config
)
{
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
'Saved method as template:'
+
JSON
.
stringify
(
data
));
console
.
log
(
'Saved method as template:'
+
JSON
.
stringify
(
data
));
// Add to select method
// Add to select method
$scope
.
methods_available
.
push
({
id
:
method
.
id
,
name
:
method
.
name
});
$scope
.
methods_available
.
push
({
id
:
method
.
id
,
name
:
method
.
name
});
// creating a toast using "success", "info", "warning" or "danger" shortcut methods:
// creating a toast using "success", "info", "warning" or "danger" shortcut methods:
var
myToastMsg
=
$translate
(
'method_save'
).
then
(
function
(
translation
)
{
var
myToastMsg
=
$translate
(
'method_save'
).
then
(
function
(
translation
)
{
// Show message
// Show message
...
@@ -179,7 +179,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -179,7 +179,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
timeout
:
6000
// By default 4000
timeout
:
6000
// By default 4000
});
});
});
});
}
}
,
function
(
data
,
status
,
headers
,
config
)
{
//error
,
function
(
data
,
status
,
headers
,
config
)
{
//error
console
.
log
(
"Error from API: "
+
data
.
error
+
"("
+
data
.
status
+
")"
);
console
.
log
(
"Error from API: "
+
data
.
error
+
"("
+
data
.
status
+
")"
);
...
@@ -212,7 +212,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -212,7 +212,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
break
;
break
;
}
}
}
}
})
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
...
@@ -276,21 +276,28 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -276,21 +276,28 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Buscar method
// Buscar method
for
(
var
i
=
0
;
i
<
$scope
.
methods
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
$scope
.
methods
.
length
;
i
++
)
{
var
m
=
$scope
.
methods
[
i
];
var
m
=
$scope
.
methods
[
i
];
if
(
ins
.
method
==
m
.
id
){
if
(
ins
.
method
==
m
.
id
){
// Buscar la instrucción y eliminar de la vista
// Buscar la instrucción y eliminar de la vista
for
(
var
j
=
0
;
j
<
m
.
instructions
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
m
.
instructions
.
length
;
j
++
)
{
if
(
ins
.
id
==
m
.
instructions
[
j
].
id
){
if
(
ins
.
id
==
m
.
instructions
[
j
].
id
){
$scope
.
methods
[
i
].
instructions
.
splice
(
j
,
1
);
$scope
.
methods
[
i
].
instructions
.
splice
(
j
,
1
);
break
;
break
;
}
}
}
}
break
;
break
;
}
}
}
}
})
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
var
myToastMsg
=
$translate
(
'cannot_delete_instruction'
).
then
(
function
(
translation
)
{
// Show message
ngToast
.
warning
({
content
:
translation
,
timeout
:
6000
// By default 4000
});
});
});
});
};
};
...
@@ -319,4 +326,4 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -319,4 +326,4 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
};
};
// End Modal window to view instruction details
// End Modal window to view instruction details
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment