admin: implement Enter keypress on search
This commit is contained in:
parent
cb97af2f8a
commit
7c84301c04
4 changed files with 51 additions and 3 deletions
|
@ -1284,6 +1284,22 @@ angular.module("FICApp")
|
|||
$scope.themes = Theme.query();
|
||||
$scope.fields = ["name", "authors", "headline", "path"];
|
||||
|
||||
$scope.validateSearch = function(keyEvent) {
|
||||
if (keyEvent.which === 13) {
|
||||
var myTheme = null;
|
||||
$scope.themes.forEach(function(theme) {
|
||||
if (String(theme.name.toLowerCase()).indexOf($scope.query.toLowerCase()) >= 0) {
|
||||
if (myTheme === null)
|
||||
myTheme = theme;
|
||||
else
|
||||
myTheme = false;
|
||||
}
|
||||
});
|
||||
if (myTheme)
|
||||
$location.url("themes/" + myTheme.id);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.show = function(id) {
|
||||
$location.url("/themes/" + id);
|
||||
};
|
||||
|
@ -1343,6 +1359,22 @@ angular.module("FICApp")
|
|||
$scope.exercice = {}; // Array used to save fields to updates in selected exercices
|
||||
$scope.fields = ["title", "headline"];
|
||||
|
||||
$scope.validateSearch = function(keyEvent) {
|
||||
if (keyEvent.which === 13) {
|
||||
var myExercice = null;
|
||||
$scope.exercices.forEach(function(exercice) {
|
||||
if (String(exercice.title.toLowerCase()).indexOf($scope.query.toLowerCase()) >= 0) {
|
||||
if (myExercice === null)
|
||||
myExercice = exercice;
|
||||
else
|
||||
myExercice = false;
|
||||
}
|
||||
});
|
||||
if (myExercice)
|
||||
$location.url("exercices/" + myExercice.id);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleSelectAll = function() {
|
||||
angular.forEach($filter('filter')($scope.exercices, $scope.query), function(ex) {
|
||||
ex.selected = !$scope.selectall
|
||||
|
@ -1833,6 +1865,22 @@ angular.module("FICApp")
|
|||
$scope.teams = Team.query();
|
||||
$scope.fields = ["id", "name"];
|
||||
|
||||
$scope.validateSearch = function(keyEvent) {
|
||||
if (keyEvent.which === 13) {
|
||||
var myTeam = null;
|
||||
$scope.teams.forEach(function(team) {
|
||||
if (String(team.name.toLowerCase()).indexOf($scope.query.toLowerCase()) >= 0) {
|
||||
if (myTeam === null)
|
||||
myTeam = team;
|
||||
else
|
||||
myTeam = false;
|
||||
}
|
||||
});
|
||||
if (myTeam)
|
||||
$location.url("teams/" + myTeam.id);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.desactiveTeams = function() {
|
||||
$http.post("/api/disableinactiveteams").then(function() {
|
||||
$scope.teams = Team.query();
|
||||
|
|
Reference in a new issue