create.ui.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. function changeProduct(event)
  2. {
  3. const productID = $(event.target).val();
  4. loadProductBranches(productID);
  5. loadProductModules(productID);
  6. loadProductStories(productID);
  7. loadScenes(productID);
  8. }
  9. function changeBranch()
  10. {
  11. const productID = $('[name=product]').val();
  12. loadProductModules(productID);
  13. loadProductStories(productID);
  14. loadScenes(productID);
  15. }
  16. function changeModule()
  17. {
  18. const productID = $('[name=product]').val();
  19. loadProductStories(productID);
  20. loadScenes(productID);
  21. }
  22. function clickRefresh()
  23. {
  24. const productID = $('[name=product]').val();
  25. loadProductModules(productID);
  26. }
  27. function changeStory(event)
  28. {
  29. const storyID = parseInt($(event.target).val());
  30. if(storyID)
  31. {
  32. const storyLink = $.createLink('story', 'view', 'storyID=' + storyID);
  33. $('#preview').removeClass('hidden');
  34. $('#preview').attr('href', storyLink);
  35. }
  36. else
  37. {
  38. $('#preview').addClass('hidden');
  39. }
  40. }
  41. function checkScript()
  42. {
  43. $('.autoScript').toggleClass('hidden', !$('#auto').prop('checked'));
  44. if(!$('#auto').prop('checked')) $('[name=script]').val('');
  45. }
  46. window.showUploadScriptBtn = function()
  47. {
  48. $('[name=scriptFile]').siblings().first().show();
  49. $('[name=script]').val('');
  50. }
  51. window.readScriptContent = function(object)
  52. {
  53. $('[name=scriptFile]').siblings().first().hide();
  54. var reader = new FileReader();
  55. reader.readAsText(object.file, 'UTF-8');
  56. reader.onload = function(evt){$('[name=script]').val(evt.target.result);}
  57. }
  58. window.loadProduct = function(e)
  59. {
  60. const $this = $(e.target);
  61. const productID = $this.val();
  62. const $modal = $this.closest('.modal');
  63. const inModal = $modal.length > 0;
  64. if(inModal) loadModal($.createLink('testcase', 'create', 'productID=' + productID + '&' + createParams), $modal.attr('id'));
  65. if(!inModal) loadPage($.createLink('testcase', 'create', 'productID=' + productID + '&' + createParams));
  66. };