view.ui.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. $(document).on('click', '#toStory', function()
  2. {
  3. const message = $(this).data('confirmtip');
  4. const url = $(this).data('url');
  5. const tab = $(this).data('app');
  6. const load = $(this).data('load');
  7. zui.Modal.confirm({message}).then((result) =>
  8. {
  9. if(result) load == 'modal' ? loadModal(url, null, {code: tab}) : openPage(url, tab);
  10. });
  11. });
  12. window.clickToTask = function()
  13. {
  14. const projectID = $('[name="taskProjects"]').val();
  15. const executionID = $('[name="execution"]').val() ? $('[name="execution"]').val() : 0;
  16. changeTaskProjects();
  17. if(projectID && executionID != 0)
  18. {
  19. zui.Modal.hide('#toTask');
  20. if(isInModal) zui.Modal.hide();
  21. const url = $.createLink('task', 'create', 'executionID=' + executionID + '&storyID=0&moduleID=0&taskID=0&todoID=0&extra=projectID=' + projectID + '&bugID=' + bugID);
  22. openPage(url, executions[executionID] != undefined && executions[executionID].indexOf(disableExecution) >= 0 ? 'project' : 'execution');
  23. }
  24. else if(projectID == 0)
  25. {
  26. zui.Modal.alert(errorNoProject);
  27. }
  28. else
  29. {
  30. zui.Modal.alert(errorNoExecution);
  31. }
  32. };
  33. function changeTaskProjects(event)
  34. {
  35. const projectID = event != undefined ? $(event.target).val() : $('[name="taskProjects"]').val();
  36. const link = $.createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&projectID=' + projectID +'&branch=' + branchID + '&number=&executionID=0&from=bugToTask');
  37. $.get(link, function(data)
  38. {
  39. let $executionPicker = $('[name="execution"]').zui('picker');
  40. if(data)
  41. {
  42. data = JSON.parse(data);
  43. $executionPicker.render({items: data});
  44. $executionPicker.$.setValue('');
  45. }
  46. });
  47. }
  48. window.waitDom('body.body-modal .toolbar', function()
  49. {
  50. $('.body-modal .toolbar a[data-load="modal"]').attr('data-toggle', 'modal').removeAttr('data-load');
  51. })