Browse Source

Set Home page for all years

Added video on Home
change navigation bar buttons
master
tr4ck3ur des JM2L 9 years ago
parent
commit
2c8bd43f56
5 changed files with 74 additions and 57 deletions
  1. +1
    -1
      jm2l/__init__.py
  2. +6
    -20
      jm2l/templates/NewIndex.mako
  3. +2
    -1
      jm2l/templates/helpers.mako
  4. +13
    -16
      jm2l/templates/layout.mako
  5. +52
    -19
      jm2l/views.py

+ 1
- 1
jm2l/__init__.py View File

@@ -69,7 +69,7 @@ def main(global_config, **settings):
config.add_route('action_salle', '/Salles/{action:(\w+)}/{salle_id:(\d+)}') config.add_route('action_salle', '/Salles/{action:(\w+)}/{salle_id:(\d+)}')


# HTML Routes - Public # HTML Routes - Public
config.add_route('home', '/')
config.add_route('home', '/{year:(\d+/)?}')
config.add_route('presse', '/{year:\d+}/dossier-de-presse') config.add_route('presse', '/{year:\d+}/dossier-de-presse')
config.add_route('edit_presse', '/{year:\d+}/dossier-de-presse/edit') config.add_route('edit_presse', '/{year:\d+}/dossier-de-presse/edit')
config.add_route('programme', '/{year:\d+}/le-programme') config.add_route('programme', '/{year:\d+}/le-programme')


+ 6
- 20
jm2l/templates/NewIndex.mako View File

@@ -4,7 +4,7 @@
<script> <script>
var timeline = new VMM.Timeline("timeline", '95%', '500px'); var timeline = new VMM.Timeline("timeline", '95%', '500px');
var c = {language:{ lang:"fr",api:{wikipedia:"fr"},date:{month:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],month_abbr:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","dec."],day:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],day_abbr:["Dim.","Lu.","Ma.","Me.","Jeu.","Vend.","Sam."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_short:"HH:MM:SS",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'à' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"Chargement de la frise en cours... ",return_to_title:"Retour à la page d'accueil",expand_timeline:"Elargir la frise",contract_timeline:"Réduire la frise",wikipedia:"Extrait de Wikipedia, l'encyclopédie libre",loading_content:"Chargement",loading:"Chargement",swipe_nav:"Swipe to Navigate"}}}; var c = {language:{ lang:"fr",api:{wikipedia:"fr"},date:{month:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],month_abbr:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","dec."],day:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],day_abbr:["Dim.","Lu.","Ma.","Me.","Jeu.","Vend.","Sam."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_short:"HH:MM:SS",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'à' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"Chargement de la frise en cours... ",return_to_title:"Retour à la page d'accueil",expand_timeline:"Elargir la frise",contract_timeline:"Réduire la frise",wikipedia:"Extrait de Wikipedia, l'encyclopédie libre",loading_content:"Chargement",loading:"Chargement",swipe_nav:"Swipe to Navigate"}}};
timeline.init(c, "/2015/timeline-json");
timeline.init(c, "/${year}/timeline-json");
</script> </script>
</%def> </%def>
<%def name="cssAddOn()"> <%def name="cssAddOn()">
@@ -20,8 +20,9 @@
} }
</style> </style>
</%def> </%def>
<H2 style="text-align: center;" class="shadow">9<sup>ème</sup> édition des JM2L</H2>
<H2 style="text-align: center;" class="shadow">${edition | n} édition des JM2L</H2>
<br> <br>
% if year=='2015':
<div class="row-fluid"> <div class="row-fluid">
<div class="span4 offset1"> <div class="span4 offset1">
<blockquote> <blockquote>
@@ -31,11 +32,8 @@
Le thème de cette année sera « Do It Yourself » ou « Faîtes le vous-même » : Le thème de cette année sera « Do It Yourself » ou « Faîtes le vous-même » :
<ul class="enum"> <ul class="enum">
<li>Migration vers les logiciels libres</li> <li>Migration vers les logiciels libres</li>
## <li>Libres enfants du numérique : jeux et loisirs pour les juniors.</li>
## <li>Gérer ses données personnelles</li>
<li>Do It Yourself (jeux vidéos, fablabs…)</li> <li>Do It Yourself (jeux vidéos, fablabs…)</li>
<li>Culture libre</li> <li>Culture libre</li>
## <li>Communautés du libre</li>
</ul> </ul>
</div> </div>
<div class="span4 offset1"> <div class="span4 offset1">
@@ -50,21 +48,9 @@
</p> </p>
</div> </div>
</div> </div>


## Nous vous proposons plusieurs formats de contribution :
## <ul class="enum">
## <li>Stands au sein du village associatif</li>
## <li>Conférences de 20 à 70 minutes suivies d’un échange</li>
## <li>Ateliers de 45 minutes ou 1h15</li>
## <li>Démos de vos matériels, logiciels ou projets libres</li>
## <li>Animations ouvertes</li>
## <li>Vous pouvez aussi aider l'équipe à la logistique.</li>
## </ul>
## <p>
## Il sera bien sûr possible de combiner plusieurs formats (par exemple, une démo ou une conférence suivie
## d’un atelier).
## </p>
% else:
<a href="/${year}/le-programme">La grille du programme</a>
% endif


<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">


+ 2
- 1
jm2l/templates/helpers.mako View File

@@ -603,7 +603,7 @@ TabJs = {'select':[], 'desc':[]}
## Wrapper pour les sponsors ## Wrapper pour les sponsors
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="participants(Year)"> \ <%def name="participants(Year)"> \
<div id='right_panel'>
<table class="ShowEntities table"> <table class="ShowEntities table">
<thead> <thead>
<th colspan="3">Sponsors ${Year}</th> <th colspan="3">Sponsors ${Year}</th>
@@ -647,4 +647,5 @@ TabJs = {'select':[], 'desc':[]}
% endfor % endfor
</tr> </tr>
</table> </table>
</div>
</%def> \ </%def> \

+ 13
- 16
jm2l/templates/layout.mako View File

@@ -37,9 +37,8 @@ ${helpers.uploader_js()}
<div id="wrap"> <div id="wrap">
<div id="top"> <div id="top">
% if DisplayYear!=2015: % if DisplayYear!=2015:
## style="background: url( ${"/img/%s/headerbg.png" % DisplayYear} ) repeat-x scroll 0 top #ffffff;">
<div class="align-center">
<a href="/">
<div class="align-center" style="background: url( ${'/img/%s/headerbg.png' % DisplayYear} ) repeat-x scroll 0 top #ffffff;">
<a href="${"/%s/" % DisplayYear}">
<div style="height:215px;background: url( ${"/img/%s/logo.png" % DisplayYear} ) no-repeat scroll center center transparent"> <div style="height:215px;background: url( ${"/img/%s/logo.png" % DisplayYear} ) no-repeat scroll center center transparent">
</div> </div>
</a> </a>
@@ -98,19 +97,18 @@ ${helpers.uploader_js()}
<div class="navbar"> <div class="navbar">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<div class="nav pull-left">

<div class="nav pull-right">
<div class="btn-group"> <div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<span class="brand" style="padding: 0 10px 0 18px;">JM2L
<small>${DisplayYear}</small>&nbsp;<span class="caret"></span></span></a>
Archives&nbsp;<span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
% for tmpyear in range(2015, 2005, -1):
% if tmpyear!=2014:
% for tmpyear in range(2013, 2005, -1):
<li><a href="/year/${tmpyear}">${tmpyear}</a></li> <li><a href="/year/${tmpyear}">${tmpyear}</a></li>
% endif
% endfor % endfor
</ul> </ul>
</div> </div>

<div class="btn-group"> <div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
% if request.user: % if request.user:
@@ -138,18 +136,17 @@ ${helpers.uploader_js()}
## </li> ## </li>
</ul> </ul>
</div> </div>
</div>
</div>
<ul class="nav nav-pills pull-right"> <ul class="nav nav-pills pull-right">
<li class="${accueil or ''}"><a href="/">Accueil</a></li>
<li class="${programme or ''}"><a href="/${DisplayYear}/le-programme">Programme</a></li>
<li class="${presse or ''}"><a href="/${DisplayYear}/dossier-de-presse">Presse</a></li>
<li class="${plan or ''}"><a href="/nous-rejoindre">Contact et Plan</a></li>
% if request.user: % if request.user:
<li class="${participer or ''}"><a href="/MesJM2L">Mes JM2L</a></li> <li class="${participer or ''}"><a href="/MesJM2L">Mes JM2L</a></li>
% else: % else:
<li class="${participer or ''}"><a href="/participer-l-evenement">Participer</a></li> <li class="${participer or ''}"><a href="/participer-l-evenement">Participer</a></li>
% endif
% endif
<li class="${programme or ''}"><a href="/${DisplayYear}/le-programme">Programme</a></li>
<li class="${presse or ''}"><a href="/${DisplayYear}/dossier-de-presse">Presse</a></li>
<li class="${plan or ''}"><a href="/nous-rejoindre">Contact et Plan</a></li>
</ul> </ul>


</div> </div>


+ 52
- 19
jm2l/views.py View File

@@ -170,9 +170,17 @@ def JSON_TimeLine_Request(request):
.filter("strftime('%d', start_time) = :dow").params(dow=Day.day)\ .filter("strftime('%d', start_time) = :dow").params(dow=Day.day)\
.order_by(Event.start_time) .order_by(Event.start_time)
ListEv = []
#ListEv = []
for ev in Events: for ev in Events:
if ev.event_type: if ev.event_type:
CurMedia = ev.video.first() or ""
if CurMedia:
Container = """<video controls="controls" preload="metadata">"""
Container += "<source type=\"" + CurMedia.mime_type + "\""
Container += " src=\"" + CurMedia.get_path + "\" />"
Container += "</video>"
else:
Container = ""
ListEv.append( { ListEv.append( {
#"uid":"%d/%d" % ( year, ev.uid ), #"uid":"%d/%d" % ( year, ev.uid ),
"headline":ev.name, "headline":ev.name,
@@ -182,32 +190,55 @@ def JSON_TimeLine_Request(request):
"tags":ev.Salle and (ev.Salle.name or "unk") , "tags":ev.Salle and (ev.Salle.name or "unk") ,
#"status":ev.event_type, #"status":ev.event_type,
"asset": { "asset": {
"media":"", #http://jm2l.linux-azur.org/sites/jm2l.linux-azur.org/files/videos/2012/2012_Introduction_aux_logiciels_libres__Frederic_Couchet.ogv",
"media": Container,
"credit":"", "credit":"",
"caption":"" } "caption":"" }
} ) } )
break
DicResult = {
"lang":"fr",
"headline":"JM2L 2015",
"type":"default",
"startDate":"2015,11,28,10",
"text":"<i><span class='c1'>9ème Édition</span></i>",
"asset":
{
"media":"https://www.youtube.com/watch?v=DnfjrxVoLao",
"credit":"JM2L",
"caption":""
if year=="2015":
DicResult = {
"lang":"fr",
"headline":"JM2L 2015",
"type":"default",
"startDate":"2015,11,28,10",
"text":"<i><span class='c1'>9ème Édition</span></i>",
"asset":
{
"media":"https://www.youtube.com/watch?v=DnfjrxVoLao",
"credit":"JM2L",
"caption":""
}
}
else:
DicResult = {
"lang":"fr",
"headline":"JM2L %d" % year,
"type":"default",
"asset":
{
"media":"",
"credit":"JM2L",
"caption":""
}
} }
}
DicResult["date"] = ListEv DicResult["date"] = ListEv
return { 'timeline':DicResult } return { 'timeline':DicResult }


## =-=- Here, We handle HTTP requests - Public Part -=-= ## =-=- Here, We handle HTTP requests - Public Part -=-=
@view_config(route_name='home', renderer="jm2l:templates/NewIndex.mako") @view_config(route_name='home', renderer="jm2l:templates/NewIndex.mako")
def index_page(request): def index_page(request):
MainTab = {'accueil':'active', "logged_in":request.authenticated_userid }
return MainTab
year = request.matchdict.get('year')
if year:
year=int(year[:-1])
if 2004<year<=CurrentYear:
if year==2006:
return {'year': year, 'edition':u"1<sup>ère</sup>" }
else:
edition = year - 2005
return {'year': year, 'edition':u"%d<sup>ème</sup>" % edition }
else:
raise HTTPNotFound()
return {'year': CurrentYear, 'edition':u"9<sup>ème</sup>"}



@view_config(route_name='programme', renderer="jm2l:templates/Public/Programme.mako") @view_config(route_name='programme', renderer="jm2l:templates/Public/Programme.mako")
def programme(request): def programme(request):
@@ -250,7 +281,9 @@ def edit_presse(request):
return MainTab return MainTab


@view_config(route_name='plan', renderer="jm2l:templates/Public/Plan.mako") @view_config(route_name='plan', renderer="jm2l:templates/Public/Plan.mako")
def static_plan(request):
def static_plan(request):
session = request.session
session['year'] = 2015
MainTab = {'plan':'active', "logged_in":request.authenticated_userid } MainTab = {'plan':'active', "logged_in":request.authenticated_userid }
return MainTab return MainTab


@@ -850,7 +883,7 @@ def change_year(request):
session = request.session session = request.session
if year>-1: if year>-1:
session['year'] = year session['year'] = year
return HTTPFound(location='/%s/le-programme' % year)
return HTTPFound(location='/%s/' % year)
return HTTPFound(location=request.route_url('home')) return HTTPFound(location=request.route_url('home'))


@view_config(route_name='pict_user', renderer="jm2l:templates/Profil/pict_user.mako") @view_config(route_name='pict_user', renderer="jm2l:templates/Profil/pict_user.mako")


Loading…
Cancel
Save