소스 검색

Autolink url columns

Andrew Kane 8 년 전
부모
커밋
d59da0ab68
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      app/helpers/blazer/base_helper.rb

+ 4 - 0
app/helpers/blazer/base_helper.rb

@@ -8,9 +8,13 @@ module Blazer
       end
     end
 
+    BLAZER_URL_REGEX = /\Ahttps?:\/\/[\S]+\z/
+
     def blazer_format_value(key, value)
       if value.is_a?(Integer) && !key.to_s.end_with?("id")
         number_with_delimiter(value)
+      elsif value =~ BLAZER_URL_REGEX
+        link_to value, value, target: "_blank"
       else
         value
       end