Sha256: 5972b854f945358e7d0f125b3b8b53b3e5853a9ebb4da42f4db6d9576640512f

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

require "spurs/modal/builder"
module Spurs
  module Modal
    module Helper
      def spurs_modal(file_or_partial, object=nil, options={ })
        opts          = Spurs::Modal::default_options.merge(options)
        builder_class = opts.delete(:builder)
        builder       = builder_class.new

        modal_id = "modal_#{SecureRandom::hex(5)}"

        options_for_content = options[:content_options] ? options.delete(:content_options) : { }

        if object == nil
          content = render :file => file_or_partial, :locals => options_for_content
        else
          content = render :object => object, :partial => file_or_partial, :locals => options_for_content
        end


        bm = builder.build_modal(modal_id, content, options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spurs-0.0.1 lib/spurs/modal/helper.rb