create.ui.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $(function()
  2. {
  3. setWhite();
  4. });
  5. /**
  6. * 移除复制项目产生的某个控件的提示信息。
  7. * Remove the tip of a control generated by copy project.
  8. *
  9. * @access public
  10. * @return void
  11. */
  12. function removeTips()
  13. {
  14. const $formGroup = $(this).closest('.form-group');
  15. $formGroup.removeClass('has-warning');
  16. $formGroup.find('.has-warning').removeClass('has-warning');
  17. $formGroup.find('.form-tip').addClass('hidden');
  18. }
  19. /**
  20. * 移除复制项目时产生的所有控件的提示信息。
  21. * Remove all tips generated when copying projects.
  22. *
  23. * @access public
  24. * @return void
  25. */
  26. window.removeAllTips = function()
  27. {
  28. $('.has-warning').removeClass('has-warning');
  29. $('.text-warning').remove();
  30. }
  31. /**
  32. * Fuzzy search projects by project name.
  33. *
  34. * @access public
  35. * @return void
  36. */
  37. $(document).on('keyup', '#projectName', function()
  38. {
  39. var name = $(this).val();
  40. name = name.replace(/\s+/g, '');
  41. $('#copyProjects .project-block').hide();
  42. if(!name) $('#copyProjects .project-block').show();
  43. $('#copyProjects .project-block').each(function()
  44. {
  45. if($(this).text().includes(name) || $(this).data('pinyin').includes(name)) $(this).show();
  46. });
  47. });
  48. window.toggleStoryType = function(e)
  49. {
  50. if(e.target.value == 'requirement' && !e.target.checked)
  51. {
  52. $('input[value=epic]').prop('checked', false);
  53. }
  54. else if(e.target.value == 'epic' && e.target.checked)
  55. {
  56. $('input[value=requirement]').prop('checked', true);
  57. }
  58. }