Sha256: d2500f1f74836ab6dbfe03ea3e4d6041f46f0872161dd60db2034985768a9770

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

module GoogleVisualr
  module Rails
    module ViewHelper
      extend ActiveSupport::Concern

      included do
        # Rails 5 compatibility fix
        if respond_to?(:helper_method)
          helper_method "render_chart"
        end
      end

      def render_chart(chart, dom, options={})
        script_tag = options.fetch(:script_tag) { true }
        if script_tag
          chart.to_js(dom).html_safe
        else
          html = ""
          html << chart.load_js(dom)
          html << chart.draw_js(dom)
          html.html_safe
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_visualr_rails5-2.5.2 lib/google_visualr/app/helpers/view_helper.rb