Sha256: 6fc28ab6129af0be9142099c5e22c14ed11bc1e477cac7f079314d96b9203fae

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

module AreeyaTextile::ViewExtensions
  module TextileArea
    def textile_area(object_name, method, options={})
      disable = options.delete(:disable) || {}
      toolbar = textile_toolbar(options[:id] || "#{object_name}_#{method}", disable)
      "<div class=\"areeya_textile\">#{toolbar}</div>" <<
      "<div class=\"textile_area\">#{text_area(object_name, method, options)}</div>"
    end
    
    def textile_toolbar(id, disable)
      html = javascript_include_tag("areeya_textile")
      html << link_to_function(image_tag("areeya_textile/bold.png", :size => "23x22", :title => "Pogrubione"), "surround_selection('#{id}', '*', '*')")
      html << "&nbsp;"
      html << link_to_function(image_tag("areeya_textile/italic.png", :size => "23x22", :title => "Kursywa"), "surround_selection('#{id}', '_', '_')")
      html << "&nbsp;"
      html << link_to_function(image_tag("areeya_textile/underline.png", :size => "23x22", :title => "Podkreślenie"), "surround_selection('#{id}', '+', '+')")
      html << "&nbsp;"
      html << link_to_function(image_tag("areeya_textile/hyperlink.png", :size => "23x22", :title => "Link"), "insert_hyperlink('#{id}')")
      html << "&nbsp;"
      unless disable == :image
        html << link_to_function(image_tag("areeya_textile/image.png", :size => "23x22", :title => "Obrazek"), "insert_image('#{id}')")
        html << "&nbsp;&nbsp;"
      end
      html << "<small>(" << link_to("Textile Reference", "http://hobix.com/textile/", :target => "_blank") << ")</small>"
    end
  end
  
  module FormBuilder
    def textile_area(method, options={})
      @template.textile_area(@object_name, method, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdzioba-areeya_textile-1.1.0 lib/view_extensions.rb