Sha256: 58cdaae2d491835ca7bf8db904f014ec89d5d39a604b0fb4063e7195c782ac59

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

module Guts
  # View helpers for trackers/logs
  module TrackersHelper
    # Renders a track's partial
    # @param [Object] track the track's object record
    # @param [String, nil] layout the layout to wrap the partial in
    # @see TrackerHelper#track_view_for
    def render_track(track, layout = nil)
      return unless track.is_a? Guts::Tracker

      render partial: track_view_for(track), layout: layout, locals: {track: track}
    end
    
    # Determines the partial template for a track object
    # @return [String] compiled track partial template path
    def track_view_for(track)
      "guts/trackers/actions/#{track.object_type.demodulize.downcase}_#{track.action}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guts-1.0.8 app/helpers/guts/trackers_helper.rb
guts-1.0.7 app/helpers/guts/trackers_helper.rb
guts-1.0.5 app/helpers/guts/trackers_helper.rb
guts-1.0.3 app/helpers/guts/trackers_helper.rb