Module: IshManager::ApplicationHelper
- Defined in:
- app/helpers/ish_manager/application_helper.rb
Instance Method Summary collapse
-
#api_map_path(map) ⇒ Object
api paths.
- #api_marker_path(marker) ⇒ Object
- #current_layout ⇒ Object
- #pp_amount(a) ⇒ Object
- #pp_date(a) ⇒ Object
- #pp_errors(errors) ⇒ Object
- #pretty_date(date) ⇒ Object
- #user_path(user) ⇒ Object
Instance Method Details
#api_map_path(map) ⇒ Object
api paths
46 47 48 |
# File 'app/helpers/ish_manager/application_helper.rb', line 46 def api_map_path map "/api/maps/view/#{map.slug}" end |
#api_marker_path(marker) ⇒ Object
50 51 52 |
# File 'app/helpers/ish_manager/application_helper.rb', line 50 def api_marker_path marker "/api/markers/view/#{marker.id}" end |
#current_layout ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/ish_manager/application_helper.rb', line 4 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
39 40 41 |
# File 'app/helpers/ish_manager/application_helper.rb', line 39 def pp_amount a "$ #{'%.2f' % a}" end |
#pp_date(a) ⇒ Object
37 |
# File 'app/helpers/ish_manager/application_helper.rb', line 37 def pp_date a; pretty_date a; end |
#pp_errors(errors) ⇒ Object
20 21 22 |
# File 'app/helpers/ish_manager/application_helper.rb', line 20 def pp_errors errors return errors end |
#pretty_date(date) ⇒ Object
16 17 18 |
# File 'app/helpers/ish_manager/application_helper.rb', line 16 def pretty_date input return input.strftime("%Y-%m-%d") end |
#user_path(user) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/ish_manager/application_helper.rb', line 24 def user_path user if user.class == 'String' "/users/#{user}" elsif user.class == User "/users/#{user.id}" elsif user.class == NilClass "/users" end end |