Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add templates support and new flat style option #159

Merged
merged 4 commits into from
Apr 19, 2014

Conversation

max-mapper
Copy link
Contributor

this adds an option to all badges to do ?style=flat. you can now also easily add new styles if you wish to support more

screen shot 2014-04-19 at 1 12 03 am

@ghost
Copy link

ghost commented Apr 19, 2014

👍

@espadrine
Copy link
Member

Thanks a lot for implementing this! It is something that many vendors are interested in, looking forward.

This patch changes enough things that npm test fails. The failed assertions are caused by assumptions that the CLI program gh-badge.js makes. It is an easy fix: gh-badge.js requires colorscheme.json at an incorrect location.

We could also provide a way to specify which template to use in that program. Right now, we discriminate parameters using sigils (a . for the output format, a : for the colorscheme, a # for a hex color). We could use a dash, for once, I suppose. It wouldn't be as intuitive as the other sigils; suggestions welcome.

Maybe as a follow-up?

@max-mapper
Copy link
Contributor Author

@espadrine ok should be good to go

screen shot 2014-04-19 at 10 26 18 am

@espadrine
Copy link
Member

@maxogden This is good enough to merge. Thanks again!

I'll do some follow-up cleanup however before pushing to http://shields.io.

  • The information stored in makeImage's options parameter is better served in its data parameter,
  • The colorscheme parameter to makeTemplate is no longer used: I'll eat it,
  • We can already get to the contents of the URL query parameter style through that data parameter in getRequest (in fact, the code setting the badge data is better located in getBadgeData),
  • I'll adjust code style for consistency, esp. w.r.t. semicolons.

@espadrine espadrine merged commit 519aa5e into badges:master Apr 19, 2014
espadrine added a commit that referenced this pull request Apr 19, 2014
- The information stored in `makeImage`'s `options` parameter is better served
  in its `data` parameter,
- Remove the (no longer used) `colorscheme` parameter to `makeTemplate`,
- We can already get to the contents of the URL query parameter `style` through
  that `data` parameter in `getRequest`,
- Relocation of the code to set badge data related to the flat style into
  `getBadgeData`,
- Code style (adding semicolons).

Related to issue #159.
@espadrine
Copy link
Member

It's live!

@max-mapper
Copy link
Contributor Author

@espadrine w00t! I just noticed that the 'custom' badges ignore the ?style=flat, e.g. http://img.shields.io/badge/Made%20with%20freedom%20in-USA-blue.svg?style=flat

@espadrine
Copy link
Member

@maxogden Hmm, that is rather unfortunate. I suspect it is caused by the fact that custom badges don't go through that cache. I shall have this fixed first thing tomorrow, UTC+2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants