Alpha pager?


#1

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


#2

You mean sending/texting to pagers/phones?

http://en.wikipedia.org/wiki/SMS_gateways

has email addys for most carriers…


From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Jonathan L.
Sent: Friday, March 09, 2007 9:07 AM
To: removed_email_address@domain.invalid
Subject: [Rails] alpha pager?

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


#3

Hello,

On 9 Mar 2007, at 17:06, Jonathan L. wrote:

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 = “


(‘A’…‘Z’).to_a.each { |letter|
result << link_to_unless_current(letter, url_for(params.merge
(:letter => letter))) {
#{letter}
}
}
result << ‘


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 S.