create.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. $(function()
  2. {
  3. $('#object').change(function()
  4. {
  5. var text = reviewText + $(this).find("option:selected").text();
  6. $('#title').val(text);
  7. var type = $(this).val();
  8. var content = $('input[name="content"]:checked').val();
  9. if(type == 'PP')
  10. {
  11. $('input[name="content"').closest('tr').addClass('hide');
  12. $('#template').closest('tr').addClass('hide');
  13. $('#doc').closest('tr').addClass('hide');
  14. $('#doclib').closest('tr').addClass('hide');
  15. }
  16. else
  17. {
  18. $('input[name="content"').closest('tr').removeClass('hide');
  19. $('#doc').closest('tr').removeClass('hide');
  20. if(content == 'template')
  21. {
  22. $('#template').closest('tr').removeClass('hide');
  23. $('#doclib').closest('tr').addClass('hide');
  24. }
  25. else
  26. {
  27. $('#template').closest('tr').addClass('hide');
  28. $('#doclib').closest('tr').removeClass('hide');
  29. }
  30. }
  31. let productID = $('#product').val();
  32. var link = createLink('review', 'ajaxGetNodes', "project=" + projectID + '&object=' + type + '&product=' + productID);
  33. $('#reviewerBox').load(link, function(){$(this).find('select').chosen()});
  34. var link = createLink('baseline', 'ajaxGetTemplates', 'type=' + type);
  35. $.post(link, function(data)
  36. {
  37. $('#template').replaceWith(data);
  38. $('#template_chosen').remove();
  39. $('#template').chosen();
  40. $('#template').on('change', function()
  41. {
  42. var template = $(this).val();
  43. var link = createLink('baseline', 'ajaxGetDocs', 'template=' + template + '&from=review&project=' + projectID);
  44. $.post(link, function(data)
  45. {
  46. $('#doc').replaceWith(data);
  47. $('#doc_chosen').remove();
  48. $('#doc').chosen();
  49. })
  50. })
  51. $('#template').change();
  52. })
  53. })
  54. $('#object').change();
  55. $('#doclib').change(function()
  56. {
  57. var libID = $(this).val();
  58. var link = createLink('doc', 'ajaxGetDocs', "libID=" + libID);
  59. $.post(link, function(data)
  60. {
  61. $('#doc').replaceWith(data);
  62. $('#doc_chosen').remove();
  63. $('#doc').chosen();
  64. })
  65. })
  66. $('input[name="content"]').change(function()
  67. {
  68. var content = $(this).val();
  69. if(content == 'template')
  70. {
  71. $('#template').change();
  72. $('#template').closest('tr').removeClass('hide');
  73. $('#doclib').closest('tr').addClass('hide');
  74. }
  75. else
  76. {
  77. $('#doclib').change();
  78. $('#template').closest('tr').addClass('hide');
  79. $('#doclib').closest('tr').removeClass('hide');
  80. }
  81. })
  82. $('#product').change(function(){
  83. let productID = $(this).val();
  84. let type = $('#object').val();
  85. const link = createLink('review', 'ajaxGetNodes', "project=" + projectID + '&object=' + type + '&product=' + productID);
  86. $('#reviewerBox').load(link, function(){$(this).find('select').chosen()});
  87. })
  88. })