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.

edit_tiers.mako 8.3 KiB

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