瀏覽代碼

Set Home page for all years

Added video on Home
change navigation bar buttons
master
tr4ck3ur des JM2L 9 年之前
父節點
當前提交
2c8bd43f56
共有 5 個文件被更改,包括 74 次插入57 次删除
  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 查看文件

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

# 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('edit_presse', '/{year:\d+}/dossier-de-presse/edit')
config.add_route('programme', '/{year:\d+}/le-programme')


+ 6
- 20
jm2l/templates/NewIndex.mako 查看文件

@@ -4,7 +4,7 @@
<script>
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"}}};
timeline.init(c, "/2015/timeline-json");
timeline.init(c, "/${year}/timeline-json");
</script>
</%def>
<%def name="cssAddOn()">
@@ -20,8 +20,9 @@
}
</style>
</%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>
% if year=='2015':
<div class="row-fluid">
<div class="span4 offset1">
<blockquote>
@@ -31,11 +32,8 @@
Le thème de cette année sera « Do It Yourself » ou « Faîtes le vous-même » :
<ul class="enum">
<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>Culture libre</li>
## <li>Communautés du libre</li>
</ul>
</div>
<div class="span4 offset1">
@@ -50,21 +48,9 @@
</p>
</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="span12">


+ 2
- 1
jm2l/templates/helpers.mako 查看文件

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

+ 13
- 16
jm2l/templates/layout.mako 查看文件

@@ -37,9 +37,8 @@ ${helpers.uploader_js()}
<div id="wrap">
<div id="top">
% 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>
</a>
@@ -98,19 +97,18 @@ ${helpers.uploader_js()}
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<div class="nav pull-left">

<div class="nav pull-right">
<div class="btn-group">
<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">
% 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>
% endif
% endfor
</ul>
</div>

<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
% if request.user:
@@ -138,18 +136,17 @@ ${helpers.uploader_js()}
## </li>
</ul>
</div>
</div>
</div>
<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:
<li class="${participer or ''}"><a href="/MesJM2L">Mes JM2L</a></li>
% else:
<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>

</div>


+ 52
- 19
jm2l/views.py 查看文件

@@ -170,9 +170,17 @@ def JSON_TimeLine_Request(request):
.filter("strftime('%d', start_time) = :dow").params(dow=Day.day)\
.order_by(Event.start_time)
ListEv = []
#ListEv = []
for ev in Events:
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( {
#"uid":"%d/%d" % ( year, ev.uid ),
"headline":ev.name,
@@ -182,32 +190,55 @@ def JSON_TimeLine_Request(request):
"tags":ev.Salle and (ev.Salle.name or "unk") ,
#"status":ev.event_type,
"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":"",
"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
return { 'timeline':DicResult }

## =-=- Here, We handle HTTP requests - Public Part -=-=
@view_config(route_name='home', renderer="jm2l:templates/NewIndex.mako")
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")
def programme(request):
@@ -250,7 +281,9 @@ def edit_presse(request):
return MainTab

@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 }
return MainTab

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

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


Loading…
取消
儲存