autogenerated name metadata table
[sgn.git] / mason / homepage / github_pullrequests.mas
blob20720ac44456bab389fa8726ac02ea437c996a04
1 <%args>
2 $phenotype_files => undef
3 </%args>
5 <div class="container-fluid">
6     <div class="row">
7         <div class="col-sm-12">
8             <div class="panel panel-info">
9                 <div class="panel-heading">Recent Changes to Database</div>
10                 <div class="panel-body">
11                     <div id="homepage_github_pullrequests_div"></div>
12                 </div>
13             </div>
14         </div>
15     </div>
16 </div>
18 <script>
19 jQuery(document).ready(function() {
20     
21     var pr_body_begin = "Description <!-- Describe your changes in detail. -->\r\n-----------------------------------------------------";
22     var pr_body_end = "Checklist <!-- Put an `x` in all the boxes that apply, or check them once submitted.-->";
24     jQuery.ajax( {
25       'url': 'https://api.github.com/repos/solgenomics/sgn/pulls?state=closed&sort=updated&direction=desc&per_page=5',
26       'method': 'GET',
27       'success': function(response) {
28         //console.log(response);
29         var html = '<table class="table table-bordered table-hover" id="homepage_github_pullrequests" alt=""><thead><tr><th>Title</th><th>Description</th><th>Date</th></tr></thead><tbody>';
30         for (var i=0; i<response.length; i++){
31             pr_body = response[i].body;
32             trim1 = pr_body.split(pr_body_end)[0];
33             body = trim1.split(pr_body_begin).slice(-1)[0];
34             html = html + '<tr><td><a href="'+response[i].html_url+'" >'+response[i].title+'</a></td><td>'+body+'</td><td>'+response[i].merged_at+'</td></tr>';
35         }
36         html = html + '</tbody></table>';
37         jQuery('#homepage_github_pullrequests_div').html(html);
38       },
39       error: function(response) {
40         //alert('An error occurred fetching github pull requests.');
41       }
42     });
44 });
45 </script>