Sha256: a0388031d3cf62ff8929783311d31f7a831256a6267ec37f63741e55577d4e60

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

require 'action_view'

module ActionView
  module Helpers
    module RestBoxHelper
      def self.included(base)
        base.class_eval do
          include InstanceMethods
        end
      end
      module InstanceMethods
        def restbox(options = {})
          content = escape_javascript(options[:content].to_s || '')
          container_class = escape_javascript(options[:container_class].to_s || '')
          params = "content: \"#{content}\""
          params += ", container_class: \"#{container_class}\"" unless container_class.empty?
          "jQuery.restbox({#{params}});"
        end
      end
    end
  end
end

ActionView::Base.class_eval do
  include ActionView::Helpers::RestBoxHelper
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restbox-0.2.0 lib/restbox_view_helper.rb
restbox-0.1.2 lib/restbox_view_helper.rb