Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Raph El
Admin-Panel
Commits
113ee4cf
Commit
113ee4cf
authored
Mar 03, 2015
by
El-gitano
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/ISTIC-TENNIS/Admin-Panel
parents
115624bd
926e404c
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
11 deletions
+126
-11
app/index.html
app/index.html
+1
-0
app/scripts/app.js
app/scripts/app.js
+4
-0
app/scripts/controllers/ajoutJoueur.js
app/scripts/controllers/ajoutJoueur.js
+69
-0
app/scripts/controllers/equipes.js
app/scripts/controllers/equipes.js
+1
-1
app/scripts/controllers/joueurs.js
app/scripts/controllers/joueurs.js
+1
-2
app/scripts/filters/slice.js
app/scripts/filters/slice.js
+3
-1
app/scripts/services/apicall.js
app/scripts/services/apicall.js
+7
-1
app/views/ajoutJoueur.html
app/views/ajoutJoueur.html
+29
-0
app/views/equipes.html
app/views/equipes.html
+1
-0
app/views/joueurs.html
app/views/joueurs.html
+5
-3
app/views/joueursEquipe.html
app/views/joueursEquipe.html
+5
-3
No files found.
app/index.html
View file @
113ee4cf
...
...
@@ -76,6 +76,7 @@
<script
src=
"scripts/controllers/joueursEquipe.js"
></script>
<script
src=
"scripts/controllers/equipes.js"
></script>
<script
src=
"scripts/controllers/joueurs.js"
></script>
<script
src=
"scripts/controllers/ajoutJoueur.js"
></script>
<script
src=
"scripts/services/apicall.js"
></script>
<script
src=
"scripts/directives/chargement.js"
></script>
<script
src=
"scripts/filters/slice.js"
></script>
...
...
app/scripts/app.js
View file @
113ee4cf
...
...
@@ -26,6 +26,10 @@ angular
templateUrl
:
'
views/joueurs.html
'
,
controller
:
'
JoueursCtrl
'
})
.
when
(
'
/ajouterJoueur
'
,
{
templateUrl
:
'
views/ajouterJoueur.html
'
,
controller
:
'
AjouterJoueurCtrl
'
})
.
when
(
'
/teams/:idEquipe/players
'
,
{
templateUrl
:
'
views/joueursEquipe.html
'
,
controller
:
'
JoueursEquipeCtrl
'
...
...
app/scripts/controllers/ajoutJoueur.js
0 → 100644
View file @
113ee4cf
'
use strict
'
;
var
app
=
angular
.
module
(
'
panelAdminApp
'
);
//Configuration du service d'appel à l'API
app
.
config
(
function
(
apicallProvider
,
urlAPI
){
apicallProvider
.
setUrl
(
urlAPI
);
});
app
.
controller
(
'
AjoutJoueurCtrl
'
,
[
'
$scope
'
,
'
$modal
'
,
'
$log
'
,
'
apicall
'
,
function
(
$scope
,
$modal
,
$log
,
apicall
)
{
$scope
.
items
=
{
name
:
''
,
firstname
:
''
,
sex
:
''
,
birthdate
:
''
,
team
:
''
,
list
:[]};
//Récupération de la liste des equipes
apicall
.
getEquipes
().
success
(
function
(
data
){
$scope
.
items
.
list
=
data
.
teams
;
$log
.
info
(
$scope
.
teams
);
}).
error
(
function
(){
$scope
.
alertes
.
push
({
type
:
'
danger
'
,
msg
:
'
Impossible de récupérer la liste des equipes (cliquer pour essayer de recharger)
'
});
});
$scope
.
open
=
function
(
size
)
{
var
modalInstance
=
$modal
.
open
({
templateUrl
:
'
views/ajoutJoueur.html
'
,
controller
:
'
ModalInstanceCtrl
'
,
size
:
size
,
resolve
:
{
items
:
function
()
{
return
$scope
.
items
;
}
}
});
modalInstance
.
result
.
then
(
function
(
object
)
{
$log
.
info
(
object
);
apicall
.
AddJoueurs
(
object
).
success
(
function
(
data
){
$log
.
info
(
data
);
}).
error
(
function
(){
$scope
.
alertes
.
push
({
type
:
'
danger
'
,
msg
:
'
Impossible de créer un joueur (cliquer pour essayer de recharger)
'
});
});
},
function
()
{
$log
.
info
(
'
Modal dismissed at:
'
+
new
Date
());
});
};
}]);
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
angular
.
module
(
'
ui.bootstrap
'
).
controller
(
'
ModalInstanceCtrl
'
,
function
(
$scope
,
$modalInstance
,
items
)
{
$scope
.
items
=
items
;
$scope
.
ok
=
function
()
{
var
perso
=
{};
jQuery
.
extend
(
perso
,
items
);
delete
perso
.
list
;
$modalInstance
.
close
(
perso
);
};
$scope
.
cancel
=
function
()
{
$modalInstance
.
dismiss
(
'
cancel
'
);
};
});
\ No newline at end of file
app/scripts/controllers/equipes.js
View file @
113ee4cf
...
...
@@ -32,7 +32,7 @@ app.controller('EquipesCtrl', ['$scope', '$location', 'apicall', function ($scop
apicall
.
getEquipes
().
success
(
function
(
data
){
$scope
.
chargement
=
false
;
$scope
.
equipes
=
data
;
$scope
.
equipes
=
data
.
teams
;
}).
error
(
function
(){
$scope
.
alertes
.
push
({
type
:
'
danger
'
,
msg
:
'
Impossible de récupérer la liste des equipes (cliquer pour essayer de recharger)
'
});
...
...
app/scripts/controllers/joueurs.js
View file @
113ee4cf
...
...
@@ -11,7 +11,6 @@ var app = angular.module('panelAdminApp');
//Configuration du service d'appel à l'API
app
.
config
(
function
(
apicallProvider
,
urlAPI
){
apicallProvider
.
setUrl
(
urlAPI
);
});
...
...
@@ -85,7 +84,7 @@ app.controller('JoueursCtrl', ['$scope', '$routeParams', '$filter', '$log', 'api
apicall
.
getJoueurs
().
success
(
function
(
data
){
$scope
.
joueurs
=
data
;
$scope
.
joueurs
=
data
.
players
;
$scope
.
totalElements
=
$scope
.
joueurs
.
length
;
}).
error
(
function
(){
...
...
app/scripts/filters/slice.js
View file @
113ee4cf
...
...
@@ -11,6 +11,8 @@
angular
.
module
(
'
panelAdminApp
'
)
.
filter
(
'
slice
'
,
function
()
{
return
function
(
entree
,
debut
,
fin
)
{
return
(
entree
||
[]).
slice
(
debut
,
fin
);
return
(
entree
||
[]);
// Ne fonctionne pas, je commente pour travailler à côté
//return (entree || []).slice(debut, fin);
};
});
app/scripts/services/apicall.js
View file @
113ee4cf
...
...
@@ -40,7 +40,13 @@ angular.module('panelAdminApp').
return
$http
.
get
(
url
+
'
/players
'
);
};
// Création d'un joueur
this
.
AddJoueurs
=
function
(
object
){
return
$http
.
post
(
url
+
'
/players
'
,
object
);
};
// Récupération des informations sur les courts
this
.
getCourts
=
function
(){
...
...
app/views/ajoutJoueur.html
0 → 100644
View file @
113ee4cf
<div
class=
"modal-header"
>
<h3
class=
"modal-title"
>
Ajouter un joueur
</h3>
</div>
<div
class=
"modal-body"
>
<form
role=
"form"
>
<h0>
Nom:
</h0>
<input
type=
"text"
ng-model=
"items.name"
placeholder=
"Nom"
value=
"{{ nom }}"
>
<br/>
<h0>
Prénom:
</h0>
<input
type=
"text"
ng-model=
"items.firstname"
placeholder=
"Prénom"
value=
"{{ prenom }}"
>
<br/>
<h0>
Sexe:
</h0>
<select
ng-model=
"items.sex"
name=
"sex"
placeholder=
"Sexe"
>
<option
value=
"M"
>
Homme
</option>
<option
value=
"W"
>
Femme
</option>
</select><br/>
<h0>
Equipe:
</h0>
<select
ng-model=
"items.team"
>
<option
ng-repeat=
"team in items.list"
value=
"{{team.NameTeam}}"
>
{{team.NameTeam}}
</option>
</select>
<br/>
<h0>
Date de naissance: (aaaa-mm-dd)
</h0>
<input
type=
"text"
ng-model=
"items.birthdate"
placeholder=
"Date de naissance"
value=
"{{ dat }}"
>
</form>
</div>
<div
class=
"modal-footer"
>
<button
class=
"btn btn-primary"
ng-click=
"ok()"
>
Créer le joueur
</button>
<button
class=
"btn btn-warning"
ng-click=
"cancel()"
>
Cancel
</button>
</div>
\ No newline at end of file
app/views/equipes.html
View file @
113ee4cf
<div
ng-app=
"panelAdminApp"
ng-controller=
"EquipesCtrl"
id=
"equipes"
>
<alert
role=
"alert"
ng-click=
"chargerEquipes()"
ng-repeat=
"alerte in alertes"
type=
"{{alerte.type}}"
close=
"fermerAlerte($index)"
>
{{alerte.msg}}
</alert>
<div
class=
"panel panel-default"
>
<table
class=
"table table-striped"
>
...
...
app/views/joueurs.html
View file @
113ee4cf
...
...
@@ -115,9 +115,11 @@
</tr>
<tr>
<td
colspan=
"7"
>
<button
type=
"button"
ng-click=
"ajouterJoueur()"
class=
"btn btn-success btn-block"
>
<span
class=
"glyphicon glyphicon-plus"
></span>
Ajouter un joueur
</button>
<div
ng-app=
"panelAdminApp"
ng-controller=
"AjoutJoueurCtrl"
>
<button
type=
"button"
ng-click=
"open()"
class=
"btn btn-success btn-block btn-default"
>
<span
class=
"glyphicon glyphicon-plus"
></span>
Ajouter un joueur
</button>
</div>
</td>
</tr>
</tbody>
...
...
app/views/joueursEquipe.html
View file @
113ee4cf
...
...
@@ -153,9 +153,11 @@
</tr>
<tr>
<td
colspan=
"8"
>
<button
type=
"button"
ng-click=
"ajouterJoueur()"
class=
"btn btn-success btn-block"
>
<span
class=
"glyphicon glyphicon-plus"
></span>
Ajouter un joueur
</button>
<script
type=
"text/ng-template"
id=
"ajoutJoueur.html"
>
<
button
type
=
"
button
"
ng
-
click
=
"
ajouterJoueur()
"
class
=
"
btn btn-success btn-block
"
>
<
span
class
=
"
glyphicon glyphicon-plus
"
><
/span> Ajouter un joueu
r
<
/button
>
</script>
</td>
</tr>
</tbody>
...
...
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