Module: LogsExplorer::ApplicationHelper
- Included in:
- BaseController
- Defined in:
- app/helpers/logs_explorer/application_helper.rb
Instance Method Summary collapse
- #active?(section) ⇒ Boolean
- #format_datetime(e) ⇒ Object
- #icon(name) ⇒ Object
- #insert_css_file(file) ⇒ Object
- #insert_js_file(file) ⇒ Object
Instance Method Details
#active?(section) ⇒ Boolean
22 23 24 25 26 27 |
# File 'app/helpers/logs_explorer/application_helper.rb', line 22 def active?(section) case section when :dashboard "is-active" if controller_name == "home" && action_name == "index" end end |
#format_datetime(e) ⇒ Object
18 19 20 |
# File 'app/helpers/logs_explorer/application_helper.rb', line 18 def format_datetime(e) e.strftime("%Y-%m-%d %H:%M:%S") end |
#icon(name) ⇒ Object
5 6 7 8 |
# File 'app/helpers/logs_explorer/application_helper.rb', line 5 def icon(name) # https://www.iconfinder.com/iconsets/vivid raw File.read(File.(File.dirname(__FILE__) + "/../../assets/images/#{name}.svg")) end |
#insert_css_file(file) ⇒ Object
10 11 12 |
# File 'app/helpers/logs_explorer/application_helper.rb', line 10 def insert_css_file(file) raw "<style>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/logs_explorer/stylesheets/#{file}")}</style>" end |
#insert_js_file(file) ⇒ Object
14 15 16 |
# File 'app/helpers/logs_explorer/application_helper.rb', line 14 def insert_js_file(file) raw "<script>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/logs_explorer/javascripts/#{file}")}</script>" end |