Copyright (c) 2008 Samuel Williams.
Development proudly sponsored by Orion Transfer Ltd.
http://www.oriontransfer.co.nz/
===== HTML Helpers ====
As the name implies, HTML Helpers is a library of helper methods for producing nice HTML.
It is still very basic, but provides three things:
==== Tabular Form Builder ====
The tabular form builder creates a
for forms. It's fairly easy to use.
Typically, one creates a form partial
<% f.fieldset do %>
<%= f.error_messages %>
<%= f.text_field :login %>
<%= f.text_field :email %>
<%= f.text_field :password %>
<%= f.check_box :verified %>
<%= f.check_box :deleted %>
<%= f.submit %>
<% end %>
New User
<% table_form_for :user, :url => {:action => :create} do |f| %>
<%= f.render_form %>
<% end %>
==== Icon Tag ====
This helper basically is a substitute for image_tag with a very specific purpose: putting icons on the page.
Most people should be familiar with icon sets such as http://www.famfamfam.com/. It is often useful to specify icons
in a generic way, especially when there are a lot of them.
Icon tag helps to minimize the amount of typing needed to put icons on the page. It also integrates with engines.
For example:
<%= link_if_authorized icon_tag(:edit), edit_user_path(user) %>
This searches through a number of different locations. In this case, #{controller} means "users" and #{icon} means :edit. For plugins, it searches:
- /public/images/#{controller}/#{icon}
- /public/plugin_assets/:plugin_name/images/#{controller}/#{icon}
- /public/images/default/#{icon}
- /public/plugin_assets/:plugin_name/images/default/#{icon}
Icons must be PNG at this time, but this may change in the future.
==== Inside Layout ====
This helper basically allows you to render one layout inside another. For example:
<% inside_layout 'application' do %>
Admin Interface
<%= yield %>
<% end %>
===== License =====
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.