Le repo des sources pour le site web des JM2L
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

199 lines
8.3 KiB

  1. <%inherit file="jm2l:templates/layout.mako"/>
  2. <%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
  3. <%def name="jsAddOn()">
  4. <script src="${request.static_url('jm2l:static/select2.js')}"></script>
  5. <script src="${request.static_url('jm2l:static/jquery-ui/jquery-ui.min.js')}"></script>
  6. <script src="${request.static_url('jm2l:static/repeatable-fields.js')}"></script>
  7. <script src="/static/third-party/ckeditor/ckeditor.js"></script>
  8. </%def>
  9. <%def name="cssAddOn()">
  10. <link rel="stylesheet" href="/static/select2.css" type="text/css" media="screen" />
  11. <link rel="stylesheet" href="/static/css/jquery.fileupload.css">
  12. <link rel="stylesheet" href="/static/css/jquery.fileupload-ui.css">
  13. <!-- CSS adjustments for browsers with JavaScript disabled -->
  14. <noscript><link rel="stylesheet" href="/static/css/jquery.fileupload-noscript.css"></noscript>
  15. <noscript><link rel="stylesheet" href="/static/css/jquery.fileupload-ui-noscript.css"></noscript>
  16. </%def>
  17. <a class="pull-right" href="/categorie/entity">Editer les catégories</a>
  18. <br>
  19. <form action="" method="POST">
  20. % if 'uid' in form._fields:
  21. ${form.uid}
  22. %endif
  23. <%
  24. DicForm = {
  25. 'name': {'PlaceHolder':u"Nom", 'ContainerStyle':"padding-right:5px;float:left;width:35em;", "FieldStyle":"width:31em;"},
  26. 'tiers_type': {'PlaceHolder':u"Nature", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:15em;"},
  27. 'description': {'PlaceHolder':u"Description", 'ContainerStyle':"padding-right:5px;padding-top: 20px;", "FieldStyle":"width:90%;min-height:150px;" },
  28. 'website': {'PlaceHolder':u"Site web", 'ContainerStyle':"padding-right:15px;", 'ContainerStyle':"width:30em;"},
  29. 'membership': {'Ignore':True}
  30. }
  31. %>
  32. ${helpers.DisplayForm(form, DicForm)}
  33. % if 'uid' in form._fields:
  34. <fieldset>
  35. <legend>Acteurs</legend>
  36. <div class="repeat">
  37. <table class="wrapper" width="100%">
  38. <thead>
  39. <tr class="row">
  40. <th style="width:5em;text-align:center;">Année</th>
  41. <th>Personne</th>
  42. <th style="width:22em;">Rôle</th>
  43. <th style="width:5em;">Action</th>
  44. </tr>
  45. </thead>
  46. <tbody class="container">
  47. <tr class="row template" style="line-height:2.2em;">
  48. <td><span class="move btn btn-mini btn-info">Move</span></td>
  49. <td>
  50. <select class="form-control" style="width:5em;" name="membership-{{row-count-placeholder}}-year_uid"
  51. id="membership-{{row-count-placeholder}}-year_uid">
  52. % for year in range(2015, 2005, -1):
  53. <%
  54. if year in [2014]:
  55. continue
  56. %> \
  57. <option value="${year}">${year}</option>
  58. %endfor
  59. </select>
  60. </td>
  61. <td style="text-align: center;">
  62. <input type="hidden" style="width:20em;" class="form-control" name="membership-{{row-count-placeholder}}-user_uid"
  63. id="membership-{{row-count-placeholder}}-user_uid" />
  64. </td>
  65. <td style="text-align: center;">
  66. <select class="form-control" style="width:20em;" name="membership-{{row-count-placeholder}}-role"
  67. id="membership-{{row-count-placeholder}}-role">
  68. % for opt in UserOptions:
  69. <option value="${opt.uid}">${opt.exch_subtype}</option>
  70. % endfor
  71. </select>
  72. </td>
  73. <td>
  74. <span class="remove btn btn-mini btn-danger">
  75. <i class="icon-remove-sign icon-white"></i> Suppr.
  76. </span>
  77. </td>
  78. </tr>
  79. % for num, dicdata in enumerate(form._fields.get("membership").data):
  80. <tr class="row" style="padding:5px;line-height:2.2em;">
  81. <td><span class="move btn btn-mini btn-info">Move</span></td>
  82. <td style="text-align:center;">
  83. <input type="hidden" class="form-control" name="membership-${num}-year_uid"
  84. value="${dicdata.get('year_uid')}" style="width:4em;" />
  85. ${dicdata.get('year_uid')}
  86. </td>
  87. <td style="text-align:center;">
  88. <input type="hidden" class="form-control" name="membership-${num}-user_uid"
  89. value="${dicdata.get('user_uid')}" style="width:4em;" />
  90. <%
  91. tmpUser = DBUser.by_id(dicdata.get('user_uid'))
  92. %>
  93. % if tmpUser:
  94. ${tmpUser.prenom} ${tmpUser.nom}
  95. % endif
  96. </td>
  97. <td style="text-align:center;">
  98. <input type="hidden" class="form-control" name="membership-${num}-role"
  99. value="${dicdata.get('role')}" />
  100. <i>${dicdata.get('role', 'Aucun')}</i>
  101. </td>
  102. <td>
  103. <span class="remove btn btn-mini btn-danger">
  104. <i class="icon-remove-sign icon-white"></i> Suppr.
  105. </span>
  106. </td>
  107. </tr>
  108. % endfor
  109. </tbody>
  110. <tfoot>
  111. <tr>
  112. <td colspan="5" style="text-align:center;line-height: 3em;">
  113. <span class="add btn btn-mini btn-primary"><i class="icon-plus-sign icon-white"></i> Ajouter</span>
  114. </td>
  115. </tr>
  116. </tfoot>
  117. </table>
  118. </div>
  119. </fieldset>
  120. % endif
  121. % if 'uid' in form._fields:
  122. <button type="submit">Enregistrer</button>
  123. % else:
  124. <button type="submit">Proposer</button>
  125. % endif
  126. </form>
  127. % if 'uid' in form._fields:
  128. % if request.user:
  129. <fieldset>
  130. <legend>Support liés</legend>
  131. <div style="float:right;width:60%">
  132. <p> En plus de vos support de présentation classique.
  133. Pensez aussi aux affiches, aux flyers, aux stickers,
  134. au bulletin d'adhésion à une association, à la documentation technique...
  135. Tous ce qui peut être utile, de près ou de loin à la promotion de votre évenement.
  136. </p>
  137. </div>
  138. ${helpers.uploader("tiers", form.uid.data, u"fichiers" )}
  139. </fieldset>
  140. % else:
  141. <br>NB: Vous devez être identifié afin de proposer du contenu.
  142. % endif
  143. % else:
  144. <br>NB: Vous devez proposer votre entité avant de pouvoir
  145. téléverser des fichiers la concernant.
  146. % endif
  147. <br>
  148. <br>
  149. <br>
  150. % if 'uid' in form._fields:
  151. ${helpers.uploader_js()}
  152. % endif
  153. <script type="text/javascript">
  154. var year_data = Array();
  155. var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } );
  156. for (var i=2005;i<2015;i++)
  157. { year_data[i.toString()] = i.toString(); };
  158. $("#tiers_type").select2({});
  159. function show_editor() {
  160. if (editor) {
  161. editor.destroy();
  162. editor=null;
  163. } else
  164. editor = CKEDITOR.replace('description');
  165. }
  166. jQuery(function() {
  167. jQuery('.repeat').each(function() {
  168. jQuery(this).repeatable_fields(
  169. {
  170. is_ready: function(container, therow) {
  171. var numrow=$(container).attr('data-rf-row-count');
  172. $("#membership-"+ (numrow-1) +"-user_uid").select2(
  173. {
  174. placeholder: 'Entrez ici un Nom ou un Prénom',
  175. minimumInputLength: 2, allowClear: true,
  176. ajax: {
  177. quietMillis: 250, url: "/json-users", dataType: 'json',
  178. data: function (term, page) {
  179. return { pageSize: 8, pageNum: page, searchTerm: term };
  180. },
  181. results: function (data, page) {
  182. var more = (page * 8) < data.Total;
  183. return { results: data.Results, more: more };
  184. }
  185. }
  186. });
  187. $("#membership-"+ (numrow-1) +"-year_uid").select2({});
  188. $("#membership-"+ (numrow-1) +"-role").select2({});
  189. }
  190. });
  191. });
  192. });
  193. </script>