Skip to content

Commit 3831fd5

Browse files
committed
Merge pull request #2 from pmbenjamin/new-page
wip
2 parents 8eab12f + 84124a0 commit 3831fd5

3 files changed

Lines changed: 48 additions & 61 deletions

File tree

data/projects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"All projects": ["awesome-devsecops", "controlplane", "heroes", "raindance", "radar", "assumer", "playbook", "devsecops", "forecast", "firebolt", "weatherman", "foghorn", "experiments", "catv", "science", "aws-policies", "ssl_checks"]
2+
"AllProjects": ["awesome-devsecops", "controlplane", "heroes", "raindance", "radar", "assumer", "playbook", "devsecops", "forecast", "firebolt", "weatherman", "foghorn", "experiments", "catv", "science", "aws-policies", "ssl_checks"]
33
}

js/main.js

Lines changed: 47 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -167,72 +167,60 @@ var bootcampData = {
167167

168168
var projectsData = { "All projects": ["awesome-devsecops", "controlplane", "heroes", "raindance", "radar", "assumer", "playbook", "devsecops", "forecast", "firebolt", "weatherman", "foghorn", "experiments", "catv", "science", "aws-policies", "ssl_checks"] };
169169
app.controller('MainCtrl', ['$scope', 'filterFilter', '$anchorScroll',
170-
function($scope, filterFilter, $anchorScroll) {
171-
var self = this;
172-
self.projects = projectsData;
173-
self.bootcamp = bootcampData;
170+
function($scope, filterFilter, $anchorScroll) {
171+
var self = this;
172+
self.projects = projectsData;
173+
self.bootcamp = bootcampData;
174174

175-
$.ajax({
176-
url: 'https://raw.githubusercontent.com/devsecops/devsecops.github.io/master/data/bootcamp.json',
177-
dataType: 'jsonp',
178-
jsonpCallback: 'JSON_CALLBACK',
179-
success: function(data) {
180-
var projects = data[0].Bootcamp;
181-
$scope.currentPage = 1; //current page
182-
$scope.maxSize = 5; //pagination max size
183-
$scope.entryLimit = 36; //max rows for data table
175+
$.ajax({
176+
url: 'https://raw.githubusercontent.com/devsecops/devsecops.github.io/master/data/projects.json',
177+
dataType: 'json',
178+
// jsonpCallback: 'JSON_CALLBACK',
179+
success: function(data) {
180+
var projects = data.AllProjects;
181+
$scope.currentPage = 1; //current page
182+
$scope.maxSize = 5; //pagination max size
183+
$scope.entryLimit = 36; //max rows for data table
184184

185-
/* init pagination with $scope.list */
186-
$scope.noOfRepos = projects.length;
187-
$scope.noOfPages = Math.ceil($scope.noOfRepos / $scope.entryLimit);
188-
$scope.resultsSectionTitle = 'All Repos';
189-
$scope.pageChanged = function() {
190-
$anchorScroll();
191-
};
185+
/* init pagination with $scope.list */
186+
$scope.noOfRepos = projects.length;
187+
$scope.noOfPages = Math.ceil($scope.noOfRepos / $scope.entryLimit);
188+
$scope.resultsSectionTitle = 'All Repos';
189+
$scope.pageChanged = function() {
190+
$anchorScroll();
191+
};
192192

193-
$scope.$watch('searchText', function(term) {
194-
// Create $scope.filtered and then calculate $scope.noOfPages, no racing!
195-
$scope.filtered = filterFilter(projects, term);
196-
$scope.noOfRepos = $scope.filtered.length;
197-
$scope.noOfPages = Math.ceil($scope.noOfRepos / $scope.entryLimit);
198-
$scope.resultsSectionTitle = (!term) ? 'All Repos' : (($scope.noOfRepos === 0) ? 'Search results' : ($scope.noOfRepos + ' repositories found'));
199-
});
200-
201-
var featuredProjects = new Array();
193+
$scope.$watch('searchText', function(term) {
194+
// Create $scope.filtered and then calculate $scope.noOfPages, no racing!
195+
$scope.filtered = filterFilter(projects, term);
196+
$scope.noOfRepos = $scope.filtered.length;
197+
$scope.noOfPages = Math.ceil($scope.noOfRepos / $scope.entryLimit);
198+
$scope.resultsSectionTitle = (!term) ? 'All Repos' : (($scope.noOfRepos === 0) ? 'Search results' : ($scope.noOfRepos + ' repositories found'));
199+
});
202200

203-
self.featured.forEach(function(name) {
204-
for (var i = 0; i < projects.length; i++) {
205-
var project = projects[i];
206-
if (project.Name == name) {
207-
featuredProjects.push(project);
208-
return;
201+
self.projects = projects;
202+
self.featuredProjects = featuredProjects;
203+
$scope.$apply();
204+
}
205+
});
206+
$.ajax({
207+
url: 'https://popularrepostg.blob.core.windows.net/popularrepos/projectssummary.json',
208+
dataType: 'jsonp',
209+
jsonpCallback: 'JSON_CALLBACK',
210+
success: function(stats) {
211+
if (stats !== null) {
212+
$scope.overAllStats = stats[0];
209213
}
210214
}
211215
});
212-
213-
self.projects = projects;
214-
self.featuredProjects = featuredProjects;
215-
$scope.$apply();
216216
}
217-
});
218-
$.ajax({
219-
url: 'https://popularrepostg.blob.core.windows.net/popularrepos/projectssummary.json',
220-
dataType: 'jsonp',
221-
jsonpCallback: 'JSON_CALLBACK',
222-
success: function(stats) {
223-
if (stats !== null) {
224-
$scope.overAllStats = stats[0];
217+
])
218+
.filter('startFrom', function() {
219+
return function(input, start) {
220+
if (input) {
221+
start = +start; //parse to int
222+
return input.slice(start);
225223
}
226-
}
224+
return [];
225+
};
227226
});
228-
}
229-
])
230-
.filter('startFrom', function() {
231-
return function(input, start) {
232-
if (input) {
233-
start = +start; //parse to int
234-
return input.slice(start);
235-
}
236-
return [];
237-
};
238-
});

projects.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)