admin.flow.html.hook.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script>
  2. $(function()
  3. {
  4. $('#relationTemplateNext').find('[value="product"]').remove();
  5. $('#relationTemplateNext').find('[value="productplan"]').remove();
  6. $('#relationTemplateNext').find('[value="release"]').remove();
  7. $('#relationTemplateNext').find('[value="project"]').remove();
  8. $('#relationTemplateNext').find('[value="build"]').remove();
  9. $('#relationTemplateNext').find('[value="testtask"]').remove();
  10. $('#relationTemplateNext').find('[value="testsuite"]').remove();
  11. $('#relationTemplateNext').find('[value="caselib"]').remove();
  12. $('select[id^=next]').each(function()
  13. {
  14. $(this).find('[value="product"]').remove();
  15. $(this).find('[value="productplan"]').remove();
  16. $(this).find('[value="release"]').remove();
  17. $(this).find('[value="project"]').remove();
  18. $(this).find('[value="build"]').remove();
  19. $(this).find('[value="testtask"]').remove();
  20. $(this).find('[value="testsuite"]').remove();
  21. $(this).find('[value="caselib"]').remove();
  22. $(this).trigger("chosen:updated");
  23. if('story,task,bug,testcase,feedback'.indexOf($(this).val()) >= 0)
  24. {
  25. $(this).closest('tr').find('[value=one2many]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  26. $(this).closest('tr').find('[value=many2one]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  27. $(this).closest('tr').find('[value=many2many]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  28. }
  29. })
  30. $(document).on('change', 'select[id^=next]', function()
  31. {
  32. if('story,task,bug,testcase,feedback'.indexOf($(this).val()) >= 0)
  33. {
  34. $(this).closest('tr').find('[value=one2many]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  35. $(this).closest('tr').find('[value=many2one]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  36. $(this).closest('tr').find('[value=many2many]').attr('disabled', 'disabled').closest('.checkbox-primary').hide();
  37. }
  38. else
  39. {
  40. $(this).closest('tr').find('[value=one2many]').removeAttr('disabled').closest('.checkbox-primary').show();
  41. $(this).closest('tr').find('[value=many2one]').removeAttr('disabled').closest('.checkbox-primary').show();
  42. $(this).closest('tr').find('[value=many2many]').removeAttr('disabled').closest('.checkbox-primary').show();
  43. }
  44. });
  45. })
  46. </script>