Sha256: 0b5e457d0032723c54c0e17ee83208d59c7aa02c41511d7dd39cda1bf5637813

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

module JquerySortableTreeHelper
  module RenderIndentedOptionsHelper
    class Render < JquerySortableTreeHelper::RenderSortableTreeHelper::Render
      def render_node
        h.content_tag(:option, title, tag_options) + children
      end

      def title
        "\u202f" * (@options[:spacing] || 3).to_i * (@options[:level]-1) + node.send(@options[:title])
      end

      def tag_options
        html_options = { value: node.id }

        if options[:selected] == node
          html_options[:selected] = 'selected'
          html_options[:class] = 'selected'
        end
        html_options
      end

      def children
        @options[:children].html_safe
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jquery_sortable_tree-3.1.2 app/helpers/jquery_sortable_tree_helper/render_indented_options_helper.rb
jquery_sortable_tree-3.1.1 app/helpers/jquery_sortable_tree_helper/render_indented_options_helper.rb
jquery_sortable_tree-3.1.0 app/helpers/jquery_sortable_tree_helper/render_indented_options_helper.rb