session controls ready

parent f77656fb
......@@ -128,8 +128,8 @@ module.exports = {
});
});
})
.fail(function(err) {
res.serverError("Session not created: " + err);
.catch(function(err) {
return res.serverError("Session not created: " + err);
});
},
......
......@@ -243,6 +243,7 @@
"password_new_type": "Type the new password",
"password_short": "Password must have {{minlength}} characters length at least",
"password_type": "Password",
"pause": "Pause",
"pause_session": "Pause session",
"personal_data": "Personal data",
"personal_data": "Personal data",
......@@ -268,12 +269,14 @@
"previous_actions": "Previous actions",
"previous_sessions": "Previous sessions",
"profile_picture": "Profile picture",
"record": "Record",
"read_picto": "Read picto",
"register": "Sign in",
"reloading_pictos": "Reloading pictograms",
"remember": "Remember me",
"reports": "Reports",
"request_change_password": "Request change password",
"resume": "Resume",
"room_changed": "A partner is offline. Session paused.",
"save": "Save",
"save_as_template": "Save as template",
......@@ -317,6 +320,7 @@
"state_not_evaluated": "Not evaluated",
"state_spontaneous": "Spontaneous",
"state_supervised": "Supervised",
"stop": "Stop",
"student_added": "Student added",
"student_already_exists": "A student with that username already exists, please try with another one",
"student_deleted": "Student deleted",
......
......@@ -243,6 +243,7 @@
"password_new_type": "Escriba la nueva contraseña",
"password_type": "Escriba la contraseña",
"password_short": "La contraseña es muy corta, debe tener al menos una longitud de {{minlength}} caracteres",
"pause": "Pausar",
"pause_session": "Pausar sesión",
"personal_data": "Datos personales",
"personal_data": "Datos personales",
......@@ -269,12 +270,14 @@
"previous_sessions": "Sesiones anteriores",
"profile_picture": "Foto del perfil",
"read_picto": "Leer picto",
"record": "Grabar",
"register": "Regístrate",
"register_button": "Registrar",
"reloading_pictos": "Recargando pictogramas",
"remember": "No cerrar sesión",
"reports": "Informes",
"request_change_password": "Solicitar cambio de contraseña",
"resume": "Continuar",
"room_changed":"Un participante abandonó la sesión. Sesión en pausa.",
"save": "Guardar",
"save_as_template": "Guardar como plantilla",
......@@ -318,6 +321,7 @@
"state_not_evaluated": "No evaluado",
"state_spontaneous": "Espontáneo",
"state_supervised": "Guiado",
"stop": "Parar",
"student_added": "Estudiante añadido",
"student_already_exists": "Ya existe un estudiante con ese nombre de usuario. Por favor, inténtelo de nuevo con algo diferente.",
"student_deleted": "Estudiante eliminado",
......
......@@ -43,7 +43,7 @@
</div>
<div class="col-md-8">
<div class="form-group">
<select class="form-control" ng-model="formdata.country" required>
<select class="form-control" ng-model="formdata.country" required ng-change="load_tries()">
<option value="00" selected disabled hidden>{{ 'country' | translate }}</option>
<option value="ES">España</option>
<option value="US">United States</option>
......
......@@ -25,15 +25,12 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.ws = $scope.ws || {};
$scope.actual_try = $scope.actual_try || {};
// pause flag
$scope.paused = false;
// Read the last working session to show the last tries when session tab is opened
$scope.wsessions = [];
//
// Array with student methods (with instructions)
//
$scope.methods = [];
// Visibility of the list of stored sessions
......@@ -43,12 +40,9 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.get(config.backend+'/stu/'+ $scope.studentData.id +'/methods')
.success(function(data, status, headers, config) {
// Add to list
$scope.methods = data;
})
.error(function(data, status, headers, config) {
});
// Query to obtain an array of only one working session (the last) with its tries/actions
......@@ -67,18 +61,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Initially, show the last try
$scope.showLastTry = true;
// VER SI BORRAR --> SÓLO NECESARIO PARA DEJAR EN BLANCO LOS ENSAYOS CARGADOS
// Cargar instrucciones en select del método seleccionado arriba
$scope.load_instructions = function (method){
// Empty ws/tries/actions
$scope.wsessions=[];
// Update the number of pages
$scope.totalPages = 0;
// Empty selected instruction in select field
//$scope.selectedIns = {};
};
$scope.selectedIns = -1;
////////////////////////////////////////////////////////////////////////////
// Tries ///////////////////////////////////////////////////////////////////
......@@ -86,13 +70,16 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// When clicking over an instruction in the select control
// load its working sessions with its associated tries and with its actions
$scope.load_tries = function (instruction){
$scope.load_tries = function (){
if ($scope.selectedIns == -1)
return;
$scope.showLastTry = false;
// If to avoid the default select option "-- select one instruction --"
if(instruction){
$http
.get(config.backend+'/instruction/'+ instruction.id +'/ws')
.get(config.backend+'/instruction/'+ $scope.selectedIns +'/ws')
.success(function(data, status, headers, config) {
// Add to list
$scope.wsessions = data;
......@@ -102,7 +89,6 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.totalPages = Math.ceil($scope.wsessions.length / $scope.numPerPage);
})
.error(function(data, status, headers, config) {});
}
};
// Tries pagination - previous tries
......@@ -184,6 +170,12 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Create new working session
//
$scope.new_ws = function (){
if ($scope.sessionRunning)
return;
$scope.startTimer();
// Var for view
$scope.sessionRunning = true;
......@@ -236,6 +228,12 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Finish a working session updating its end time
//
$scope.stop_ws = function () {
if (!$scope.sessionRunning)
return;
$scope.stopTimer();
// For view
$scope.sessionRunning = false;
if ($scope.wsessions.length>0)
......@@ -268,6 +266,12 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Pause the actual working session
//
$scope.pause_ws = function (){
if (!$scope.sessionRunning || $scope.paused)
return;
$scope.pauseTimer();
$http
.post(config.backend+'/action', {
"type": "pausesession",
......@@ -290,6 +294,12 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Resume the actual working session
//
$scope.resume_ws = function (){
if (!$scope.sessionRunning || !$scope.paused)
return;
$scope.resumeTimer();
$http
.post(config.backend+'/action', {
"type": "resumesession",
......
......@@ -8,38 +8,64 @@
<div class="row">
<div class="col-md-6">
<form role="form" action="#" ng-hide="ws_recover ">
<select class="form-control" name="met_select" id="met_select" ng-model="selectedMethod" ng-options="m.name for m in methods" ng-change="load_instructions(selectedMethod)">
<option value="" translate>select_a_method</option>
</select>
<select ng-hide="!selectedMethod" class="form-control" name="instruction_select" id="instruction_select" ng-model="selectedIns" ng-options="ins.name for ins in selectedMethod.instructions" ng-change="load_tries(selectedIns)">
<option value="" translate>select_instruction</option>
<select class="form-control" name="met_select" id="met_select" ng-model="selectedIns" ng-change="load_tries()">
<option value="-1" selected disabled hidden>{{ 'select_instruction' | translate }}</option>
<optgroup ng-repeat="m in methods" label="{{ m.name }}">
<option ng-repeat="ins in m.instructions" ng-value="ins.id">{{ins.name}}</option>
</optgroup>
</select>
</form>
</div>
<div class="col-md-6">
<div class="row session-controls form-horizontal" ng-show="selectedIns != -1">
<div class="col-md-4 form-group">
<label class="control-label" translate> sessions </label>
<button ng-click="showSessions = !showSessions" class="btn btn-default" ng-disabled="wsessions.length == 0">
<span class="badge" style="font-size: 10pt"> {{ wsessions.length }}</span>
<span class="glyphicon glyphicon-collapse-down" aria-hidden="true" ng-show="!showSessions"></span>
<span class="glyphicon glyphicon-collapse-up" aria-hidden="true" ng-show="showSessions"></span>
</button>
</div>
<div class="row" ng-hide="!selectedIns">
<p class="session_controls">
<div class="col-md-4">
<a ng-click="startTimer(); new_ws()" ng-disabled="!selectedIns " ng-hide="sessionRunning || studentData.num_peers<2" class="btn btn-success btn-sm" role="button" id="session_new" translate>new_session</a>
<a class="text_large" ng-click="pause_ws(); pauseTimer();" ng-hide="!sessionRunning || paused" id="session_pause" popover="{{ 'pause_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-pause" aria-hidden="true" title="{{ 'pause_session' | translate }}"></span>
</a>
<a class="text_large" ng-click="resume_ws(); resumeTimer();" ng-hide="!sessionRunning || !paused" id="session_continue" popover="{{ 'continue_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-play" aria-hidden="true" title="{{ 'continue_session' | translate }}"></span>
</a>
<a class="text_large" ng-click="stopTimer(); stop_ws()" ng-hide="!sessionRunning" id="session_stop" popover="{{ 'finish_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-stop color_black" aria-hidden="true" title="{{ 'finish_session' | translate }}"></span>
</a>
</div>
<div class="col-md-2" style="text-align: right">
<button ng-click="showSessions = !showSessions" class="btn btn-success btn-sm" style="font-size: 10pt">
<i class="fa fa-caret-down" aria-hidden="true" ng-show="!showSessions"></i>
<i class="fa fa-caret-up" aria-hidden="true" ng-show="showSessions"></i>
<span translate> sessions </span>
<span class="badge" style="font-size: 10pt"> {{wsessions.length }}</span>
<div class="col-md-8 form-group" ng-disabled="selectedIns == -1 || studentData.num_peers<2">
<div class="btn-group pull-right"> <!-- controls for session recording-->
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: sessionRunning }"
popover="{{ 'new_session' | translate }}"
popover-trigger="mouseenter"
ng-click="new_ws()"
id="session_new">
<span class="glyphicon glyphicon-record color_red"
ng-class="{ blink: sessionRunning }"></span> {{ 'record' | translate }}
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: !sessionRunning || !paused }"
popover="{{ 'continue_session' | translate }}"
popover-trigger="mouseenter"
ng-click="resume_ws();">
<span class="glyphicon glyphicon-play"></span> {{ 'resume' | translate }}
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: !sessionRunning || paused }"
popover="{{ 'pause_session' | translate }}"
popover-trigger="mouseenter"
ng-click="pause_ws();">
<span class="glyphicon glyphicon-pause"></span> {{ 'pause' | translate }}
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: !sessionRunning }"
popover="{{ 'finish_session' | translate }}"
popover-trigger="mouseenter"
ng-click="stop_ws();">
<span class="glyphicon glyphicon-stop"></span> {{ 'stop' | translate }}
</button>
</div> <!-- / controls for session recording-->
</div>
</div>
</div>
</p>
</div>
<div id="tries">
<div id="actual_try" ng-model="actual_try" ng-show="tryRunning">
......
......@@ -972,6 +972,17 @@ input[type=range]:focus::-ms-fill-upper {
}
/*
Blink class
*/
.blink {
animation: blinker 1s linear infinite;
}
@keyframes blinker {
50% { opacity: 0.0; }
}
/*
ng-file-upload and ngImgCrop
*/
.cropArea {
......
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