Sha256: 56b7c6c4aaa2e1573f18b0765d373569e20e1e8adbec44b59d79d9059d67ce05

Contents?: true

Size: 705 Bytes

Versions: 13

Compression:

Stored size: 705 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

13 entries across 13 versions & 1 rubygems

Version Path
guts-1.4.0 app/helpers/guts/trackers_helper.rb
guts-1.3.6 app/helpers/guts/trackers_helper.rb
guts-1.3.5 app/helpers/guts/trackers_helper.rb
guts-1.3.4 app/helpers/guts/trackers_helper.rb
guts-1.3.3 app/helpers/guts/trackers_helper.rb
guts-1.3.2 app/helpers/guts/trackers_helper.rb
guts-1.3.1 app/helpers/guts/trackers_helper.rb
guts-1.3.0 app/helpers/guts/trackers_helper.rb
guts-1.2.2 app/helpers/guts/trackers_helper.rb
guts-1.2.1 app/helpers/guts/trackers_helper.rb
guts-1.2.0 app/helpers/guts/trackers_helper.rb
guts-1.1.1 app/helpers/guts/trackers_helper.rb
guts-1.1.0 app/helpers/guts/trackers_helper.rb