@@ -20,16 +20,20 @@ document.getElementsByClassName('brand')[0].textContent = short_title;
2020
2121let url_user = `https://api.github.com/users/${ github_user } ` ,
2222url_repos = `${ url_user } /repos?sort=pushed&per_page=100` ,
23+ url_issues = `https://api.github.com/search/issues?q=user:${ github_user } &sort=updated&order=desc` ,
2324months_short = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' . split ( ' ' ) ;
2425
2526if ( DEV ) {
2627url_user = '/data/user.json' ;
2728url_repos = '/data/repos.json' ;
29+ url_issues = '/data/issues.json' ;
2830}
2931
3032let coder = new Vue ( {
3133el :'#coder' ,
3234data :{
35+ activetab :'repos' ,
36+ latest_issues :null ,
3337repos :[ ] ,
3438response :{ } ,
3539sort_orders :{ } ,
@@ -122,6 +126,12 @@ let coder = new Vue({
122126series :this . repo_types . values } ) ;
123127} ,
124128methods :{
129+ fetchIssues :function ( ) {
130+ this . $http . get ( url_issues ) . then ( response => {
131+ this . response . issues = response ;
132+ this . latest_issues = response . body . items ;
133+ } ) ;
134+ } ,
125135fetchRepos :function ( ) {
126136this . $http . get ( url_repos ) . then ( response => {
127137this . response . repos = response ;
@@ -150,11 +160,17 @@ let coder = new Vue({
150160repoRanking :function ( property ) {
151161return this . repos_pushed . filter ( d => d [ property ] ) . sort ( ( a , b ) => b [ property ] - a [ property ] ) ;
152162} ,
153- sortBy :function ( key , type = 'number' ) {
163+ showTab :function ( name ) {
164+ this . activetab = name ;
165+ if ( ! this . latest_issues ) {
166+ this . fetchIssues ( ) ;
167+ }
168+ } ,
169+ sortBy :function ( key , type = 'number' , property = 'repos' ) {
154170let default_value = type === 'string' ?'' :0 ;
155171this . sort_key = key ;
156172this . sort_orders [ key ] = ( this . sort_orders [ key ] || 1 ) * - 1 ;
157- this . repos . sort ( ( a , b ) => {
173+ this [ property ] . sort ( ( a , b ) => {
158174let x = a [ key ] || default_value ,
159175y = b [ key ] || default_value ;
160176if ( type === 'string' ) {