Skip to content

Commit

Permalink
Generate v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorocha committed May 11, 2013
1 parent 69d16df commit 86a3b99
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 9 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,43 @@ Include plugin's CSS and JS:
Call the plugin:

```javascript
$('[data-repo]').github();
$("[data-repo]").github();
```

And that's it \o/

[Check full example's source code](https://github.com/zenorocha/jquery-github/blob/master/demo/index.html).

## Options

Here's a list of available settings.

```javascript
$("[data-repo]").github({
iconStars: true,
iconForks: true,
iconIssues: false
});
```

#### iconStars

*Type: `Boolean` Default: `true`*

Display the number of stars in a repository.

#### iconForks

*Type: `Boolean` Default: `true`*

Display the number of forks in a repository.

#### iconIssues

*Type: `Boolean` Default: `false`*

Display the number of issues in a repository.

## Showcase

* [zenorocha.com/projects](http://zenorocha.com/projects/)
Expand Down Expand Up @@ -60,6 +90,13 @@ Also remember to follow [jQuery's Code Style](http://contribute.jquery.org/style

## History

* v0.3.0 May 11, 2013
* Added options to display or hide icons
* Displayed the number of issues
* Added Grunt Watch task
* Added title on attribute on icons
* Switched from 'watch' icon to 'star' icon
* Used font icons instead of images
* v0.2.9 May 1, 2013
* Fixed urls
* v0.2.8 April 30, 2013
Expand Down
39 changes: 34 additions & 5 deletions dist/jquery.github.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery Github - v0.2.9
* jQuery Github - v0.3.0
* A jQuery plugin to display your Github Repositories.
* https://github.com/zenorocha/jquery-github/
*
Expand All @@ -11,7 +11,9 @@
var pluginName = "github",
document = window.document,
defaults = {
propertyName: "value"
iconStars: true,
iconForks: true,
iconIssues: false
};

function Plugin( element, options ) {
Expand All @@ -27,6 +29,7 @@
self._name = pluginName;

self.init();
self.displayIcons();
}

// Initializer
Expand All @@ -42,6 +45,31 @@
}
};

// Display or hide icons
Plugin.prototype.displayIcons = function () {
$iconStars = $( ".repo-stars" );
$iconForks = $( ".repo-forks" );
$iconIssues = $( ".repo-issues" );

if ( this.options.iconStars ) {
$iconStars.css( "display", "inline-block" );
} else {
$iconStars.css( "display", "none" );
}

if ( this.options.iconForks ) {
$iconForks.css( "display", "inline-block" );
} else {
$iconForks.css( "display", "none" );
}

if ( this.options.iconIssues ) {
$iconIssues.css( "display", "inline-block" );
} else {
$iconIssues.css( "display", "none" );
}
};

// Apply results to HTML template
Plugin.prototype.applyTemplate = function ( repo ) {
var self = this,
Expand Down Expand Up @@ -116,16 +144,17 @@
<a href='" + repo_url + "'>" + repo.name + "</a> \
</h3> \
<div class='github-stats'> \
<a class='repo-watchers' href='" + repo_url + "/watchers'>" + repo.watchers + "</a> \
<a class='repo-forks' href='" + repo_url + "/network'>" + repo.forks + "</a> \
<a class='repo-stars' title='Stars' data-icon='7' href='" + repo_url + "/watchers'>" + repo.watchers + "</a> \
<a class='repo-forks' title='Forks' data-icon='f' href='" + repo_url + "/network'>" + repo.forks + "</a> \
<a class='repo-issues' title='Issues' data-icon='i' href='" + repo_url + "/issues'>" + repo.open_issues + "</a> \
</div> \
</div> \
<div class='github-box-content'> \
<p>" + repo.description + " &mdash; <a href='" + repo_url + "#readme'>Read More</a></p> \
</div> \
<div class='github-box-download'> \
<p class='repo-update'>Latest commit to <strong>master</strong> on " + pushed_at + "</p> \
<a class='repo-download' href='" + repo_url + "/zipball/master'>Download as zip</a> \
<a class='repo-download' title='Download as zip' data-icon='w' href='" + repo_url + "/zipball/master'></a> \
</div> \
</div> \
") );
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.github.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion github.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repositories",
"git"
],
"version": "0.2.9",
"version": "0.3.0",
"author": {
"name": "Zeno Rocha",
"url": "https://github.com/zenorocha"
Expand Down

0 comments on commit 86a3b99

Please sign in to comment.