This commit is contained in:
Malibu 2015-03-10 16:11:17 +01:00
commit 5c05abf8b7
4 changed files with 133 additions and 75 deletions

View File

@ -1,18 +1,8 @@
<?php namespace App\Http\Controllers;
use User;
class HomeController extends Controller {
/*
|--------------------------------------------------------------------------
| Home Controller
|--------------------------------------------------------------------------
|
| This controller renders your application's "dashboard" for users that
| are authenticated. Of course, you are free to change or remove the
| controller as you wish. It is just here to get your app started!
|
*/
/**
* Create a new controller instance.
*
@ -20,7 +10,7 @@ class HomeController extends Controller {
*/
public function __construct()
{
$this->middleware('auth');
//
}
/**
@ -30,9 +20,34 @@ class HomeController extends Controller {
*/
public function index()
{
return view('home');
$res = User::referents()->get();
return view('home',['referents' => $res]);
}
/**
* Show referent games
*
* @param String $id
* @return Response
*/
public function showReferentGames($id)
{
return view('referent_games', ['referent' => $id]);
}
/**
* Show one referent game
*
* @param String $id
* @param String $idGame
* @return Response
*/
public function showOneReferentGame($id, $idGame)
{
return view('one_referent_game', ['referent' => $id, 'game' => $idGame]);
}
}
?>

View File

@ -12,7 +12,13 @@
*/
Route::get('/', 'GameController@index');
Route::get('/', 'HomeController@index');
Route::get('referents/{id}/games', 'GameController@showReferentGames')->where('id', '^((?!login|referent|admin).)*$');
Route::get('referents/{id}/games/{idGame}', 'GameController@showOneReferentGame');
Route::get('searchRef/{reg}', 'GameController@findReferents');

View File

@ -0,0 +1,62 @@
* {
pading: 0;
margin: 0;
box-sizing: border-box;
}
html, body {
font-family: 'Oswald', sans-serif;
width: 100%;
height: 100%;
background: #ebebeb;
}
nav {
margin: 25px 20%;
}
nav input {
font-size: 25px;
height: 70px;
width: 100%;
border: 2px solid #c3c3c3;
background: white;
padding: 10px 20px;
border-radius: 5px;
outline: 0;
letter-spacing: 1px;
word-spacing: 8px;
text-align: center;
font-family: 'Oswald', sans-serif;
}
.referent {
transition: opacity 0.2s;
opacity: 0.75;
display: inline-block;
cursor: pointer;
border-radius: 5px;
position: relative;
background: white;
border: 2px solid #c3c3c3;
margin: 25px;
width: 200px;
height: 200px;
background-size: cover;
overflow: hidden;
}
.referent:hover {
opacity: 1;
}
.referent .infos {
padding: 10px;
position: absolute;
bottom: 0;
width: 100%;
background:rgba(0, 0, 0, 0.7);
color: white;
text-align: center;
}

View File

@ -1,72 +1,47 @@
@extends('app')
@section('content')
<link href="css/home.css" rel="stylesheet" type="text/css"/>
<link href="css/coverflow.css" rel="stylesheet" type="text/css"/>
<br>
<center>
<img style="height:auto; width:auto; max-width:100px;" alt="" src="./pictures/homePic/home.png">
{{ HTML::style('css/frontend.css'); }}
<nav>
<form class="form-inline navbar" onsubmit="rechercherReferent()">
<div class="row divRecherche">
<div class="col-xs-12">
<input id="searchfield" class="form-control inpSear" placeholder="Rechercher un Référant" name="search" type="text"/>
</div>
</div>
</form>
<form onsubmit="rechercherReferent()">
<div class="row divRecherche">
<input name="ref" id="ref" placeholder="Rechercher un référent" type="text">
</div>
</form>
</nav>
@if ($referents != [])
@if ($referent != [])
<div style="margin-left: 200px, margin-right: 200px" id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- indicateur, à incrementé en fonction du nombre d'images -->
<ol class="carousel-indicators">
@foreach ($referent as $ref)
@if ($ref -> id == $referent[0] -> id)
<li data-target="#carousel-example-generic" data-slide-to="{{ $ref -> id }}" class='active' ></li>
@else
<li data-target="#carousel-example-generic" data-slide-to="{{ $ref -> id }} "></li>
@endif
@endforeach
</ol>
<nav>
<form>
<input name="searchterm" id="searchterm" placeholder="Rechercher un référent" type="text">
</form>
</nav>
<div id="referents" class="referents">
@foreach ($referents as $referent)
<!-- Parametres des images -->
<div id="caroussel" class="carousel-inner" role="listbox">
@foreach ($referent as $ref)
@if ($ref -> id == $referent[0] -> id)
<div class="item active">
@else
<div class="item">
@endif
<br>
<a href="/referents/{{$ref->id}}/games"><img class="imgRef" src="{{$ref -> image}}" alt="{{ $ref -> firstname }}-{{ $ref -> lastname }}"></a>
<a href="/referents/{{$ref->id}}/games"><div class="well well-lg nomRef">{{$ref -> firstname}}, {{$ref -> lastname}}</div></a>
</div>
@endforeach
</div>
<div class="referent" style="background-image:url('{{ $ref -> image }}')">
<div class="infos">{{ $referent -> firstname }} {{ $referent -> lastname }}</div>
</div>
<!-- Controles -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Précédant</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Suivant</span>
</a>
</div>
</div>
@endforeach
</div>
<script type="text/javascript">
$("#searchterm").keyup(function(e){
var q = $("#searchterm").val();
$.getJSON("searchRef/" + q, function(data) {
$("#referents").empty();
$.each(data.query.search, function(i,item){
$("#referents").append('<div class="referent" style="background-image:url('4.jpg')"><div class="infos">'+ item.firstname +'</div></div>');
});
});
});
</script>
@else
@endif
<script type="text/javascript">
document.oncontextmenu = new Function("return true");
function hideIcon(self) {
self.style.backgroundImage = 'none';
}
</script>
<script type="text/javascript" src="/js/rechercheRef.js"> </script>
</center>
<h1>Aucun référent trouvé</h1>
@endsection