Link and form
Version
This document applies to Rubricks-0.5.x
Link
Rails has helper tags to render hyperlink as follow.
- link_to
- link_to_remote
Rubricks has other helper tags as follow, these inherit link_to_remote.
- link_to_main
- link_to_self
For example, these two helper tags render same html tags.
1. <%= link_to_remote 'link', :url => {:controller => '/sample/index', :action => 'show'}, :update => 'rubricks_partition_m' %>
2. <%= link_to_main 'link', :url => {:controller => '/sample/index', :action => 'show'} %>
To obtain similar behavior, you can write using link_to as follows. But overhead because of rendering other partition.
3. <%= link_to 'link', :controller => '/sample/index', :main => '_show' %>
Additionally, using link_to_self in some block, update itself.
4. <%= link_to_self 'update itself', :url => {:controller => '/sample/index', :action => 'show'} %>
Form
Rails has helper tags to render form as follow.
- form_tag
- form_remote_tag
Rubricks has other helper tags as follow, these inherit form_remote_tag.
- form_main_tag
- form_self_tag
For example, these two helper tags render same html tags.
1. <%= form_remote_tag :url => {:controller => '/sample/index', :action => 'update'}, :update => 'rubricks_partition_m' %>
2. <%= form_main_tag :url => {:controller => '/sample/index', :action => 'update'} %>
You can write as follows as well as link_to.
3. <%= form_tag :controller => '/sample/index', :action => 'update' %> ==================================================================== def update ...... redirect_to :controller => '/sample/index', :main => '_main' end
Additionally, using form_self_tag in some block, update itself.
4. <%= form_self_tag 'update itself', :url => {:controller => '/sample/index', :action => 'show'} %>
Paginate
Rails has helper tag to render paginate links.
- pagination_links
Rubricks has other helper tag as follow, this is like the relation of "link_to_remote" and "link_to".
<%= pagination_remote_links(@pages, :params => {:update => 'rubricks_partition_m', :url => {:controller => '/sample/index', :action => 'show'}}) %>
