Module: SmsOnRails::SmsHelper
- Defined in:
- app/helpers/sms_on_rails/sms_helper.rb
Overview
To change this template, choose Tools | Templates and open the template in the editor.
Instance Method Summary collapse
- #link_to_sms_draft(draft, message = nil) ⇒ Object
- #link_to_sms_phone_number(phone_number) ⇒ Object
- #requires_phone_carrier? ⇒ Boolean
- #send_sms_form_url ⇒ Object
- #service_providers_collection_select(form) ⇒ Object
- #sms_on_rails_status_select(form, options = {}) ⇒ Object
- #staggered_table_rows(objs, &block) ⇒ Object
Instance Method Details
#link_to_sms_draft(draft, message = nil) ⇒ Object
10 11 12 13 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 10 def link_to_sms_draft(draft, =nil) return '' unless draft link_to((||draft.), sms_draft_url(:id => draft)) end |
#link_to_sms_phone_number(phone_number) ⇒ Object
5 6 7 8 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 5 def link_to_sms_phone_number(phone_number) return '' unless phone_number link_to phone_number.human_display, sms_phone_number_url(:id => phone_number) end |
#requires_phone_carrier? ⇒ Boolean
26 27 28 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 26 def requires_phone_carrier? SmsOnRails::ServiceProviders::Base.default_service_provider.requires_carrier? end |
#send_sms_form_url ⇒ Object
30 31 32 33 34 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 30 def send_sms_form_url {:controller => controller_name, :action => :create, :send_immediately => true, :previous_action => (params[:previous_action]|| params[:action])} end |
#service_providers_collection_select(form) ⇒ Object
15 16 17 18 19 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 15 def service_providers_collection_select(form) @@spc_select||= form.select(:sms_service_provider_id, SmsOnRails::ServiceProviders::Base.provider_list.collect{|x| [ x.human_name, x.provider_id ]}, :include_blank => true) end |
#sms_on_rails_status_select(form, options = {}) ⇒ Object
21 22 23 24 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 21 def sms_on_rails_status_select(form, ={}) form.select(:status, form.object.class.locrec_status.values.collect{|x| [x.titleize, x]}, ) end |
#staggered_table_rows(objs, &block) ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 36 def staggered_table_rows(objs, &block) objs.each_with_index do |obj, idx| concat("<tr class=\"#{idx % 2 == 0 ? 'even' : 'odd'}\"") yield(obj) concat("</tr>") end end |