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.
 
 
 
 
 

117 lines
4.6 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/jquery-ui/jquery-ui.min.js')}"></script>
  5. <script src="${request.static_url('jm2l:static/repeatable-fields.js')}"></script>
  6. </%def>
  7. <h2>Gestion des catégories pour les entités</h2>
  8. <form method="post" action="#">
  9. <div class="repeat">
  10. <table class="table table-striped table-bordered">
  11. <tbody data-rf-row-count="${len(TiersOpt.get_entity_type())}" class="container ui-sortable">
  12. <tr style="display: none;" class="template row">
  13. ##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
  14. <td class="cell">
  15. <strong>Catégorie</strong>
  16. <input style="width:80%" disabled="" name="collection[{{row-count-placeholder}}][title]"
  17. class="form-control" type="text">
  18. <table class="table table-striped table-bordered">
  19. <caption><strong>Sous Catégories</strong></caption>
  20. <tbody data-rf-row-count="0" style="" class="container ui-sortable">
  21. <tr style="display: none;" class="template row">
  22. ##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
  23. <td class="cell">
  24. <input style="margin-bottom:0"
  25. name="collection[{{row-count-placeholder}}][{{row-count-placeholder}}][id]"
  26. class="form-control" type="text">
  27. </td>
  28. <td><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
  29. </tr>
  30. </tbody>
  31. <tfoot>
  32. <tr>
  33. <td colspan="3" style="text-align:center;"><span class="add btn btn-mini btn-success">Ajouter une sous-catégorie</span></td>
  34. </tr>
  35. </tfoot>
  36. </table>
  37. </td>
  38. <td style="width:60px"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
  39. </tr>
  40. % for num, (opt, optcounter) in enumerate(TiersOpt.get_entity_type()):
  41. <tr class="row">
  42. ##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
  43. <td class="cell">
  44. <strong>Catégorie</strong>
  45. <input style="width:70%" name="collection[${opt.slug_entity_type}][title]"
  46. class="form-control" type="text" value="${opt.entity_type}"> ( ${optcounter} entité${["","s"][optcounter>1]} )
  47. <table class="table table-striped table-bordered">
  48. <caption><strong>Sous Catégories</strong></caption>
  49. <tbody data-rf-row-count="${len(TiersOpt.get_entity_sub_type(opt.entity_type))}" style="" class="container ui-sortable">
  50. <tr style="display: none;" class="template row">
  51. ##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
  52. <td class="cell">
  53. <input style="margin-bottom:0;width:95%;"
  54. name="collection[${opt.slug_entity_type}][{{row-count-placeholder}}][id]"
  55. class="form-control" type="text">
  56. </td>
  57. <td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
  58. </tr>
  59. % for nums, (sopt, soptcounter) in enumerate(TiersOpt.get_entity_sub_type(opt.entity_type)):
  60. <tr class="row" display: table-row;>
  61. ##<td width="10%"><span class="move btn btn-mini btn-info">Move</span></td>
  62. <td class="cell">
  63. <input style="margin-bottom:0;width:80%;"
  64. name="collection[${opt.slug_entity_type}][${nums}][${sopt.uid}]"
  65. class="form-control" type="text" value="${sopt.entity_subtype}">
  66. ( ${soptcounter} entité${["","s"][soptcounter>1]} )
  67. </td>
  68. % if soptcounter:
  69. <td style="width:70px;"></td>
  70. % else:
  71. <td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
  72. % endif
  73. </tr>
  74. % endfor
  75. </tbody>
  76. <tfoot>
  77. <tr>
  78. <td colspan="3" style="text-align:center;">
  79. <span class="add btn btn-mini btn-success">Ajouter une sous-catégorie à ${opt.entity_type}</span>
  80. </td>
  81. </tr>
  82. </tfoot>
  83. </table>
  84. </td>
  85. % if optcounter:
  86. <td style="width:70px;"></td>
  87. % else:
  88. <td style="width:70px;"><span class="remove btn btn-mini btn-danger"><i class="icon-remove-sign icon-white"></i> Suppr.</span></td>
  89. % endif
  90. </tr>
  91. % endfor
  92. </tbody>
  93. <tfoot>
  94. <tr>
  95. <td colspan="2" style="text-align:center;"><span class="add btn btn-mini btn-success">Ajouter une catégorie</span></td>
  96. </tr>
  97. </tfoot>
  98. </table>
  99. </div>
  100. <input type="submit" class="btn btn-primary" value="Enregistrer les modifications" />
  101. </form>
  102. <script type="text/javascript">
  103. jQuery(function() {
  104. jQuery('.repeat').each(function() {
  105. jQuery(this).repeatable_fields({
  106. wrapper: 'table',
  107. container: 'tbody',
  108. row: 'tr',
  109. cell: 'td',
  110. });
  111. });
  112. });
  113. </script>