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

Instance Method Details



10
11
12
13
# File 'app/helpers/sms_on_rails/sms_helper.rb', line 10

def link_to_sms_draft(draft, message=nil)
  return '' unless draft
  link_to((message||draft.message), sms_draft_url(:id => draft))
end


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

Returns:

  • (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_urlObject



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, options={})
  form.select(:status, form.object.class.locrec_status.values.collect{|x| [x.titleize, x]},
    options)
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