webs 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/cache/cache.rb +1 -1
- data/lib/helper/tags.rb +44 -2
- data/lib/webs.rb +1 -1
- data/webs.gemspec +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/cache/cache.rb
CHANGED
data/lib/helper/tags.rb
CHANGED
@@ -3,7 +3,7 @@ module Webs
|
|
3
3
|
module Tags
|
4
4
|
def fwml tagname, options={}, &block
|
5
5
|
# Rails.logger.debug "****** fwml #{tagname} #{options.inspect}"
|
6
|
-
if ['sanitize', 'wizzywig'].include?(tagname.to_s)
|
6
|
+
if ['sanitize', 'wizzywig', 'intl'].include?(tagname.to_s)
|
7
7
|
self.send( "fw_#{tagname}", options, &block )
|
8
8
|
else
|
9
9
|
return inline_tag( tagname, options ) unless block
|
@@ -40,7 +40,49 @@ module Webs
|
|
40
40
|
# fw_wizzywig should never be called with a block the text is passed in via text
|
41
41
|
def fw_wizzywig options={}
|
42
42
|
wizzywig_text = options.delete( :wizzywig_text )
|
43
|
-
"<fw:wizzywig #{html_options(options)}><![CDATA[#{wizzywig_text}]]></fw:wizzywig>"
|
43
|
+
"<fw:wizzywig #{html_options(options)}><![CDATA[#{wizzywig_text}]]></fw:wizzywig>".html_safe
|
44
|
+
end
|
45
|
+
|
46
|
+
# can take an option: :tokens which is a hash for replacement and will add in the appropriate fw:intl-token tags
|
47
|
+
# ex:
|
48
|
+
# <%= fwml :intl, :description=>"bogus", :tokens=>{ :tier=>"Tier 1", :image_limit=>"10", :upgrade_link=>"www.blah.com" } do %>
|
49
|
+
# As a {tier} member, each of your products can have a maximum of {image_limit}.
|
50
|
+
# Need more? Time to upgrade!
|
51
|
+
# {upgrade_link}
|
52
|
+
# <% end %>
|
53
|
+
#
|
54
|
+
# Should Yield:
|
55
|
+
#
|
56
|
+
# <fw:intl description="bogus">
|
57
|
+
# As a {tier} member, each of your products can have a maximum of {image_limit}.
|
58
|
+
# Need more? Time to upgrade!
|
59
|
+
# {upgrade_link}
|
60
|
+
# <fw:intl-token name="tier">Tier 1</fw:intl-token>
|
61
|
+
# <fw:intl-token name="image_limit">10</fw:intl-token>
|
62
|
+
# <fw:intl-token name="upgrade_link">www.blah.com</fw:intl-token>
|
63
|
+
# </fw:intl>
|
64
|
+
#
|
65
|
+
# You should also be able to use it without a body, so this should work:
|
66
|
+
# <% rubystring = 'hello world' %>
|
67
|
+
# <%= fwml :intl, :value=rubystring %>
|
68
|
+
#
|
69
|
+
# Should Yield
|
70
|
+
#
|
71
|
+
# <fw:intl>hello world</fw:intl>
|
72
|
+
#
|
73
|
+
def fw_intl options={}, &block
|
74
|
+
|
75
|
+
value = options.delete( :value)
|
76
|
+
tokens = options.delete( :tokens )
|
77
|
+
if block
|
78
|
+
tag = render_tag_with_block 'intl', options, false, &block
|
79
|
+
|
80
|
+
idx = tag.length - 10
|
81
|
+
token_str = tokens.keys.collect{ |k| %[<fw:intl-token name="#{k}">#{tokens[k]}</fw:intl-token>] }.join( "\n" )
|
82
|
+
(tag[0..idx-1] + token_str.html_safe + tag[idx..tag.length-1]).html_safe
|
83
|
+
else
|
84
|
+
%[<fw:intl#{html_options(options)}>#{h value}</fw:intl>].html_safe
|
85
|
+
end
|
44
86
|
end
|
45
87
|
end
|
46
88
|
end
|
data/lib/webs.rb
CHANGED
data/webs.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{webs}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.30"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Chuck Olczak"]
|
9
|
-
s.date = %q{2011-04-
|
9
|
+
s.date = %q{2011-04-29}
|
10
10
|
s.description = %q{Reusable webs stuff.}
|
11
11
|
s.email = %q{chuck@webs.com}
|
12
12
|
gemfiles = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: webs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.30
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Chuck Olczak
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-29 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|