Sha256: 5c28a75d094ef3233dfcb13576fa41841c01c7a8b2f3d49e05187f54e92fdd56

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

module JquerySortableTreeHelper
  module RenderNestedOptionsHelper
    class Render
      attr_accessor :h, :options

      def initialize(h, options)
        @h, @options = h, options
      end

      def render_node
        @h.content_tag(:option, options[:node].send(options[:title]), tag_options) + children
      end

      def children
        @options[:children].html_safe
      end

      def tag_options
        opts = { class: "l_#{@options[:level]}", value: @options[:node][:id] }

        if @options[:selected] == @options[:node]
          opts[:class] += ' selected'
          opts[:selected] = :selected
        end
        opts
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jquery_sortable_tree-3.0.0 app/helpers/jquery_sortable_tree_helper/render_nested_options_helper.rb