georgedrummond_sinatra_helpers 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,29 @@
|
|
1
1
|
require "georgedrummond_sinatra_helpers/version"
|
2
|
+
require "digest/md5"
|
2
3
|
|
3
4
|
module GeorgeDrummond
|
4
5
|
module Sinatra
|
5
6
|
module Helpers
|
7
|
+
# Creates the gravatar (www.gravatar.com) html from the email address and arguements provided.
|
8
|
+
# If no size is specified then it defaults to 50x50px
|
9
|
+
#
|
10
|
+
# ==== Examples
|
11
|
+
#
|
12
|
+
# With no size specified
|
13
|
+
#
|
14
|
+
# gravatar_image("georgedrummond@gmail.com")
|
15
|
+
# # => <img src="http://www.gravatar.com/avatar/d278a12b969a495ab16fdd942e748fe5?s=50" class="gravatar" />
|
16
|
+
#
|
17
|
+
# With a size specified
|
18
|
+
#
|
19
|
+
# gravatar_image("georgedrummond@gmail.com", 150)
|
20
|
+
# # => <img src="http://www.gravatar.com/avatar/d278a12b969a495ab16fdd942e748fe5?s=150" class="gravatar" />
|
21
|
+
#
|
22
|
+
def gravatar_image(email, size=50)
|
23
|
+
hash = Digest::MD5.hexdigest(email)
|
24
|
+
"<img src=\"http://www.gravatar.com/avatar/#{hash}?s=#{size}\" class=\"gravatar\" />"
|
25
|
+
end
|
26
|
+
|
6
27
|
# Creates html tags for stylesheets from the arguements provided. Dont include the <tt>.css</tt> extension as this
|
7
28
|
# will be automatically appended. You can specify one or multiple css files at once. Place your css files in
|
8
29
|
# the <tt>public/css</tt> folder of your app.
|
@@ -10,8 +31,8 @@ module GeorgeDrummond
|
|
10
31
|
# ==== Examples
|
11
32
|
#
|
12
33
|
# With only one CSS file
|
13
|
-
#
|
14
|
-
#
|
34
|
+
#
|
35
|
+
# stylesheet_link_tag :app
|
15
36
|
# # => <link href="/css/app.css" type="text/css" rel="stylesheet" />
|
16
37
|
#
|
17
38
|
# With an array of CSS files we want to show
|