Le repo des sources pour le site web des JM2L
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

345 satır
14 KiB

  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. <div class="row-fluid">
  12. <div class="span10 offset1">
  13. % if 'uid' in form._fields.keys():
  14. <a class="btn btn-danger btn-mini pull-right" onclick="return confirm_click();" href="${request.route_path('delete_entity', action='delete_entity', entity_id=form.uid.data)}">
  15. <i class="icon-remove icon-white"></i> Supprimer cette entit&eacute;e
  16. </a>
  17. %endif
  18. <a class="pull-right" href="/categorie/entity">Editer les catégories</a>
  19. <br>
  20. <form action="" method="POST">
  21. % if 'uid' in form._fields:
  22. ${form.uid}
  23. %endif
  24. <%
  25. DicForm = {
  26. 'name': {'PlaceHolder':u"Nom", 'ContainerStyle':"padding-right:5px;float:left;width:35em;", "FieldStyle":"width:31em;"},
  27. 'tiers_type': {'PlaceHolder':u"Nature", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:15em;"},
  28. 'description': {'PlaceHolder':u"Description", 'ContainerStyle':"padding-right:5px;padding-top: 20px;", "FieldStyle":"width:90%;min-height:150px;" },
  29. 'website': {'PlaceHolder':u"Site web", 'ContainerStyle':"padding-right:15px;padding-top: 20px;", 'FieldStyle':"width:30em;"},
  30. 'membership': {'Ignore':True },
  31. 'roles': {'Ignore':True }
  32. }
  33. %>
  34. ${helpers.DisplayForm(form, DicForm)}
  35. % if 'uid' in form._fields:
  36. <fieldset>
  37. <legend>Ses acteurs</legend>
  38. <div class="repeat">
  39. <table class="wrapper table" width="100%">
  40. <thead>
  41. <tr class="row">
  42. <th style="width:5em;text-align:center;">Année</th>
  43. <th style="width:22em;text-align:center;">Personne</th>
  44. <th style="width:22em;text-align:center;">Rôle</th>
  45. <th style="width:10em;text-align:center;">Action</th>
  46. </tr>
  47. </thead>
  48. <tbody class="container" id="tab_member">
  49. <tr class="row template" style="line-height:2.2em;">
  50. <td>
  51. <select class="form-control" style="width:5em;" name="membership-{{row-count-placeholder}}-year_uid"
  52. id="membership-{{row-count-placeholder}}-year_uid">
  53. % for year in range(CurrentYear, 2005, -1):
  54. <%
  55. if year in [2014]:
  56. continue
  57. %> \
  58. <option value="${year}">${year}</option>
  59. %endfor
  60. </select>
  61. </td>
  62. <td style="text-align: center;">
  63. <input type="hidden" style="width:20em;" class="form-control" name="membership-{{row-count-placeholder}}-user_uid"
  64. id="membership-{{row-count-placeholder}}-user_uid" />
  65. </td>
  66. <td style="text-align: center;">
  67. <input type="text" class="form-control" name="membership-{{row-count-placeholder}}-role" />
  68. </td>
  69. <td>
  70. <span class="remove btn btn-mini btn-danger">
  71. <i class="icon-remove-sign icon-white"></i> Suppr.
  72. </span>
  73. </td>
  74. </tr>
  75. % for num, dicdata in enumerate(form._fields.get("membership").data):
  76. <tr class="row" style="padding:5px;line-height:2.2em;">
  77. <td style="text-align:center;">
  78. <input type="hidden" class="form-control" name="membership-${num}-year_uid"
  79. id="membership-${num}-year_uid"
  80. value="${dicdata.get('year_uid')}" style="width:4em;" />
  81. <div id="content-member-${num}-year_uid">${dicdata.get('year_uid')}</div>
  82. </td>
  83. <td style="text-align:center;">
  84. <input type="hidden" class="form-control" name="membership-${num}-user_uid"
  85. id="membership-${num}-user_uid" value="${dicdata.get('user_uid')}" style="width:4em;" />
  86. <%
  87. tmpUser = DBUser.by_id(dicdata.get('user_uid'))
  88. %>
  89. % if tmpUser:
  90. <div id="content-member-${num}-user_uid">${tmpUser.prenom} ${tmpUser.nom}</div>
  91. % endif
  92. </td>
  93. <td style="text-align:center;">
  94. <input type="text" class="form-control" name="membership-${num}-role" style="display:none;width:95%;"
  95. id="membership-${num}-role"
  96. value="${dicdata.get('role', 'Aucun')}" />
  97. <div id="content-member-${num}-role"><i>${dicdata.get('role', 'Aucun')}</i></div>
  98. </td>
  99. <td>
  100. <a class="btn btn-mini btn-primary" href="#" onclick="return edit_member(this, ${num});">
  101. <i class="icon-pencil icon-white"></i> Edit.
  102. </a>
  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. <fieldset>
  123. <legend>Ses rôles</legend>
  124. <div class="repeat">
  125. <table class="wrapper table" width="100%">
  126. <thead>
  127. <tr class="row">
  128. <th style="width:5em;text-align:center;">Année</th>
  129. <th style="width:22em;text-align:center;">Rôle</th>
  130. <th style="width:10em;text-align:center;">Action</th>
  131. </tr>
  132. </thead>
  133. <tbody class="container" id="tab_role">
  134. <tr class="row template" style="line-height:2.2em;">
  135. <td>
  136. <select class="form-control" style="width:5em;" name="roles-{{row-count-placeholder}}-year_uid"
  137. id="roles-{{row-count-placeholder}}-year_uid">
  138. % for year in range(CurrentYear, 2005, -1):
  139. <%
  140. if year in [2014]:
  141. continue
  142. %> \
  143. <option value="${year}">${year}</option>
  144. %endfor
  145. </select>
  146. </td>
  147. <td style="text-align: center;">
  148. <select class="form-control" name="roles-{{row-count-placeholder}}-tiers_role" />
  149. <option value="Exposant">Exposant</option>
  150. <option value="Sponsor">Sponsor</option>
  151. <option value="Donateur">Donateur</option>
  152. </select>
  153. </td>
  154. <td>
  155. <span class="remove btn btn-mini btn-danger">
  156. <i class="icon-remove-sign icon-white"></i> Suppr.
  157. </span>
  158. </td>
  159. </tr>
  160. % for num, dicdata in enumerate(form._fields.get("roles").data):
  161. <tr class="row" style="padding:5px;line-height:2.2em;">
  162. <td style="text-align:center;">
  163. <input type="hidden" class="form-control" name="roles-${num}-year_uid"
  164. id="roles-${num}-year_uid"
  165. value="${dicdata.get('year_uid')}" style="width:4em;" />
  166. <div id="content-role-${num}-year_uid">${dicdata.get('year_uid')}</div>
  167. </td>
  168. <td style="text-align:center;">
  169. <input type="hidden" class="form-control" name="roles-${num}-tiers_role"
  170. id="roles-${num}-tiers_role"
  171. value="${dicdata.get('tiers_role', 'Aucun')}" />
  172. <div id="content-role-${num}-tiers_role"><i>${dicdata.get('tiers_role', 'Aucun')}</i></div>
  173. </td>
  174. <td>
  175. <a class="btn btn-mini btn-primary" href="#" onclick="return edit_role(this, ${num});">
  176. <i class="icon-pencil icon-white"></i> Edit.
  177. </a>
  178. <span class="remove btn btn-mini btn-danger">
  179. <i class="icon-remove-sign icon-white"></i> Suppr.
  180. </span>
  181. </td>
  182. </tr>
  183. % endfor
  184. </tbody>
  185. <tfoot>
  186. <tr>
  187. <td colspan="5" style="text-align:center;line-height: 3em;">
  188. <span class="add btn btn-mini btn-primary"><i class="icon-plus-sign icon-white"></i> Ajouter</span>
  189. </td>
  190. </tr>
  191. </tfoot>
  192. </table>
  193. </div>
  194. </fieldset>
  195. % endif
  196. <br>
  197. <div class="center">
  198. <button type="submit" class="btn btn-large btn-primary" />
  199. % if 'uid' in form._fields:
  200. <i class="icon-ok icon-white"></i> Mettre &agrave; jour
  201. % else:
  202. <i class="icon-ok icon-white"></i> Proposer
  203. </button>
  204. % endif
  205. </div>
  206. </form>
  207. % if 'uid' in form._fields:
  208. % if request.user:
  209. <fieldset>
  210. <legend>Les supports liés</legend>
  211. <div style="float:right;width:60%">
  212. <p> En plus de vos supports de présentation classique.
  213. Pensez aussi aux affiches, aux flyers, aux stickers,
  214. au bulletin d'adhésion à une association, à la documentation technique...
  215. Tout ce qui peut être utile, de près ou de loin à sa promotion.
  216. </p>
  217. </div>
  218. ${helpers.uploader("tiers", form.uid.data, u"fichiers" )}
  219. </fieldset>
  220. % else:
  221. <br>NB: Vous devez être identifié afin de proposer du contenu.
  222. % endif
  223. % else:
  224. <br>NB: Vous devez proposer votre entité avant de pouvoir
  225. téléverser des fichiers la concernant.
  226. % endif
  227. </div>
  228. </div>
  229. <%def name="jsAddOn()">
  230. <script src="/vendor/select2/js/select2.js"></script>
  231. <script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script>
  232. <script src="/vendor/ckeditor/ckeditor.js"></script>
  233. <script type="text/javascript">
  234. var year_data = Array();
  235. var role_data = Array();
  236. var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } );
  237. for (var i=2005;i<2016;i++)
  238. year_data.push( {id:i, text:i.toString()});
  239. role_data.push({id:'Exposant', text:'Exposant'});
  240. role_data.push({id:'Sponsor', text:'Sponsor'});
  241. role_data.push({id:'Donateur', text:'Donateur'});
  242. $("#tiers_type").select2({});
  243. function show_editor() {
  244. if (editor) {
  245. editor.destroy();
  246. editor=null;
  247. } else
  248. editor = CKEDITOR.replace('description');
  249. }
  250. jQuery(function() {
  251. jQuery('.repeat').each(function() {
  252. jQuery(this).repeatable_fields(
  253. {
  254. is_ready: function(container, therow) {
  255. var numrow=$(container).attr('data-rf-row-count');
  256. if ($(container).attr("id")=="tab_member") {
  257. $("#membership-"+ (numrow-1) +"-user_uid").select2(
  258. {
  259. placeholder: 'Entrez ici un Nom ou un Prénom',
  260. minimumInputLength: 2, allowClear: true,
  261. ajax: {
  262. quietMillis: 250, url: "/json-users", dataType: 'json',
  263. data: function (term, page) {
  264. return { pageSize: 8, pageNum: page, searchTerm: term };
  265. },
  266. results: function (data, page) {
  267. var more = (page * 8) < data.Total;
  268. return { results: data.Results, more: more };
  269. }
  270. }
  271. });
  272. $("#membership-"+ (numrow-1) +"-year_uid").select2({});
  273. }
  274. if ($(container).attr("id")=="tab_role") {
  275. $("#roles-"+ (numrow-1) +"-year_uid").select2({});
  276. $("#roles-"+ (numrow-1) +"-tiers_role").select2({});
  277. }
  278. }
  279. });
  280. });
  281. });
  282. function edit_member(srcobj, num) {
  283. $(srcobj).addClass("disabled");
  284. $("#content-member-"+ num +"-year_uid").hide();
  285. $("#membership-"+ num +"-year_uid").select2({
  286. width:'80px',
  287. data: year_data
  288. });
  289. //$('select').select2();
  290. $("#content-member-"+ num +"-user_uid").hide();
  291. $("#membership-"+ num +"-user_uid").select2(
  292. {
  293. width:'250px',
  294. placeholder: 'Entrez ici un Nom ou un Prénom',
  295. minimumInputLength: 2, allowClear: true,
  296. initSelection: function(element, callback){
  297. callback({id: element.val(), text: $("#content-member-"+ num +"-user_uid").text() })
  298. },
  299. ajax: {
  300. quietMillis: 250, url: "/json-users", dataType: 'json',
  301. data: function (term, page) {
  302. return { pageSize: 8, pageNum: page, searchTerm: term };
  303. },
  304. results: function (data, page) {
  305. var more = (page * 8) < data.Total;
  306. return { results: data.Results, more: more };
  307. }
  308. }
  309. });
  310. $("#content-member-"+ num +"-role").hide();
  311. $("#membership-"+ num +"-role").show();
  312. return false;
  313. };
  314. function edit_role(srcobj, num) {
  315. $(srcobj).addClass("disabled");
  316. $("#roles-"+ num +"-year_uid").select2({
  317. width:'80px',
  318. data: year_data
  319. });
  320. $("#roles-"+ num +"-tiers_role").select2({
  321. width:'100%',
  322. data: role_data
  323. });
  324. $("#content-role-"+ num +"-year_uid").hide();
  325. $("#content-role-"+ num +"-tiers_role").hide();
  326. $("#roles-"+ num +"-tiers_role").show();
  327. return false;
  328. };
  329. </script>
  330. </%def>