1
0
Эх сурвалжийг харах

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

Thibaut 12 жил өмнө
parent
commit
5885892d53

+ 9 - 7
lib/docs/filters/core/attribution.rb

@@ -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
-      current_url.to_s
-    end
-
-    def attribution_info
+    def attribution_html
       <<-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