Module: SweetStaging::ApplicationHelper
- Included in:
- BaseController
- Defined in:
- app/helpers/sweet_staging/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
20 21 22 23 24 25 |
# File 'app/helpers/sweet_staging/application_helper.rb', line 20 def active?(section) case section when :dashboard "is-active" if controller_name == "home" && action_name == "index" end end |
#format_datetime(e) ⇒ Object
16 17 18 |
# File 'app/helpers/sweet_staging/application_helper.rb', line 16 def format_datetime(e) e.strftime("%Y-%m-%d %H:%M:%S") end |
#icon(name) ⇒ Object
3 4 5 6 |
# File 'app/helpers/sweet_staging/application_helper.rb', line 3 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
8 9 10 |
# File 'app/helpers/sweet_staging/application_helper.rb', line 8 def insert_css_file(file) raw "<style>#{raw File.read File.(File.dirname(__FILE__) + "/../../views/sweet_staging/stylesheets/#{file}")}</style>" end |
#insert_js_file(file) ⇒ Object
12 13 14 |
# File 'app/helpers/sweet_staging/application_helper.rb', line 12 def insert_js_file(file) raw "<script>#{raw File.read File.(File.dirname(__FILE__) + "/../../views/sweet_staging/javascripts/#{file}")}</script>" end |