Index: arms/js/pdService.js =================================================================== diff -u -rea21967eae325e083b2903fe23192e38ec44c1f9 -r443af8f670e58218aa2ae1706293282033245ebf --- arms/js/pdService.js (.../pdService.js) (revision ea21967eae325e083b2903fe23192e38ec44c1f9) +++ arms/js/pdService.js (.../pdService.js) (revision 443af8f670e58218aa2ae1706293282033245ebf) @@ -20,15 +20,17 @@ maximumSelectionLength: 5, width: 'resolve', ajax: { - url: "https://api.github.com/search/repositories", + url: function (params) { + return '/auth-check/getUsers/' + params.term; + }, dataType: "json", delay: 250, - data: function (params) { - return { - q: params.term, // search term - page: params.page, - }; - }, + //data: function (params) { + // return { + // q: params.term, // search term + // page: params.page, + // }; + //}, processResults: function (data, params) { // parse the results into the format expected by Select2 // since we are using custom formatting functions we do not need to @@ -37,7 +39,7 @@ params.page = params.page || 1; return { - results: data.items, + results: data, pagination: { more: params.page * 30 < data.total_count, }, @@ -47,48 +49,30 @@ }, placeholder: "리뷰어 설정을 위한 계정명을 입력해 주세요", minimumInputLength: 1, - templateResult: formatRepo, + templateResult: formatUser, templateSelection: formatRepoSelection, }); -function formatRepo(repo) { - if (repo.loading) { - return repo.text; - } - +function formatUser(jsonData) { var $container = $( - "
" + - "
" + - "
" + - "
" + - "
" + - "
" + - "
" + - "
" + + "
" + + "
" + + "
" + + "
" + "
" + - "
" + "
" ); - $container.find(".select2-result-repository__title").text(repo.full_name); + $container.find(".select2-result-jsonData__username").text(jsonData.username); $container - .find(".select2-result-repository__description") - .text(repo.description); - $container - .find(".select2-result-repository__forks") - .append(repo.forks_count + " Forks"); - $container - .find(".select2-result-repository__stargazers") - .append(repo.stargazers_count + " Stars"); - $container - .find(".select2-result-repository__watchers") - .append(repo.watchers_count + " Watchers"); + .find(".select2-result-jsonData__id") + .text(jsonData.id); return $container; } -function formatRepoSelection(repo) { - return repo.full_name || repo.text; +function formatRepoSelection(jsonData) { + return jsonData.username; } $('.js-data-example-ajax').on('select2:selecting', function (e) {