|
- <%inherit file="jm2l:templates/layout.mako"/>
- <%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
- <%def name="cssAddOn()">
- <link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" />
- <link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css">
- <link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui.css">
- <!-- CSS adjustments for browsers with JavaScript disabled -->
- <noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-noscript.css"></noscript>
- <noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui-noscript.css"></noscript>
- </%def>
- <a class="pull-right" href="/categorie/entity">Editer les catégories</a>
- <br>
- <form action="" method="POST">
- % if 'uid' in form._fields:
- ${form.uid}
- %endif
- <%
- DicForm = {
- 'name': {'PlaceHolder':u"Nom", 'ContainerStyle':"padding-right:5px;float:left;width:35em;", "FieldStyle":"width:31em;"},
- 'tiers_type': {'PlaceHolder':u"Nature", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:15em;"},
- 'description': {'PlaceHolder':u"Description", 'ContainerStyle':"padding-right:5px;padding-top: 20px;", "FieldStyle":"width:90%;min-height:150px;" },
- 'website': {'PlaceHolder':u"Site web", 'ContainerStyle':"padding-right:15px;", 'ContainerStyle':"width:30em;"},
- 'membership': {'Ignore':True}
- }
- %>
-
- ${helpers.DisplayForm(form, DicForm)}
-
- % if 'uid' in form._fields:
- <fieldset>
- <legend>Acteurs</legend>
- <div class="repeat">
- <table class="wrapper" width="100%">
- <thead>
- <tr class="row">
- <th style="width:5em;text-align:center;">Année</th>
- <th>Personne</th>
- <th style="width:22em;">Rôle</th>
- <th style="width:5em;">Action</th>
- </tr>
- </thead>
- <tbody class="container">
- <tr class="row template" style="line-height:2.2em;">
- <td><span class="move btn btn-mini btn-info">Move</span></td>
- <td>
- <select class="form-control" style="width:5em;" name="membership-{{row-count-placeholder}}-year_uid"
- id="membership-{{row-count-placeholder}}-year_uid">
- % for year in range(2015, 2005, -1):
- <%
- if year in [2014]:
- continue
- %> \
- <option value="${year}">${year}</option>
- %endfor
- </select>
- </td>
- <td style="text-align: center;">
- <input type="hidden" style="width:20em;" class="form-control" name="membership-{{row-count-placeholder}}-user_uid"
- id="membership-{{row-count-placeholder}}-user_uid" />
- </td>
- <td style="text-align: center;">
- <select class="form-control" style="width:20em;" name="membership-{{row-count-placeholder}}-role"
- id="membership-{{row-count-placeholder}}-role">
- % for opt in UserOptions:
- <option value="${opt.uid}">${opt.exch_subtype}</option>
- % endfor
- </select>
- </td>
- <td>
- <span class="remove btn btn-mini btn-danger">
- <i class="icon-remove-sign icon-white"></i> Suppr.
- </span>
- </td>
- </tr>
- % for num, dicdata in enumerate(form._fields.get("membership").data):
- <tr class="row" style="padding:5px;line-height:2.2em;">
- <td><span class="move btn btn-mini btn-info">Move</span></td>
- <td style="text-align:center;">
- <input type="hidden" class="form-control" name="membership-${num}-year_uid"
- value="${dicdata.get('year_uid')}" style="width:4em;" />
- ${dicdata.get('year_uid')}
- </td>
- <td style="text-align:center;">
- <input type="hidden" class="form-control" name="membership-${num}-user_uid"
- value="${dicdata.get('user_uid')}" style="width:4em;" />
- <%
- tmpUser = DBUser.by_id(dicdata.get('user_uid'))
- %>
- % if tmpUser:
- ${tmpUser.prenom} ${tmpUser.nom}
- % endif
- </td>
- <td style="text-align:center;">
- <input type="hidden" class="form-control" name="membership-${num}-role"
- value="${dicdata.get('role')}" />
- <i>${dicdata.get('role', 'Aucun')}</i>
- </td>
- <td>
- <span class="remove btn btn-mini btn-danger">
- <i class="icon-remove-sign icon-white"></i> Suppr.
- </span>
- </td>
- </tr>
- % endfor
- </tbody>
- <tfoot>
- <tr>
- <td colspan="5" style="text-align:center;line-height: 3em;">
- <span class="add btn btn-mini btn-primary"><i class="icon-plus-sign icon-white"></i> Ajouter</span>
- </td>
- </tr>
- </tfoot>
- </table>
- </div>
- </fieldset>
- % endif
- % if 'uid' in form._fields:
- <button type="submit">Enregistrer</button>
- % else:
- <button type="submit">Proposer</button>
- % endif
- </form>
- % if 'uid' in form._fields:
- % if request.user:
- <fieldset>
- <legend>Support liés</legend>
- <div style="float:right;width:60%">
- <p> En plus de vos support de présentation classique.
- Pensez aussi aux affiches, aux flyers, aux stickers,
- au bulletin d'adhésion à une association, à la documentation technique...
- Tous ce qui peut être utile, de près ou de loin à la promotion de votre évenement.
- </p>
- </div>
- ${helpers.uploader("tiers", form.uid.data, u"fichiers" )}
- </fieldset>
- % else:
- <br>NB: Vous devez être identifié afin de proposer du contenu.
- % endif
- % else:
- <br>NB: Vous devez proposer votre entité avant de pouvoir
- téléverser des fichiers la concernant.
- % endif
- <br>
- <br>
- <br>
-
- ##% if 'uid' in form._fields:
- ## ${helpers.uploader_js()}
- ##% endif
-
- <%def name="jsAddOn()">
- <script src="/vendor/select2/js/select2.js"></script>
- <script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script>
- <script src="/vendor/ckeditor/ckeditor.js"></script>
- <script type="text/javascript">
- var year_data = Array();
- ##var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } );
- for (var i=2005;i<2015;i++)
- { year_data[i.toString()] = i.toString(); };
-
- $("#tiers_type").select2({});
-
- function show_editor() {
- if (editor) {
- editor.destroy();
- editor=null;
- } else
- editor = CKEDITOR.replace('description');
- }
-
- jQuery(function() {
- jQuery('.repeat').each(function() {
- jQuery(this).repeatable_fields(
- {
- is_ready: function(container, therow) {
- var numrow=$(container).attr('data-rf-row-count');
- $("#membership-"+ (numrow-1) +"-user_uid").select2(
- {
- placeholder: 'Entrez ici un Nom ou un Prénom',
- minimumInputLength: 2, allowClear: true,
- ajax: {
- quietMillis: 250, url: "/json-users", dataType: 'json',
- data: function (term, page) {
- return { pageSize: 8, pageNum: page, searchTerm: term };
- },
- results: function (data, page) {
- var more = (page * 8) < data.Total;
- return { results: data.Results, more: more };
- }
- }
- });
- $("#membership-"+ (numrow-1) +"-year_uid").select2({});
- $("#membership-"+ (numrow-1) +"-role").select2({});
- }
- });
- });
- });
- </script>
- </%def>
|