is there such thing as an alphabetical pager helper or plugin?
or even a how-to article?
googling comes up empty for me
tia
linoj
is there such thing as an alphabetical pager helper or plugin?
or even a how-to article?
googling comes up empty for me
tia
linoj
You mean sending/texting to pagers/phones?
http://en.wikipedia.org/wiki/SMS_gateways
has email addys for most carriers….
Hello,
is there such thing as an alphabetical pager helper or plugin?
or even a how-to article?
googling comes up empty for me
Assuming you're after a way of paginating by first letter, here are a few lines of code which I wrote to do this:
routes.rb:
map.customers 'customers/:letter', :controller => 'customers', :letter => /[a-zA-Z]/
customers_controller.rb:
def index
# Paginate alphabetically by surname.
if params[:letter] =~ /^[A-Z]$/i
letter = params[:letter].upcase
else
letter = 'A'
end
@customers = Customer.all_by_name "contacts.last_name like '#{letter}%'" # My customers table is joined to my contacts table
end
customers_helper.rb:
def glossary_index(params)
result = "<p class='glossary-index'>"
('A'..'Z').to_a.each { |letter|
result << link_to_unless_current(letter, url_for(params.merge(:letter => letter))) {
"<span>#{letter}</span>"
}
}
result << '</p>'
end
stylesheet.css:
p.glossary-index a { margin: 0.6em; }
p.glossary-index span { margin: 0.6em; }
index.rhtml:
<%= glossary_index :controller => 'customers' %>
<% for customer in @customers %>
...
<% end %>
Hope that helps.
Regards,
Andy Stewart