Powered By Blogger

quinta-feira, 22 de janeiro de 2009

will_paginate styling

Other thing that I tried to do and spent a little time, like 30minutes to discover that it was soooooooo easy, is how to style will_paginate

I used paginate.css file in /vendor/pugins/will_paginate/examples
and it was so easy, wished that I knew it before...

include the css in your layout and paginate with one more option :class

<%= will_paginate @things, options = { :previous_label => "Anterior", :next_label => "Próximo", :class => "digg_pagination"} %>

the result:

select without submit Rails

I tried to submit a select at a page without using a submit button
in my view and I come to this, and works all right for me..
controller:
@my_array = [["select one value",-1],["ginger",1],["pepper",2],["mustard",3]]

view:
<% form_for :my_form, :html => {:id => "my_form"},
:url => {:action => :receive_select} do |f| %>

<%= select :selection, :id, @my_array, {:selected => -1},
{:onchange =>"if (confirm(\"Confirm?\")) {this.form.submit();}"} %>
<% end %>