forked from twitter/opensource-website
-
Notifications
You must be signed in to change notification settings - Fork 5
/
eKnight.js
1 lines (1 loc) · 1.6 KB
/
eKnight.js
1
App.filter("trust",function($sce){return function(text){return $sce.trustAsHtml(text)}}),App.controller("eKnightCtrl",function($scope,HebUtill,issuesLoader,$window,commentsHandler,pieChartService,arrayUtill,$http,$routeParams){$scope.relativizePath=$window.CONFIG.relativizePath,$scope.pieChartService=pieChartService,$scope.selectedLabels=new Array,$scope.stateControls={showIssuesWithComments:!0,showIssuesWithOutComments:!0},$scope.eKnight=_.filter(eKnightsData,function(eKnight){return eKnight.slug===$routeParams.eKnight}),0!==$scope.eKnight.length,$scope.eKnight=$scope.eKnight[0],document.title=$scope.eKnight.name,issuesLoader.load($scope.eKnight.repositories,function(data,labels){$scope.issues=data,$scope.labels=labels,$scope.updateState=function(){$scope.$apply()},$scope.setSelectedLabels=function(){var name=this.lbl.name;return _.contains($scope.selectedLabels,name)?$scope.selectedLabels=_.without($scope.selectedLabels,name):$scope.selectedLabels.push(name),!1},$scope.isChecked=function(name){return _.contains($scope.selectedLabels,name)?"fa-check":!1},$scope.loadComments=function(evt,issue){$scope.readMore(evt,issue);var http_request=$http({method:"GET",url:issue.comments_url});http_request.success(function(data){function loadComments(i){if(-1===i)return commentsHandler.treatComments(comments_list),void(issue.comments_list=comments_list);var comment_request=$http({method:"GET",url:data[i].url});comment_request.success(function(comment){comments_list.push(comment),i--,loadComments(i)})}var comments_list=new Array;loadComments(data.length-1)})},$scope.readMore=function(evt,issue){issue.textLimit=1e6}})});