Skip to content
/ css_bars Public

Rails helper, provides simple colorfull horizontal css bar

License

Notifications You must be signed in to change notification settings

cheef/css_bars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css_bars
===============
Rails helper, provides colorfull horizontal css bar with smart color generation system.

Installation 
===============
rake css_bars:install
(it's copy stylesheet and config file)

Stylesheet
===============
You can choose a kind of including stylesheet:
1) without special helper in layout header
 horisontal_bar data, :head       => send stylesheet to you yield(:head) once

2) with special helper
<html>
...
  <head><%= css_bars_include_tag %></head>
  <body>
    <%= horisontal_bar data %>
..

Color system
===============
There are two colors modes:
1) colors choosing by scheme
2) colors range is generating in choosen range

In your "rails_root/config/initializers/css_bars_config.rb" file you can setup default values and default color system.

Scheme mode
===============
You must setup variable Che::CssBars.css_bars_options[:default_color_scheme] of color array, and use like this:

horisontal_bar [["First bar", 30], ["Second bar", 50]], :head, :color_scheme
Color array size equal color steps:
  size 2 equal 2 colored bar
  size 10 equal 10 colored bar

Generator mode
===============
You must setup two variables:
 Che::CssBars.css_bars_options[:default_generator_colors] - color borders
 Che::CssBars.css_bars_options[:default_generator_points] - steps

10 steps equal 10 colored bar

Data
===============
"horisontal_bar data"

Variable "data" must be an array of arrays, like [["A", 50], ["B", 40]], where A - label and 50 - percent.
Label may be any string, but percent must be an integer in range 0..100

Examples
===============
horisontal_bar [["First bar", 50], ["Second bar", 50]], :head

horisontal_bar [["First bar", 20], ["Second bar", 70]], :head, :color_generator

Notes && TODOS
===============
- There only horisontal bar
- No rspec tests

Copyright (c) 2008 Ivan Garmatenko <cheef.che@gmail.com>, released under the MIT license

About

Rails helper, provides simple colorfull horizontal css bar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages