Skip to content

Commit 7398f94

Browse files
author
Jake Blakeley
committed
Moved Parse stuff to bottom incase it fails
1 parent 24ee309 commit 7398f94

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

js/main.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -131,34 +131,6 @@ $(document).ready(function(){
131131
$(".heroText .starCount").text(totalStars);
132132
$(".heroText .forkCount").text(totalForks);
133133

134-
//====================================//
135-
// Get community projects from a parse class
136-
//====================================//
137-
//add new repo to the HTML
138-
function addCommunityRepoToHTML(title, description, url){
139-
$("section.community").append("<div class='repo'><div class='repoTitle'><h4>" + title + "</h4></div><div class='repoDescription'><p>" + description + "</p></div><div class='repoButton'><a href=" + url + " target='_blank'><button class='outline'>View on GitHub</button></a></div></div>");
140-
}
141-
142-
//write this into the page
143-
var communityRepos = Parse.Object.extend("CommunityRepos");
144-
var query = new Parse.Query(communityRepos);
145-
query.ascending("repoName");
146-
query.find({
147-
success: function(results) {
148-
// Do something with the returned Parse.Object values
149-
for (var i = 0; i < results.length; i++) {
150-
var object = results[i];
151-
var title = object.get('repoName');
152-
var description = object.get('repoDescription');
153-
var url = object.get('repoURL');
154-
addCommunityRepoToHTML(title, description, url);
155-
}
156-
},
157-
error: function(error) {
158-
console.log("Error: " + error.code + " " + error.message);
159-
}
160-
});
161-
162134
//====================================//
163135
// expand/contract
164136
//====================================//
@@ -442,4 +414,32 @@ $(document).ready(function(){
442414
} });
443415
}
444416
});
417+
418+
//====================================//
419+
// Get community projects from a parse class
420+
//====================================//
421+
//add new repo to the HTML
422+
function addCommunityRepoToHTML(title, description, url){
423+
$("section.community").append("<div class='repo'><div class='repoTitle'><h4>" + title + "</h4></div><div class='repoDescription'><p>" + description + "</p></div><div class='repoButton'><a href=" + url + " target='_blank'><button class='outline'>View on GitHub</button></a></div></div>");
424+
}
425+
426+
//write this into the page
427+
var communityRepos = Parse.Object.extend("CommunityRepos");
428+
var query = new Parse.Query(communityRepos);
429+
query.ascending("repoName");
430+
query.find({
431+
success: function(results) {
432+
// Do something with the returned Parse.Object values
433+
for (var i = 0; i < results.length; i++) {
434+
var object = results[i];
435+
var title = object.get('repoName');
436+
var description = object.get('repoDescription');
437+
var url = object.get('repoURL');
438+
addCommunityRepoToHTML(title, description, url);
439+
}
440+
},
441+
error: function(error) {
442+
console.log("Error: " + error.code + " " + error.message);
443+
}
444+
});
445445
});

js/min/main-min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)