Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 nested_list.gemspec
README.md

Description

nested_list gem is a tool for creating nested cross browser drop downs. It doesn't use any fancy UI, all margins were done with spaces (&nbsp). It is simple and it works.

Install

gem install nested_list

OR

Put this line in your Gemfile: gem 'nested_list'

Then run the bundle command: $ bundle

Example of usage

Array with nested options which using ">" as a delimiter

    @nested_names_arr = []
  @nested_names_arr << {name: "All Categories", id: 'all'}
      @nested_names_arr << {name: "Audio", id: '1'}
    @nested_names_arr << {name: "Audio>Accessorize>Smile", id: '566767'}
    @nested_names_arr << {name: "Audio>Accessorize>Pillow", id: '45255'}
    @nested_names_arr << {name: "Audio>DVD", id: '234245'}
    @nested_names_arr << {name: "Baby", id: '44245tr5'}

Pass it as a parameter and get options for drop down as an output

    nested_list = NestedList.new(@nested_names_arr)
    nested_list.html_options

As a result you will see a drop down like this:

generated drop down

Contributing

if you find a bug or have something to add, please do

Something went wrong with that request. Please try again.