Fixing link to group website

This commit is contained in:
Maikel Linke
2015-02-07 19:31:16 +11:00
parent 2293623d2c
commit 211e9c33a7
3 changed files with 1 additions and 14 deletions

View File

@@ -1,11 +1,5 @@
module GroupsHelper
def link_to_url(url, html_options = {})
link_to_service 'http://', url, html_options do
strip_url url
end
end
def link_to_service(baseurl, name, html_options = {})
if name.empty? then return end
html_options = html_options.merge target: '_blank'

View File

@@ -12,9 +12,8 @@
Email us
- if @group.website.present?
%p
%a{href:"http://"+@group.website, target: "_blank"}
=link_to_service "http://", @group.website do
Visit our website
/ =link_to_url @group.website
%div{bindonce: true}
- if @group.facebook.present? || @group.twitter.present? || @group.linkedin.present? || @group.instagram.present?

View File

@@ -14,10 +14,4 @@ describe GroupsHelper do
expect(helper.strip_url("example.com")).to eq("example.com")
end
end
describe "link_to_url" do
it "gives a link to an html external url" do
expect(helper.link_to_url("example.com")).to eq('<a href="http://example.com" target="_blank">example.com</a>')
expect(helper.link_to_url("https://example.com/")).to eq('<a href="https://example.com/" target="_blank">example.com/</a>')
end
end
end