Commit 90cd98a1 by Fernando Martínez Santiago

Merge branch 'develop' of http://gitlab.ujaen.es/yotta/pictogram into develop

parents 7606be25 fe81c275
# Changes
Nothing to do
Angular Animate module has to be downgraded in order to be compatible with
the version of AngularJS used. In order to do show, type `bower install` from
*assets/app* directory.
## Database
Nothing to do
Create new tables
Destroy *office* table: `drop table office`
......@@ -25,7 +25,15 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.ws = $scope.ws || {};
$scope.actual_try = $scope.actual_try || {};
$scope.paused = false;
$scope.flags = {
paused: false,
showSessions: false,
showLastTry: true,
showTries: false,
tryRunning: false,
section: 'new'
};
// Array with working sessions for selected instruction
$scope.wsessions = [];
......@@ -33,16 +41,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Array with student methods (with instructions)
$scope.methods = [];
// Visibility of the list of stored sessions
$scope.showSessions = false;
// Initially, show the last try
$scope.showLastTry = true;
$scope.selected = { item: -1 };
$scope.section = 'new';
// Query to obtain an array of student methods
$http
.get(config.backend+'/stu/'+ $scope.studentData.id +'/methods')
......@@ -79,7 +79,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
if ($scope.selected.item == -1)
return;
$scope.showLastTry = false;
$scope.flags.showLastTry = false;
var ids = $scope.selected.item.split("-"); // this is because Angular 1.2 doesn't assign objects in ng-value
$scope.selected.method = $scope.methods[parseInt(ids[0])];
......@@ -274,7 +274,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
$scope.pause_ws = function (){
if (!$scope.sessionRunning || $scope.paused)
if (!$scope.sessionRunning || $scope.flags.paused)
return;
$scope.pauseTimer();
......@@ -301,7 +301,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
$scope.resume_ws = function (){
if (!$scope.sessionRunning || !$scope.paused)
if (!$scope.sessionRunning || !$scope.flags.paused)
return;
$scope.resumeTimer();
......@@ -329,24 +329,24 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.startTimer = function (){
$scope.$broadcast('timer-start');
$scope.paused = false;
$scope.tryRunning = true;
$scope.flags.paused = false;
$scope.flags.tryRunning = true;
};
$scope.pauseTimer = function (){
$scope.$broadcast('timer-stop');
$scope.paused = true;
$scope.flags.paused = true;
};
$scope.resumeTimer = function (){
$scope.$broadcast('timer-resume');
$scope.paused = false;
$scope.flags.paused = false;
};
$scope.stopTimer = function (){
$scope.$broadcast('timer-stop');
$scope.paused = false;
$scope.tryRunning = false;
$scope.flags.paused = false;
$scope.flags.tryRunning = false;
};
$scope.$on('timer-stopped', function (event, data){
......@@ -369,8 +369,10 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
// websockets events handling (Dashboard)
//
io.socket.on('update_peers', function (data) {
if($scope.ws && $scope.sessionRunning && $scope.actual_try.actions && $scope.paused == false && data.pcb_count<1) {
if($scope.ws && $scope.sessionRunning && $scope.actual_try.actions && $scope.flags.paused == false && data.pcb_count<1) {
$scope.pause_ws();
$scope.pauseTimer();
ngToast.warning({
......@@ -379,6 +381,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
dismissButton: true
});
}
});
......@@ -393,7 +396,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// as the last action, added $scope.apply() that lets angular know
// what data has updated, and refresh what needs to be refreshed.
// only events (i) from a student (and ii)when a try is opened are managed
if($scope.ws && $scope.actual_try.actions && $scope.paused == false){
if($scope.ws && $scope.actual_try.actions && $scope.flags.paused == false){
switch(data.action){
case 'Add':
......
......@@ -3,10 +3,10 @@
<div class="form-group">
<div class="btn-group">
<button class="btn btn-default" btn-radio="'new'" ng-model="section">
<button class="btn btn-default" btn-radio="'new'" ng-model="flags.section">
<span class="glyphicon glyphicon-record"></span> {{ 'new_session' | translate }}
</button>
<button class="btn btn-default" btn-radio="'previous'" ng-model="section" ng-click="load_tries()" ng-if="wsessions.length > 0">
<button class="btn btn-default" btn-radio="'previous'" ng-model="flags.section" ng-click="load_tries()" ng-if="wsessions.length > 0">
<span class="glyphicon glyphicon-transfer"></span> {{ 'previous_sessions' | translate }}
</button>
</div>
......@@ -33,25 +33,25 @@
<div class="session-controls form-horizontal" ng-show="selected.item != -1">
<!-- show/hide sessions button -->
<div class="form-group" ng-show="section == 'previous'">
<div class="form-group" ng-show="flags.section == 'previous'">
<span class="control-label"> {{ wsessions.length }} {{ 'sessions' | translate }}</span>
<button ng-click="showSessions = !showSessions" class="btn btn-default btn-sm" ng-disabled="wsessions.length == 0">
<div ng-show="!showSessions">
<button ng-click="flags.showSessions = !flags.showSessions" class="btn btn-default btn-sm" ng-disabled="wsessions.length == 0">
<div ng-show="!flags.showSessions">
{{ 'show' | translate }} <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
</div>
<div ng-show="showSessions">
<div ng-show="flags.showSessions">
{{ 'hide' | translate }} <span class="glyphicon glyphicon-collapse-up" aria-hidden="true"></span>
</div>
</button>
</div>
<!-- controls for session recording-->
<div ng-show="studentData.pcb_count<1 && section == 'new'" class="form-group">
<div ng-show="studentData.pcb_count<1 && flags.section == 'new'" class="form-group">
<span class="glyphicon glyphicon-exclamation-sign text-warning" aria-hidden="true"></span>
<span class="label label-warning">{{ 'warning_no_tablet_online' | translate }}</span>
</div>
<div class="input-group" ng-show="selected.item != -1 && studentData.pcb_count>0 && section == 'new'">
<div class="input-group" ng-show="selected.item != -1 && studentData.pcb_count>0 && flags.section == 'new'">
<div class="btn-group pull-right">
<button type="button"
class="btn btn-default btn-sm"
......@@ -65,7 +65,7 @@
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: !sessionRunning || !paused }"
ng-class="{ disabled: !sessionRunning || !flags.paused }"
popover="{{ 'continue_session' | translate }}"
popover-trigger="mouseenter"
ng-click="resume_ws();">
......@@ -73,7 +73,7 @@
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-class="{ disabled: !sessionRunning || paused }"
ng-class="{ disabled: !sessionRunning || flags.paused }"
popover="{{ 'pause_session' | translate }}"
popover-trigger="mouseenter"
ng-click="pause_ws();">
......@@ -113,7 +113,7 @@
</div>
<!-- running try -->
<div id="actual_try" ng-model="actual_try" ng-show="tryRunning && section == 'new'">
<div id="actual_try" ng-model="actual_try" ng-show="flags.tryRunning && flags.section == 'new'">
<div class="try_time">
<timer id="time_try" class="color_blue" interval="1000" auto-start="false">
{{mminutes}}:{{sseconds}}
......@@ -193,13 +193,13 @@
<!-- / running try -->
<!-- sessions list -->
<div class="list-group pre-scrollable" ng-show="showSessions && section == 'previous' || showLastTry && wsessions.length > 0 || ws_recover || tryRunning">
<div class="list-group pre-scrollable" ng-show="flags.showSessions && flags.section == 'previous' || flags.showLastTry && wsessions.length > 0 || ws_recover || flags.tryRunning">
<div ng-repeat="s in wsessions | orderBy: '-begin'">
<!-- div class="list-group-item" ng-repeat="s in wsessions | orderBy: '-begin' | limitTo: numPerPage:(currentPage-1)*numPerPage" -->
<div class="list-group-item" ng-show="section == 'previous' || ws.id==s.id || ws_recover">
<div class="list-group-item" ng-show="flags.section == 'previous' || ws.id==s.id || ws_recover">
<div ng-show="showLastTry && wsessions.length > 0">
<div ng-show="flags.showLastTry && wsessions.length > 0">
<h4><strong>{{ 'last_session' | translate }}</strong>: {{ studentData.current_method }}, {{ studentData.current_instruction }}</h4>
</div>
......@@ -212,11 +212,11 @@
<!-- show/hide tries button -->
<div class="form-group pull-right" ng-show="ws.id != s.id && !ws_recover">
<span class="control-label"> {{ s.tries.length }} {{ 'tries' | translate }}</span>
<button ng-click="showTries = !showTries" class="btn btn-default btn-sm">
<div ng-show="!showTries">
<button ng-click="flags.showTries = !flags.showTries" class="btn btn-default btn-sm">
<div ng-show="!flags.showTries">
{{ 'show' | translate }} <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
</div>
<div ng-show="showTries">
<div ng-show="flags.showTries">
{{ 'hide' | translate }} <span class="glyphicon glyphicon-collapse-up" aria-hidden="true"></span>
</div>
</button>
......@@ -229,7 +229,7 @@
<button ng-show="ws_recover" class="btn btn-warning btn-sm pull-right" type="button" ng-click="close_ws()" translate>close_session</button>
<!-- tries list -->
<div class="sessionTries" ng-show="showTries || ws.id == s.id || ws_recover">
<div class="sessionTries" ng-show="flags.showTries || ws.id == s.id || ws_recover">
<div class="try" ng-repeat="t in s.tries">
<div ng-show="!is_currentOpenTry(t)">
<table width="100%">
......
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