@@ -70,6 +70,7 @@ def main(global_config, **settings): | |||||
# HTML Routes - Public | # HTML Routes - Public | ||||
config.add_route('home', '/{year:(\d+/)?}') | config.add_route('home', '/{year:(\d+/)?}') | ||||
config.add_route('edit_index', '/{year:\d+}/edit') | |||||
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') | ||||
@@ -75,6 +75,11 @@ class DossPresse(MyBaseForm): | |||||
doss_presse = TextAreaField('Dossier de Presse', [validators.optional(), validators.Length(max=1000000)], | doss_presse = TextAreaField('Dossier de Presse', [validators.optional(), validators.Length(max=1000000)], | ||||
filters=[strip_filter]) | filters=[strip_filter]) | ||||
class IndexForm(MyBaseForm): | |||||
year_uid = HiddenField() | |||||
description = TextAreaField('Index', [validators.optional(), validators.Length(max=1000000)], | |||||
filters=[strip_filter]) | |||||
class TiersMember(MyBaseForm): | class TiersMember(MyBaseForm): | ||||
class Meta: | class Meta: | ||||
csrf = False | csrf = False | ||||
@@ -205,8 +205,8 @@ a { | |||||
border: 1px solid #d4d4d4; | border: 1px solid #d4d4d4; | ||||
} | } | ||||
.ShowEntities td img { | .ShowEntities td img { | ||||
width: 60px; | |||||
height: 60px; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | } | ||||
.ShowEntities td:hover { | .ShowEntities td:hover { | ||||
@@ -49,8 +49,16 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
% else: | % else: | ||||
% if request.user.Staff: | |||||
<a href="/${year}/edit">Editer cette page</a> - | |||||
% endif | |||||
<a href="/${year}/le-programme">Le programme des évenements ${year}</a> | <a href="/${year}/le-programme">Le programme des évenements ${year}</a> | ||||
% endif | % endif | ||||
<div class="row-fluid"> | |||||
<div class="span10 offset1"> | |||||
${ content | n } | |||||
</div> | |||||
</div> | |||||
<div class="row-fluid"> | <div class="row-fluid"> | ||||
<div class="span12"> | <div class="span12"> | ||||
@@ -0,0 +1,30 @@ | |||||
<%inherit file="jm2l:templates/layout.mako"/> | |||||
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | |||||
<%def name="jsAddOn()"> | |||||
<script src="/js/jm2l.js"></script> | |||||
<script src="/vendor/ckeditor/ckeditor.js"></script> | |||||
</%def> | |||||
<%def name="cssAddOn()"> | |||||
<link rel="stylesheet" href="/css/jm2l.css" /> | |||||
<!-- CSS adjustments for browsers with JavaScript disabled --> | |||||
</%def> | |||||
<h3 class="page-title">Accueil ${DisplayYear}</h3> | |||||
<% | |||||
DicForm = { | |||||
'year_uid': {'PlaceHolder':u"Mon Nom", "FieldStyle":"width:16em;", 'ContainerStyle':"float:left;"}, | |||||
'description': {'PlaceHolder':u"Description", "FieldStyle":"width:95%;min-height:600px;", "ckeditor":"1"}, | |||||
} | |||||
%> | |||||
<div> | |||||
<form action="" method="POST"> | |||||
${helpers.DisplayForm(form, DicForm)} | |||||
<br> | |||||
<center> | |||||
<button type="submit" class="btn btn-large btn-primary" /> | |||||
<i class="icon-ok icon-white"></i> Enregistrer | |||||
</button> | |||||
</center> | |||||
</form> | |||||
</div> | |||||
<br> |
@@ -22,13 +22,15 @@ DicForm = { | |||||
<div> | <div> | ||||
<form action="" method="POST"> | <form action="" method="POST"> | ||||
${helpers.DisplayForm(form, DicForm)} | ${helpers.DisplayForm(form, DicForm)} | ||||
<input class="btn btn-primary" type="submit" value="Enregistrer"> | |||||
<br> | |||||
<center> | |||||
<button type="submit" class="btn btn-large btn-primary" /> | |||||
<i class="icon-ok icon-white"></i> Enregistrer | |||||
</button> | |||||
</center> | |||||
</form> | </form> | ||||
</div> | </div> | ||||
<center> | |||||
${helpers.uploader("presse", form.year_uid.data, u"Fichier" )} | ${helpers.uploader("presse", form.year_uid.data, u"Fichier" )} | ||||
<br><br> | |||||
<script> | |||||
## var editor = CKEDITOR.replace( 'doss_presse', { autoGrow_onStartup: true, language: 'fr' } ); | |||||
</script> | |||||
##${helpers.uploader_js()} | |||||
</center> |
@@ -230,18 +230,32 @@ def index_page(request): | |||||
year = request.matchdict.get('year') | year = request.matchdict.get('year') | ||||
if year: | if year: | ||||
year=int(year[:-1]) | year=int(year[:-1]) | ||||
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() | |||||
if content: | |||||
content = content.description | |||||
if 2004<year<=CurrentYear: | if 2004<year<=CurrentYear: | ||||
if year==2006: | if year==2006: | ||||
return {'year': year, 'edition':u"1<sup>ère</sup>" } | |||||
return {'year': year, 'content':content, 'edition':u"1<sup>ère</sup>" } | |||||
elif year==2015: | elif year==2015: | ||||
return {'year': year, 'edition':u"9<sup>ème</sup>" } | |||||
return {'year': year, 'content':content, 'edition':u"9<sup>ème</sup>" } | |||||
else: | else: | ||||
edition = year - 2005 | edition = year - 2005 | ||||
return {'year': year, 'edition':u"%d<sup>ème</sup>" % edition } | |||||
return {'year': year, 'content':content, 'edition':u"%d<sup>ème</sup>" % edition } | |||||
else: | else: | ||||
raise HTTPNotFound() | raise HTTPNotFound() | ||||
return {'year': CurrentYear, 'edition':u"9<sup>ème</sup>"} | return {'year': CurrentYear, 'edition':u"9<sup>ème</sup>"} | ||||
@view_config(route_name='edit_index', renderer="jm2l:templates/Staff/EditIndex.mako") | |||||
def edit_index(request): | |||||
year = int(request.matchdict.get('year', None)) | |||||
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() | |||||
form = IndexForm(request.POST, content, meta={'csrf_context': request.session}) | |||||
if request.method == 'POST' and form.validate(): | |||||
form.populate_obj(content) | |||||
return HTTPFound(location=request.route_url('home', year="%d/" % year)) | |||||
MainTab = {'home':'active', "logged_in":request.authenticated_userid, | |||||
'form':form, 'DisplayYear':year} | |||||
return MainTab | |||||
@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): | ||||