wordnik_ruby_helpers 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wordnik_ruby_helpers/version.rb +1 -1
- data/lib/wordnik_ruby_helpers.rb +20 -0
- metadata +3 -3
data/lib/wordnik_ruby_helpers.rb
CHANGED
@@ -94,6 +94,26 @@ module WordnikRubyHelpers
|
|
94
94
|
content_tag(:ul, convert_to_list_items(items), :class => "model_columns")
|
95
95
|
end
|
96
96
|
|
97
|
+
# Adds the javascript embed code for Typekit.
|
98
|
+
# Pass in your kit id
|
99
|
+
def enable_typekit(kit_id)
|
100
|
+
raw "<script type=\"text/javascript\" src=\"http://use.typekit.com/#{kit_id}.js\"></script>
|
101
|
+
<script type=\"text/javascript\">try{Typekit.load();}catch(e){}</script>"
|
102
|
+
end
|
103
|
+
|
104
|
+
# Rails 3 did away with 'error_messages', so here's a custom redo..
|
105
|
+
def errors_for(form)
|
106
|
+
return unless form.object.errors.present?
|
107
|
+
out << content_tag(:h2, "#{pluralize(form.object.errors.count, "error")} prohibited this record from being saved.")
|
108
|
+
out << content_tag(:ul, convert_to_list_items(form.object.errors.full_messages))
|
109
|
+
content_tag(:div, out.join("\n"), :class => "errorExplanation")
|
110
|
+
end
|
111
|
+
|
112
|
+
# Return a default message if value is blank
|
113
|
+
def value_or_default(value, default="not specified")
|
114
|
+
value.blank? ? content_tag(:span, default, :class => "blank") : value
|
115
|
+
end
|
116
|
+
|
97
117
|
end
|
98
118
|
end
|
99
119
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Zeke Sikelianos
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-19 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|