Don't insert attribution link when the base URL is localhost

pull/15/head
Thibaut 11 years ago
parent 24347f312b
commit 5885892d53

@ -1,7 +1,7 @@
module Docs module Docs
class AttributionFilter < Filter class AttributionFilter < Filter
def call def call
html << attribution_info if attribution html << attribution_html if attribution
html html
end end
@ -9,19 +9,21 @@ module Docs
context[:attribution] context[:attribution]
end end
def attribution_url def attribution_html
current_url.to_s
end
def attribution_info
<<-HTML.strip_heredoc <<-HTML.strip_heredoc
<div class="_attribution"> <div class="_attribution">
<p class="_attribution-p"> <p class="_attribution-p">
#{attribution.delete "\n"}<br> #{attribution.delete "\n"}<br>
<a href="#{attribution_url}" class="_attribution-link">#{attribution_url}</a> #{attribution_link}
</p> </p>
</div> </div>
HTML HTML
end end
def attribution_link
unless base_url.host == 'localhost'
%(<a href="#{current_url}" class="_attribution-link">#{current_url}</a>)
end
end
end end
end end

Loading…
Cancel
Save