Skip to content

Commit

Permalink
add raw option for state
Browse files Browse the repository at this point in the history
  • Loading branch information
justbill2020 committed Jun 15, 2017
1 parent 5514aea commit 2010d98
Show file tree
Hide file tree
Showing 70 changed files with 23 additions and 11 deletions.
Empty file modified .buildpacks
100644 → 100755
Empty file.
Empty file modified .dockerignore
100644 → 100755
Empty file.
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .eslintignore
100644 → 100755
Empty file.
Empty file modified .eslintrc.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .istanbul.yml
100644 → 100755
Empty file.
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified CNAME
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified Dockerfile
100644 → 100755
Empty file.
Empty file modified INSTALL.md
100644 → 100755
Empty file.
Empty file modified LICENSE.md
100644 → 100755
Empty file.
Empty file modified Makefile
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified coverage.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/TUTORIAL.md
100644 → 100755
Empty file.
Empty file modified doc/users.md
100644 → 100755
Empty file.
Empty file modified favicon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified gh-badge.spec.js
100644 → 100755
Empty file.
Empty file modified lib/analytics.js
100644 → 100755
Empty file.
Empty file modified lib/badge.js
100644 → 100755
Empty file.
Empty file modified lib/badge.spec.js
100644 → 100755
Empty file.
Empty file modified lib/color-formatters.js
100644 → 100755
Empty file.
Empty file modified lib/colorscheme.json
100644 → 100755
Empty file.
Empty file modified lib/github-auth.js
100644 → 100755
Empty file.
Empty file modified lib/in-process-server-test-helpers.js
100644 → 100755
Empty file.
Empty file modified lib/load-logos.js
100644 → 100755
Empty file.
Empty file modified lib/lru-cache.js
100644 → 100755
Empty file.
Empty file modified lib/lru-cache.spec.js
100644 → 100755
Empty file.
Empty file modified lib/measure-text.js
100644 → 100755
Empty file.
Empty file modified lib/php-version.js
100644 → 100755
Empty file.
Empty file modified lib/server-secrets.js
100644 → 100755
Empty file.
Empty file modified lib/suggest.js
100644 → 100755
Empty file.
Empty file modified lib/svg-to-img.js
100644 → 100755
Empty file.
Empty file modified lib/svg-to-img.spec.js
100644 → 100755
Empty file.
Empty file modified lib/test-config.js
100644 → 100755
Empty file.
Empty file modified lib/text-formatters.js
100644 → 100755
Empty file.
Empty file modified lib/version.js
100644 → 100755
Empty file.
Empty file modified logo.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/appveyor.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/bithound.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/github.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/gitter-white.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/gratipay.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/sourcegraph.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified logo/twitter.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified package.json
100644 → 100755
Empty file.
Empty file modified public/404.html
100644 → 100755
Empty file.
Empty file modified public/500.html
100644 → 100755
Empty file.
Empty file modified secret.tpl.json
100644 → 100755
Empty file.
24 changes: 16 additions & 8 deletions server.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3224,12 +3224,12 @@ cache(function(data, match, sendBadge, request) {
}));

// GitHub issues integration.
camp.route(/^\/github\/issues(-pr)?(-closed)?(-raw)?(-state)?\/([^\/]+)\/([^\/]+)\/?([^\/]+)?\.(svg|png|gif|jpg|json)$/,
camp.route(/^\/github\/issues(-pr)?(-closed)?(-state)?(-raw)?\/([^\/]+)\/([^\/]+)\/?([^\/]+)?\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var isPR = !!match[1];
var isClosed = !!match[2];
var isRaw = !!match[3];
var isState = !!match[4];
var isState = !!match[3];
var isRaw = !!match[4];
var user = match[5]; // eg, badges
var repo = match[6]; // eg, shields
var ghLabel = match[7]; // eg, website
Expand Down Expand Up @@ -3271,11 +3271,19 @@ cache(function(data, match, sendBadge, request) {
var modifier = '';
var issues;
if (isState && issuesApi) {
var state = data.state;
var id = data.number;
badgeData.text[0] = id;
badgeData.text[1] = state;
badgeData.colorscheme = (state == 'closed')? 'red': 'brightgreen';
var rightSide = isRaw ? data.state : ' '.repeat(2) + data.title + ' '.repeat(2);
var leftSide = ' '.repeat(2) +'#' + ghLabel + ' '.repeat(2);
if (data.state !== 'undefined') {
console.log("data.state !== 'undefined'", true)
badgeData.link = [ data.html_url ]
badgeData.colorscheme = (data.state == 'closed') ? 'red': 'brightgreen';
} else {
console.log("data.state !== 'undefined'", false)
rightSide = 'Not Found'
badgeData.colorscheme = 'lightgrey'
}
badgeData.text[0] = leftSide;
badgeData.text[1] = rightSide;
sendBadge(format, badgeData);
} else {
if (isPR) {
Expand Down
Empty file modified server.spec.js
100644 → 100755
Empty file.
Empty file modified service-tests/README.md
100644 → 100755
Empty file.
Empty file modified service-tests/cran.js
100644 → 100755
Empty file.
Empty file modified service-tests/discord.js
100644 → 100755
Empty file.
Empty file modified service-tests/github.js
100644 → 100755
Empty file.
Empty file modified service-tests/maven-central.js
100644 → 100755
Empty file.
Empty file modified service-tests/runner/cli.js
100644 → 100755
Empty file.
Empty file modified service-tests/runner/runner.js
100644 → 100755
Empty file.
Empty file modified service-tests/runner/service-tester.js
100644 → 100755
Empty file.
Empty file modified shields.example.env
100644 → 100755
Empty file.
Empty file modified spec/SPECIFICATION.md
100644 → 100755
Empty file.
Empty file modified spec/proportions.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified templates/default-template.json
100644 → 100755
Empty file.
Empty file modified templates/flat-square-template.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified templates/flat-template.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified templates/plastic-template.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified templates/social-template.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions try.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,13 @@ <h3 id="miscellaneous"> Miscellaneous </h3>
<td><img src='/github/issues-raw/badges/shields.svg' alt=''/></td>
<td><code>https://img.shields.io/github/issues-raw/badges/shields.svg</code></td>
</tr>
<tr><th data-keywords='GitHub issue' data-doc='githubDoc'></th>
<td><img src='/github/issues-state/badges/shields/1.svg' alt=''/></td>
<td><code>https://img.shields.io/github/issues-state/badges/shields/1.svg</code></td>
<tr><th data-keywords='GitHub issue state' data-doc='githubDoc'>GitHub issue state:</th>
<td><img src='/github/issues-state/badges/shields/1012.svg' alt=''/></td>
<td><code>https://img.shields.io/github/issues-state/badges/shields/1012.svg</code></td>
</tr>
<tr><th data-keywords='GitHub issue state' data-doc='githubDoc'></th>
<td><img src='/github/issues-state-raw/badges/shields/1.svg' alt=''/></td>
<td><code>https://img.shields.io/github/issues-state-raw/badges/shields/1.svg</code></td>
</tr>
<tr><th data-keywords='GitHub issue' data-doc='githubDoc'> GitHub closed issues: </th>
<td><img src='/github/issues-closed/badges/shields.svg' alt=''/></td>
Expand Down

0 comments on commit 2010d98

Please sign in to comment.