Module: IshManager::ApplicationHelper

Defined in:
app/helpers/ish_manager/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#api_map_path(map) ⇒ Object

api paths



8
9
10
# File 'app/helpers/ish_manager/application_helper.rb', line 8

def api_map_path map
  "/api/maps/view/#{map.slug}"
end

#api_marker_path(marker) ⇒ Object



12
13
14
# File 'app/helpers/ish_manager/application_helper.rb', line 12

def api_marker_path marker
  "/api/markers/view/#{marker.id}"
end

#current_layoutObject



17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/ish_manager/application_helper.rb', line 17

def current_layout
  layout = controller.class.send(:_layout)
  if layout.nil?
    '<default>'
  elsif layout.instance_of? String or layout.instance_of? Symbol
    layout
  else
    layout.inspect
    # File.basename(layout.identifier).split('.').first
  end
end

#pp_amount(a) ⇒ Object



56
57
58
# File 'app/helpers/ish_manager/application_helper.rb', line 56

def pp_amount a
  "$ #{'%.2f' % a}"
end

#pp_date(a) ⇒ Object



54
# File 'app/helpers/ish_manager/application_helper.rb', line 54

def pp_date a; pretty_date a; end

#pp_errors(errors) ⇒ Object



37
38
39
# File 'app/helpers/ish_manager/application_helper.rb', line 37

def pp_errors errors
  return errors
end

#pretty_date(date) ⇒ Object

def email_contexts_for_lead_path lead

"/manager/email_contexts/for_lead/#{lead.id.to_s}"

end



33
34
35
# File 'app/helpers/ish_manager/application_helper.rb', line 33

def pretty_date input
  return input.strftime("%Y-%m-%d")
end

#user_path(user) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'app/helpers/ish_manager/application_helper.rb', line 41

def user_path user
  if user.class == 'String'
    "/users/#{user}"
  elsif user.class == User
    "/users/#{user.id}"
  elsif user.class == NilClass
    "/users"
  end
end