Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved pop_code() to allow HTML class attribute.

  • Loading branch information...
commit b4c2721c568a13d261f2f0b12c31f25d6c1a05db 1 parent bb44d7d
ladislav.martincik authored
Showing with 10 additions and 2 deletions.
  1. +2 −1  .gitignore
  2. +3 −1 lib/rpx_now.rb
  3. +5 −0 spec/rpx_now_spec.rb
View
3  .gitignore
@@ -2,4 +2,5 @@ Manifest
pkg
.*.swp
.*.swo
-*.autotest
+*.autotest
+.bundle
View
4 lib/rpx_now.rb
@@ -159,7 +159,9 @@ def self.parse_user_data(response, options)
end
def unobtrusive_popup_code(text, subdomain, url, options={})
- %Q(<a class="rpxnow" href="#{popup_url(subdomain, url, options)}">#{text}</a>)
+ css_class = "rpxnow"
+ css_class += " #{options[:html][:class]}" if options[:html] && options[:html][:class]
+ %Q(<a class="#{css_class}" href="#{popup_url(subdomain, url, options)}">#{text}</a>)
end
def obtrusive_popup_code(text, subdomain, url, options = {})
View
5 spec/rpx_now_spec.rb
@@ -111,6 +111,11 @@ def fake_response(replace={})
RPXNow.popup_code('a','b','c', options)
options.should == {:xxx => 1}
end
+
+ it "does allow to add class HTML attribute" do
+ options = {:html => {:class => "c1 c2"}}
+ RPXNow.popup_code('a','b','c', options).should =~ /class="rpxnow c1 c2"/
+ end
describe 'obstrusive' do
it "does not encode token_url for popup" do
Please sign in to comment.
Something went wrong with that request. Please try again.