File: github_badge.rb

package info (click to toggle)
tdiary-contrib 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: ruby: 17,305; javascript: 8,263; lisp: 562; xml: 451; php: 61; sql: 40; makefile: 18
file content (27 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Github Badge, by drnic plugin.
# http://drnicjavascript.rubyforge.org/github_badge/
#
# usage:
#   github_badge(username, list_length, head, theme, title, show_all)
#     - username:    user name on github.com
#     - list_length: project list length
#     - theme:       specify theme for badge. "white" or "black".
#     - title:       top text display on the badge.
#     - show_all:    'Show All' message.
#
# Copyright (c) 2008 KAKUTANI Shintaro <http://kakutani.com/>
# Distributed under the GPL

def github_badge( username, list_length = 10, head = "div", theme = "white", title = "My Projects", show_all = "Show all" )
	return (<<-EOS).chomp
<div id="github-badge"></div>
<script type="text/javascript" charset="utf-8">
  GITHUB_USERNAME="#{ username }";
  GITHUB_LIST_LENGTH=#{ list_length };
  GITHUB_THEME="#{ theme }";
  GITHUB_TITLE="#{ title }"
  GITHUB_SHOW_ALL = "#{ show_all }"
</script>
<script src="http://drnicjavascript.rubyforge.org/github_badge/dist/github-badge-launcher.js" type="text/javascript"></script>
	EOS
end