You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

org-team.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import $ from 'jquery';
  2. import {hideElem, showElem} from '../utils/dom.js';
  3. const {appSubUrl} = window.config;
  4. export function initOrgTeamSettings() {
  5. // Change team access mode
  6. $('.organization.new.team input[name=permission]').on('change', () => {
  7. const val = $('input[name=permission]:checked', '.organization.new.team').val();
  8. if (val === 'admin') {
  9. hideElem($('.organization.new.team .team-units'));
  10. } else {
  11. showElem($('.organization.new.team .team-units'));
  12. }
  13. });
  14. }
  15. export function initOrgTeamSearchRepoBox() {
  16. const $searchRepoBox = $('#search-repo-box');
  17. $searchRepoBox.search({
  18. minCharacters: 2,
  19. apiSettings: {
  20. url: `${appSubUrl}/repo/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
  21. onResponse(response) {
  22. const items = [];
  23. $.each(response.data, (_i, item) => {
  24. items.push({
  25. title: item.repository.full_name.split('/')[1],
  26. description: item.repository.full_name,
  27. });
  28. });
  29. return {results: items};
  30. },
  31. },
  32. searchFields: ['full_name'],
  33. showNoResults: false,
  34. });
  35. }