Commit 93c969ca by Fernando Martínez Santiago

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

parents f0c9c484 7db3758a
......@@ -220,10 +220,10 @@ module.exports = {
var sql = "";
var params = [];
if(typeof categories == "object" ){ //Is an array
sql="SELECT `picto_exp`.`id`, `picto_exp`.`id_pic`, `picto_exp`.`lang`, `picto_exp`.`text`, `picto`.`id`, `picto`.`uri`, `picto`.`id_src`, `picto`.`id_owner`, `picto`.`id_cat` FROM `picto_exp` INNER JOIN `picto` ON `picto_exp`.`id_pic` = `picto`.`id` WHERE `picto_exp`.`lang`=? AND `picto_exp`.`text` LIKE ? AND (`picto`.`id_owner` IS NULL OR `picto`.`id_owner`=?) AND `picto`.`id_src`=? AND `picto`.`id_cat` IN (?);";
sql="SELECT `picto_exp`.`id`, `picto_exp`.`id_pic`, `picto_exp`.`lang`, `picto_exp`.`text`, `picto`.`id`, `picto`.`uri`, `picto`.`id_src`, `picto`.`id_owner`, `picto`.`id_cat` FROM `picto_exp` INNER JOIN `picto` ON `picto_exp`.`id_pic` = `picto`.`id` WHERE `picto_exp`.`lang`=? AND `picto_exp`.`text` LIKE ? AND (`picto`.`id_owner` IS NULL OR `picto`.`id_owner`=?) AND `picto`.`id_src`=? AND `picto`.`id_cat` IN (?) ORDER BY LENGTH(`picto_exp`.`text`) LIMIT 200;";
params = [req.params.lang,'%'+req.params.text+'%', req.params.sup_id, req.params.source, categories];
}else{
sql= "SELECT `picto_exp`.`id`, `picto_exp`.`id_pic`, `picto_exp`.`lang`, `picto_exp`.`text`, `picto`.`id`, `picto`.`uri`, `picto`.`id_src`, `picto`.`id_owner`, `picto`.`id_cat` FROM `picto_exp` INNER JOIN `picto` ON `picto_exp`.`id_pic` = `picto`.`id` WHERE `picto_exp`.`lang`=? AND `picto_exp`.`text` LIKE ? AND (`picto`.`id_owner` IS NULL OR `picto`.`id_owner`=?) AND `picto`.`id_src`=?;";
sql= "SELECT `picto_exp`.`id`, `picto_exp`.`id_pic`, `picto_exp`.`lang`, `picto_exp`.`text`, `picto`.`id`, `picto`.`uri`, `picto`.`id_src`, `picto`.`id_owner`, `picto`.`id_cat` FROM `picto_exp` INNER JOIN `picto` ON `picto_exp`.`id_pic` = `picto`.`id` WHERE `picto_exp`.`lang`=? AND `picto_exp`.`text` LIKE ? AND (`picto`.`id_owner` IS NULL OR `picto`.`id_owner`=?) AND `picto`.`id_src`=? ORDER BY LENGTH(`picto_exp`.`text`) LIMIT 200;";
params = [req.params.lang,'%'+req.params.text+'%', req.params.sup_id, req.params.source];
}
......
......@@ -273,6 +273,7 @@
"new_instruction": "New instruction",
"new_method": "New method",
"new_objective": "New objective",
"new_grid": "New grid",
"new_grid_with_categories": "Create grid with categories",
"new_grid_without_categories": "Create grid without categories",
"new_session": "New session",
......
......@@ -272,6 +272,7 @@
"new_instruction": "Nueva instrucción",
"new_method": "Nuevo método",
"new_objective": "Nuevo objetivo",
"new_grid": "Nuevo tablero",
"new_grid_with_categories": "Crear escena con categorías",
"new_grid_without_categories": "Crear escena sin categorías",
"new_session": "Nueva sesión",
......
......@@ -250,3 +250,42 @@ dashboardDirectives.directive('popoveraddpicto', function() {
}
}
});
// for assigning a class within ng-options
dashboardDirectives.directive('optionsClass', function ($parse) {
return {
require: 'select',
link: function(scope, elem, attrs, ngSelect) {
// get the source for the items array that populates the select.
var pattern = /.* in ([\w]+) .*/g;
var optionsSourceStr = pattern.exec(attrs.ngOptions)[1],
// use $parse to get a function from the options-class attribute
// that you can use to evaluate later.
getOptionsClass = $parse(attrs.optionsClass);
scope.$watch(optionsSourceStr, function(items) {
// when the options source changes loop through its items.
angular.forEach(items, function(item, index) {
// evaluate against the item to get a mapping object for
// for your classes.
var classes = getOptionsClass(item),
// also get the option you're going to need. This can be found
// by looking for the option with the appropriate index in the
// value attribute.
option = elem.find('option[value=' + item.id + ']');
// now loop through the key/value pairs in the mapping object
// and apply the classes that evaluated to be truthy.
angular.forEach(classes, function(add, className) {
if (add) {
angular.element(option).addClass(className);
} else {
angular.element(option).removeClass(className);
}
});
});
});
}
};
});
......@@ -398,6 +398,8 @@ dashboardControllers.controller('AddPictoCtrl', function (
$scope.page=1; // Reset pagination
$scope.pictos = []; // Reset pictos
var length = $scope.srch_term_picto == undefined ? 0 : $scope.srch_term_picto.length;
if(length == 1){ //Check the word length
$scope.alert = { type: 'warning', msg: 'warning_two_characters', show: true };
......@@ -452,10 +454,15 @@ dashboardControllers.controller('AddPictoCtrl', function (
$http.get(request)
.success(function (data) {
// Load data into pictos
$scope.pictos = data;
// No data warning
if(data.length == 0){
$scope.alert = { type: 'warning', msg: 'warning_no_pictos_found', show: true };
}
$scope.loadingCatPictos = false;
})
.error(function () {
......
......@@ -89,12 +89,17 @@ dashboardControllers.controller('PictoConfigCtrl', function (
.then(function(result) {
return new Promise(function (resolve, reject) {
// If update_all_legend then set attribute true
var all_pictos = false;
if($scope.update_all_legend) all_pictos = true;
io.socket.post('/stu/vocabulary', {
action: 'update',
attributes: {
id_stu: stu.id,
id_grid: viewingGrid.id,
stu_picto: result
stu_picto: result,
all_pictos: all_pictos
}
},
function(res) {});
......
......@@ -18,6 +18,9 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
lodash,
ngToast) {
// For date validation
$scope.maxDate = new Date();
// For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'setup';
......
......@@ -122,11 +122,7 @@
</div>
<div class="form-group row">
<button type="button" class="btn btn-default" ng-click="open_grid_color(viewingGrid)" style="min-width:9.25em;">{{ 'setup' | translate }}</button>
</div>
<div class="form-group row">
<button type="button" class="btn btn-success" ng-click="open_new_grid()" aria-expanded="false"><i class="fa fa-plus" aria-hidden="true"></i></button>
<button type="button" class="btn btn-primary" ng-click="open_grid_color(viewingGrid)" aria-expanded="false" title="{{ 'setup' | translate }}"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></button>
<button type="button" class="btn btn-primary" ng-click="copy_grid()" title="{{ 'duplicate' | translate }}"><i class="fa fa-files-o" aria-hidden="true"></i></button>
<button type="button" class="btn btn-danger" ng-click="delete_grid(viewingGrid)" title="{{ 'delete' | translate }}"><i class="fa fa-trash" aria-hidden="true"></i></button>
</div>
......@@ -135,19 +131,12 @@
<label class="grid-panel-head">{{ 'show_grids' | translate }}</label>
<div class="form-group row">
<select class="grid-panel-select" ng-model="viewingGrid.id" ng-change="showGrid(viewingGrid.id,'menu')" size="7">
<option value="{{grid.id}}" ng-repeat="grid in gridsList | orderBy: 'name' track by $index" ng-selected="grid.id == viewingGrid.id" ng-class="{'grid-panel-select-optionactive': grid.active}">
{{ grid.name }}
</option>
</select>
<select ng-options="grid as grid.name for grid in gridsList | orderBy: 'name' track by grid.id" ng-model="viewingGrid" ng-change="showGrid(viewingGrid.id,'menu')" size="7" options-class="{'grid-panel-select-optionactive': active, 'grid-panel-select-optioninactive': !active}"></select>
</div>
<!--<div class="list-group">
<a class="list-group-item" ng-repeat="grid in gridsList track by $index" ng-click="showGrid(grid.id,false)" ng-class="(grid.id == viewingGrid.id) ? 'active' : ''">
<i class="fa fa-star" aria-hidden="true" ng-if="grid.active"></i> {{ grid.name }}
</a>
</div>-->
<div class="form-group row">
<button type="button" class="btn btn-success" ng-click="open_new_grid()" style="min-width:9.25em;"><i class="fa fa-plus" aria-hidden="true"></i> {{ 'new_grid' | translate }}</button>
</div>
</div>
......
......@@ -136,7 +136,7 @@
<div class="form-group">
<label translate>birthdate</label>
<p class="input-group">
<input type="text" class="form-control" datepicker-popup=" {{ 'day_format' | translate }}" ng-model="formUser.birthdate" placeholder="{{ 'birthdate' | translate }}" is-open="opened" close-text="{{'close' | translate}}" required />
<input type="text" class="form-control" datepicker-popup=" {{ 'day_format' | translate }}" ng-model="formUser.birthdate" placeholder="{{ 'birthdate' | translate }}" is-open="opened" close-text="{{'close' | translate}}" max-date="maxDate" required />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="openCalendar($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
......
......@@ -1151,6 +1151,9 @@ input.editable.grid-name {
.grid-panel-select-optionactive{
background-color:#c5e4c5;
}
.grid-panel-select-optioninactive{
background-color: transparent;
}
.grid-panel-select-optionselected{
background-color:#c5e4c5;
}
......
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