Une page d'accueil

This commit is contained in:
champeno 2015-06-20 00:02:36 +02:00
parent f9fb3561dd
commit 0d043cc28c
8 changed files with 123 additions and 16 deletions

14
monstage/static/index.css Normal file
View file

@ -0,0 +1,14 @@
@charset "utf-8";
.entrer {
text-align:center;
}
.entrer a {
display:inline-block;
background:#4FB088;
color:#fff;
font-size:1.5em;
padding:8px;
border-radius:5px;
}

View file

@ -4,6 +4,8 @@
body { body {
font: 18px 'Lato', sans-serif; font: 18px 'Lato', sans-serif;
background:#4FB088; background:#4FB088;
padding:0;
margin:0;
} }
a { a {
@ -16,11 +18,46 @@ h1 {
margin-top:0; margin-top:0;
} }
.beta {
font-size:0.5em;
display:inline-block;
transform:rotate(-20deg);
color:#aaa;
}
header {
background:#166142;
padding:10px;
margin:0;
overflow:hidden;
}
header li {
display:inline-block;
}
header h1 {
float:left;
color:#fff;
}
header li a {
display:inline-block;
padding:20px 10px;
margin:0 15px;
}
header ul {
float:right;
padding:0;
margin:0;
}
#content { #content {
width:80%; width:80%;
max-width:700px; max-width:700px;
padding:30px; padding:30px;
margin:0 auto; margin:20px auto;
background:#eee; background:#eee;
} }

View file

@ -0,0 +1,15 @@
{% extends "skeleton.html" %}
{% block content %}
<h1>Bonjour {{ user.first_name }} !</h1>
<p><a href="{% url 'monstage:profil_edit' %}">Modifier mon profil</a></p>
<h2>Mes stages</h2>
<ul>
{% for stage in stages %}
<li><a href="{% url 'monstage:stage' stage.id %}">{{ stage.sujet }}</a></li>
{% endfor %}
<li><a href="{% url 'monstage:stage_add' %}">Ajouter un stage</a></li>
</ul>
{% endblock %}

View file

@ -1,15 +1,22 @@
{% extends "skeleton.html" %} {% extends "skeleton.html" %}
{% load staticfiles %}
{% block content %} {% block extra_head %}
<h1>Bonjour {{ user.first_name }} !</h1> <link type="text/css" href="{% static 'index.css' %}" rel="stylesheet" />
<p><a href="{% url 'monstage:profil_edit' %}">Modifier mon profil</a></p> {% endblock %}
<h2>Mes stages</h2>
<ul> {% block content %}
{% for stage in stages %} <h1>ExperiENS<span class="beta">beta</span></h1>
<li><a href="{% url 'monstage:stage' stage.id %}">{{ stage.sujet }}</a></li> <p>Partagez vos expériences de stages !</p>
{% endfor %} <div class="entrer">
<li><a href="{% url 'monstage:stage_add' %}">Ajouter un stage</a></li> <p><a href="{% url 'monstage:home' %}">Partagez VOTRE expérience</a></p>
</ul> <p class="helptext">Connexion via le serveur central d'authentification ENS (identifiants clipper)</p>
</div>
<div class="explications">
<p>Ne partez plus en stage en terre inconnue : nourrissez-vous de l'expérience de {{ stats.num_stages }} stages effectués par la communauté normalienne et ne faites pas les mêmes erreurs !</p>
</div>
<div class="explications">
<p>Vous revenez du bout du monde (ou de la rue d'à côté) ? N'attendez plus, rédigez un avis sur votre stage pour nourrir que votre expérience profite à d'autres !</p>
</div>
{% endblock %} {% endblock %}

View file

@ -0,0 +1,9 @@
{% extends "skeleton.html" %}
{% block content %}
<p><a href="{% url 'monstage:index' %}">Retour</a></p>
<h1>Recherche</h1>
<p>La recherche de stage n'est pas encore disponible. Elle devrait l'être à la rentrée 2015 !</p>
{% endblock %}

View file

@ -9,6 +9,17 @@
</head> </head>
<body> <body>
<header>
<h1>ExperiENS<span class='beta'>beta</span></h1>
<nav>
<ul id="menu">
<li><a href="{% url 'monstage:index' %}">Accueil</a></li>
<li><a href="{% url 'monstage:home' %}">Mon expérience</a></li>
<li><a href="{% url 'monstage:search' %}">Recherche</a></li>
</ul>
</nav>
</header>
<div id="content"> <div id="content">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>

View file

@ -4,6 +4,7 @@ from monstage import views
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^home/$', views.home, name='home'),
url(r'^profil/show/(?P<profil_id>\w+)/$', views.profil, name='profil'), url(r'^profil/show/(?P<profil_id>\w+)/$', views.profil, name='profil'),
url(r'^profil/edit/$', views.profil_edit, name='profil_edit'), url(r'^profil/edit/$', views.profil_edit, name='profil_edit'),
url(r'^api/lieux/candidats/$', views.lieux_candidats, name='lieux_candidats'), url(r'^api/lieux/candidats/$', views.lieux_candidats, name='lieux_candidats'),
@ -12,4 +13,5 @@ urlpatterns = patterns('',
url(r'^stage/(?P<stage_id>\d+)/edit/description/$', views.stage_edit_desc, name='stage_edit_desc'), url(r'^stage/(?P<stage_id>\d+)/edit/description/$', views.stage_edit_desc, name='stage_edit_desc'),
url(r'^stage/(?P<stage_id>\d+)/edit/lieu/$', views.stage_edit_lieu, name='stage_edit_lieu'), url(r'^stage/(?P<stage_id>\d+)/edit/lieu/$', views.stage_edit_lieu, name='stage_edit_lieu'),
url(r'^stage/(?P<stage_id>\d+)/edit/avis/$', views.stage_edit_feedback, name='stage_edit_feedback'), url(r'^stage/(?P<stage_id>\d+)/edit/avis/$', views.stage_edit_feedback, name='stage_edit_feedback'),
url(r'^recherche/$', views.search, name='search'),
) )

View file

@ -15,10 +15,14 @@ def addslashes(s):
d = {'"':'\\"', "'":"\\'", "\0":"\\\0", "\\":"\\\\", '\n':'\\n'} d = {'"':'\\"', "'":"\\'", "\0":"\\\0", "\\":"\\\\", '\n':'\\n'}
return ''.join(d.get(c, c) for c in s) return ''.join(d.get(c, c) for c in s)
@login_required
def index(request): def index(request):
stages = Stage.objects.filter( profil_user = request.user.profil ) stats = { 'num_stages': Stage.objects.count() }
return render(request, 'monstage/index.html', {"stages" : stages}) return render(request, 'monstage/index.html', {'stats': stats})
@login_required
def home(request):
stages = request.user.profil.stages.all()
return render(request, 'monstage/home.html', {"stages" : stages})
# #
# Utilisateurs et profils # Utilisateurs et profils
@ -239,3 +243,11 @@ def stage_edit_feedback(request, stage_id):
def detail(request, question_id): def detail(request, question_id):
question = get_object_or_404(Question, pk=question_id) question = get_object_or_404(Question, pk=question_id)
return render(request, 'monstage/detail.html', {'question': question}) return render(request, 'monstage/detail.html', {'question': question})
#
# Recherche de stages
#
def search(request):
return render(request, 'monstage/search.html')