rules_view

To add the rules view to you application


> script/rails generate rules_view:install

> mkdir public/javascripts/jquery
> curl http://github.com/rails/jquery-ujs/raw/master/src/rails.js > public/javascripts/rails.js
> curl http://code.jquery.com/jquery-1.4.3.min.js > public/javascripts/jquery/jquery-1.4.3.min.js
> curl http://github.com/malsup/blockui/raw/master/jquery.blockUI.js?v2.31 > public/javascripts/jquery/jquery.blockUI.js
> curl http://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip  > public/javascripts/jquery/jquery.fancybox-1.3.1.zip
> unzip public/javascripts/jquery/jquery.fancybox-1.3.1.zip -d public/javascripts/jquery  
> rm public/javascripts/jquery/jquery.fancybox-1.3.1.zip

> mkdir public/stylesheets/blueprint
> mkdir public/stylesheets/blueprint/src
> curl http://github.com/joshuaclayton/blueprint-css/raw/master/blueprint/ie.css > public/stylesheets/blueprint/ie.css
> curl http://github.com/joshuaclayton/blueprint-css/raw/master/blueprint/print.css > public/stylesheets/blueprint/print.css
> curl http://github.com/joshuaclayton/blueprint-css/raw/master/blueprint/screen.css > public/stylesheets/blueprint/screen.css  
> curl http://github.com/joshuaclayton/blueprint-css/raw/master/blueprint/src/grid.png > public/stylesheets/blueprint/src/grid.png

Then set the layout to use in the controller


class MyCoolController < ApplicationController
  layout 'rules_view'
  ...

To install and modify the rules_view layout


> script/rails generate rules_view:layout [layout_name]

See doc/README.rules_view for usage and instructions

form_styles


- re_build_form_field  (value options)  # options :class, :id, :disabled, :span
- re_build_form_label  (value options)  # options :class, :id, :disabled, :span, :error, :required
- re_build_form_data   (value options)   # options :class, :id, :disabled, :span, :error, :required, :hint, :text

form_builder


- re_form_for          (record_or_name_or_array, *args, &proc)
- re_fields_for        (record_or_name_or_array, *args, &proc)
- re_form_remote_for   (record_or_name_or_array, *args, &proc)  
- re_remote_form_for   (record_or_name_or_array, *args, &proc)

- text_field              (name, value, *args)
- password_field          (name, value, *args)
- file_field              (name, value, *args)
- text_area               (name, value, *args)
- select                  (name, value, *args)
- date_select             (name, value, *args)
- datetime_select         (name, value, *args)
- time_select             (name, value, *args)
- time_zone_select        (name, value, *args)  
- check_box               (name, value = "1", checked = false, options = {})

form_fields


- re_text_field        (label, name, value, *args)
- re_password_field    (label, name, value, *args)
- re_file_field        (label, name, value, *args)
- re_text_area         (label, name, value, *args)
- re_select            (label, name, value, *args)
- re_date_select       (label, name, value, *args)
- re_datetime_select   (label, name, value, *args)
- re_time_select       (label, name, value, *args)
- re_time_zone_select  (label, name, value, *args)  
- re_check_box         (label, name, value = "1", checked = false, options = {})
- re_form_text         (label, text = "", options = {})
- re_form_blank        (options = {})

alert


- re_alert
- re_alert_js

boxes


- re_whitebox(&block)
- re_shadowbox(&block)  

buttons


- re_button_submit(title, color, options ={})

- re_button_submit_gray(title, options = {})
- re_button_submit_blue(title, options = {})
- re_button_submit_green(title, options = {})
- re_button_submit_orange(title, options = {})
- re_button_submit_red(title, options = {})

- re_button_link(title, url, color, options = {})

- re_button_link_gray(title, url, options = {})
- re_button_link_blue(title, url, options = {})
- re_button_link_green(title, url, options = {})
- re_button_link_orange(title, url, options = {})
- re_button_link_red(title, url, options = {})

- re_add_link(title, id) 
- re_remove_link(title, object_name, id)
- re_remove_field(object_name, id)

- re_button_add(url, options = {})
- re_button_remove(url, options = {})
- re_button_select(url, options = {})
- re_button_checked(url, options = {})
- re_button_unchecked(url, options = {})

navigate


- re_breadcrumbs       (*links)
- re_breadcrumbs_right (*links)

defer


- set_re_javascript_include  (javascript_include_or_array)
- set_re_breadcrumbs         (*links)
- set_re_breadcrumbs_right   (*links)

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 Chris Douglas. See LICENSE for details.