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.

56 lines
1.6 KiB

  1. ::use 'contractadmin/design.mtt'::
  2. <h3>::_("Categories")::</h3>
  3. <p>
  4. ::raw _("You can link your products to categories, in order to better organize them in the \"shop mode\".<br/><b>To add categories: </b>select checkboxes of products and then select a category in the list at the bottom of the page. Click then on \"add\".<br /><b>To remove a category:<b/> click on it.")::
  5. </p>
  6. <script language="javascript">
  7. var tagger;
  8. $(function(){
  9. tagger = _.getTagger(::c.id::);
  10. tagger.init();
  11. });
  12. var check = function(){
  13. var inputs = document.querySelectorAll('#tagger input');
  14. var value = inputs[0].checked==true;
  15. for ( i of inputs ) {
  16. i.checked = !value;
  17. }
  18. }
  19. </script>
  20. <div id="tagger">
  21. <!-- filled by ajax -->
  22. </div>
  23. <form class="form-inline">
  24. <a onClick="check();" class='btn btn-default btn-noAntiDoubleClick'>::_("Select all")::</a>
  25. <select name="tag" id="tag" class="form-control">
  26. ::foreach cg user._amap.getCategoryGroups()::
  27. <optgroup label="::cg.name::">
  28. ::foreach cat cg.categs::
  29. <option value="::cat.id::">::cat.name::</option>
  30. ::end::
  31. </optgroup>
  32. ::end::
  33. </select>
  34. <a onClick="tagger.add()" class='btn btn-default'><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ::_("Add the category")::</a>
  35. <a onClick="tagger.submit()" class='btn btn-success'>::_("Save modifications")::</a>
  36. </form>
  37. <div ::cond user.isAmapManager()::>
  38. <hr />
  39. <a href="/amapadmin/categories/" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> ::_("Manage categories")::</a>
  40. </div>
  41. ::end::