Sha256: a313402bedc3f329c873dc3b1aeb95fa835e22a65289cada0034281ca0e9d6f2

Contents?: true

Size: 903 Bytes

Versions: 13

Compression:

Stored size: 903 Bytes

Contents

module RailsCoreExtensions
  module ActionViewExtensions
    def textilize(content)
      super(h(content)).html_safe
    end

    # Generates a tooltip with given text
    # text is textilized before display
    def tooltip(hover_element_id, text, title='')
      content = "<div style='width: 25em'>#{textilize(text)}</div>"
      "<script>" +
        "new Tip('#{hover_element_id}', '#{escape_javascript(content)}',"+
        "{title : '#{escape_javascript title}', className: 'silver_smaller_div',"+
        "showOn: 'mouseover', hideOn: { event: 'mouseout' }, fixed: false});"+
      "</script>"
    end

    def boolean_select_tag(name, *args)
      options = args.extract_options!
      options ||= {}
      yes_no_opts = [%w[Yes 1], %w[No 0]]
      option_tags = options_for_select(yes_no_opts, options[:selected])
      select_tag name, option_tags, options.except(:selected)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rails_core_extensions-0.15.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.14.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.13.2 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.13.1 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.13.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.12.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.11.3 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.11.2 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.11.1 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.11.0.beta.11 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.10.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.9.0 lib/rails_core_extensions/action_view_extensions.rb
rails_core_extensions-0.8.0 lib/rails_core_extensions/action_view_extensions.rb