Permalink
Browse files

Fixed the way github issues are displayed

  • Loading branch information...
yohang committed Oct 8, 2012
1 parent fb08ca2 commit cacc0aeaa18d00941741fd256d9939030bf85850
@@ -1,9 +1,7 @@
(function($) {
- var onGithubIssuesFetch = function(json) {
- var container = $('#github-issues');
-
+ var displayGithubIssues = function($container, json) {
// reset the container
- container.html('');
+ $container.html('');
// adds the issues
$.each( json.data, function ( i, item ) {
@@ -16,16 +14,21 @@
)
);
- container.append(issueNode);
+ $container.append(issueNode);
});
};
- $(function() {
- $.ajax({
- url: "https://api.github.com/repos/inmarelibero/Symfonybricks/issues?state=open",
- dataType : "jsonp",
- success: onGithubIssuesFetch
- });
- });
+ $.fn.githubIssues = function() {
+ return this.each(function() {
+ var $this = $(this);
+ $.ajax({
+ url: "https://api.github.com/repos/inmarelibero/Symfonybricks/issues?state=open",
+ dataType : "jsonp",
+ success: function(data) {
+ displayGithubIssues($this, data);
+ }
+ });
+ })
+ };
}(jQuery));
@@ -51,3 +51,7 @@
</div>
{% endblock %}
+
+{% block javascripts_footer %}
+<script type="text/javascript">jQuery(function($) { $('#github-issues').githubIssues(); });</script>
+{% endblock %}

0 comments on commit cacc0ae

Please sign in to comment.