Sha256: ba597e9dd0748ce419857937105f7b58e1f938623e39dbc02f54c624915e8e2b

Contents?: true

Size: 877 Bytes

Versions: 4

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true

module LogsExplorer
  module ApplicationHelper
    def icon(name)
      # https://www.iconfinder.com/iconsets/vivid
      raw File.read(File.expand_path(File.dirname(__FILE__) +  "/../../assets/images/#{name}.svg"))
    end

    def insert_css_file(file)
      raw "<style>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/logs_explorer/stylesheets/#{file}")}</style>"
    end

    def insert_js_file(file)
      raw "<script>#{raw File.read File.expand_path(File.dirname(__FILE__) + "/../../views/logs_explorer/javascripts/#{file}")}</script>"
    end

    def format_datetime(e)
      e.strftime("%Y-%m-%d %H:%M:%S")
    end

    def active?(section)
      case section
      when :dashboard
        "is-active" if controller_name == "home" && action_name == "index"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logs_explorer-0.1.4 app/helpers/logs_explorer/application_helper.rb
logs_explorer-0.1.3 app/helpers/logs_explorer/application_helper.rb
logs_explorer-0.1.1 app/helpers/logs_explorer/application_helper.rb
logs_explorer-0.1.0 app/helpers/logs_explorer/application_helper.rb