<commit_before>= Simple Tree

This project rocks and uses MIT-LICENSE.

It contains simple javascripts, stylesheets and helpers for rendering expandable trees.

== Installation

Write in your Gemfile:
  gem "expandable_tree", github: "nirname/expandable_tree"

Add this string to your +application.css+
  //= require expandable_tree/expandable_tree

... and that one to your +application.js+
  //= require expandable_tree/expandable_tree

== Using

Now you can the followin helpers inside your views:
* tree
* node

For example:

== Interaction

<commit_msg>Description<commit_after>= Simple Tree

This project rocks and uses MIT-LICENSE.

It contains simple javascripts, stylesheets and helpers for rendering expandable trees.

== Installation

Write in your Gemfile:
  gem "simple_tree", github: "nirname/simple_tree"

Add this string to your +application.css+
  //= require simple_tree/simple_tree

... and that one to your +application.js+
  //= require simple_tree/simple_tree

== Using

Now you can the followin helpers inside your views:
* tree
* node

For example (using 'haml'):

  = simple_tree do
    = node "First node" do
      = node "Sub-node"
    = node "Second node"

... produces html code that will be similar to the one below:

  <ul class="simple-tree ">
    <li class="node expand-opened">
        ... First node ...
      <ul class="descendants">
        <li class="node expand-leaf">
            ... Sub-node ...
        </li>
      </ul>
    </li>
    <li class="node expand-leaf">
        ... Second node ...
    </li>
  </ul>

You can pass different html options to tree and its' nodes:

  = simple_tree class: "my_simple_tree" do
    = node "My node", "data-id" => 1

== Interaction

It can be easily integrated with existing gems, such as sortable_tree, for example:

  = simple_tree do
    = just_tree @your_tree, render_module: YourTreeHelper %>

... where YourTreeHelper module might looks like:

  module YourTreeHelper
    class Render
      class << self
        attr_accessor :h, :options
        def render_node(h, options)
          @h, @options = h, options
          node_content = options[:node].name)
          if options[:children].blank?
            h.simple_node(node_content) # draw leaf
          else
            h.simple_node(node_content) do # draw node
              h.raw options[:children]
            end
          end
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.09676079734219269, 'fraction_numerical': 0.0004152823920265781, 'mean_word_length': 2.6891271056661563, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2163456', 'n_tokens_mistral': 722, 'n_tokens_neox': 701, 'n_words': 248}