Sha256: 06c70c8a34f6bfdc08b43f47cb72c84b42a3c2197493e9b4c4c237156503b826
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module Blazer module BaseHelper def blazer_title(title = nil) if title content_for(:title) { title } else content_for?(:title) ? content_for(:title) : nil end end BLAZER_URL_REGEX = /\Ahttps?:\/\/[\S]+\z/ BLAZER_IMAGE_EXT = %w[png jpg jpeg gif] def blazer_format_value(key, value) if value.is_a?(Numeric) && !key.to_s.end_with?("id") && !key.to_s.start_with?("id") number_with_delimiter(value) elsif value =~ BLAZER_URL_REGEX # see if image or link if Blazer.images && (key.include?("image") || BLAZER_IMAGE_EXT.include?(value.split(".").last.split("?").first.try(:downcase))) link_to value, target: "_blank" do image_tag value, referrerpolicy: "no-referrer" end else link_to value, value, target: "_blank" end else value end end def blazer_maps? Blazer.mapbox_access_token.present? end def blazer_js_var(name, value) "var #{name} = #{json_escape(value.to_json(root: false))};".html_safe end def blazer_series_name(k) k.nil? ? "null" : k.to_s end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blazer-2.2.1 | app/helpers/blazer/base_helper.rb |
blazer-2.2.0 | app/helpers/blazer/base_helper.rb |
blazer-2.1.0 | app/helpers/blazer/base_helper.rb |