Sha256: 732fd0d6d17851d344cd02a0e29dc8f605099432b643d8ba48197e98f5bd9d5f

Contents?: true

Size: 990 Bytes

Versions: 13

Compression:

Stored size: 990 Bytes

Contents

module ActionView
  module Helpers
    class FormBuilder
      def wysiwyg(method, options={})
        sanitized_object_name = @object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "")
        sanitized_method_name = method.to_s.sub(/\?$/,"")
        id = "#{sanitized_object_name}_#{sanitized_method_name}"
        if @object.kitsune_admin[:media]
          @template.content_for(:head) do 
            @template.capture do
              "<script>
              $(function() {
                $('textarea.wysiwyg').upload_maker('#{@template.url_for({:id => @object.kitsune_admin[:media].keys.first.to_s.classify, :action=>"new", :controller=>"admin/kitsune/media"})}');
              })
              </script>"
            end
          end
        end
        @template.send('text_area', @object_name, method, objectify_options(options.merge({:class => 'wysiwyg'}))) + @template.content_tag('script', "tinyMCE.execCommand('mceAddControl', true, '#{id}');")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ds-kitsune-0.2.5 lib/kitsune/form_helper_ext.rb
ds-kitsune-0.2.3 lib/kitsune/form_helper_ext.rb
kitsune-0.2.1 lib/kitsune/form_helper_ext.rb
kitsune-0.2.0 lib/kitsune/form_helper_ext.rb
kitsune-0.1.5 lib/kitsune/form_helper_ext.rb
kitsune-0.1.4 lib/kitsune/form_helper_ext.rb
kitsune-0.1.3 lib/kitsune/form_helper_ext.rb
kitsune-0.1.2 lib/kitsune/form_helper_ext.rb
kitsune-0.1.1 lib/kitsune/form_helper_ext.rb
kitsune-0.1.0 lib/kitsune/form_helper_ext.rb
kitsune-0.0.19 lib/kitsune/form_helper_ext.rb
kitsune-0.0.18 lib/kitsune/form_helper_ext.rb
kitsune-0.0.17 lib/kitsune/form_helper_ext.rb