edit.ui.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. function getForm(event)
  2. {
  3. const $target = $(event.target).closest('a,input');
  4. const field = $target.attr('name');
  5. const module = field == 'code' ? $('#blockEditForm #module').val() : $target.attr('data-module');
  6. const code = field == 'code' ? $target.val() : '';
  7. const url = $.createLink('block', 'edit', 'blockID=' + blockID + '&module=' + module + '&code=' + (code ? code : ''));
  8. loadPartial(url, '#blockCreateForm #codesRow, #blockCreateForm #paramsRow, #blockCreateForm #module');
  9. const $nav = $('#blockEditForm .block-modules-nav');
  10. $nav.find('.nav-item>.active').removeClass('active');
  11. $nav.find(`.nav-item>a[data-module="${module}"]`).addClass('active');
  12. }
  13. /**
  14. * Updates the blockTitle when the type is changed.
  15. *
  16. * @return void
  17. */
  18. function changeType()
  19. {
  20. const lang = config.clientLang;
  21. const code = $('[name="code"]').zui('picker').$.state.selections[0].text;
  22. const type = $('[name="params[type]"]').zui('picker').$.state.selections[0].text;
  23. /* 在项目仪表盘创建的待测版本区块时,直接取类型名称为该区块的标题。*/
  24. /* When creating a test version block in the project dashboard, directly take the name of the block of type.*/
  25. if($('#module').val() == 'scrumtest' && $('#paramstype').val() != 'all')
  26. {
  27. $('#title').val(code);
  28. return;
  29. }
  30. $('#title').val(blockTitle.replace('%1$s', type).replace('%2$s', code));
  31. }