Sha256: 031cc99eb3ba6889a5fa74db69c6c1ec56e2ca91c24b9e761a17c7122c3df48c

Contents?: true

Size: 983 Bytes

Versions: 3

Compression:

Stored size: 983 Bytes

Contents

module ForemanHostReports
  module HostsHelperExtensions
    extend ActiveSupport::Concern

    module Overrides
      def last_report_column(record)
        opts = { :rel => "twipsy" }
        date = record.last_report.nil? ? '' : "#{date_time_absolute_value(record.last_report)}, "
        time = record.last_report? ? date_time_relative_value(record.last_report) : ""
        if @last_report_ids[record.id]
          opts["data-original-title"] = date + _("view last report details")
          link_to_if_authorized(time, hash_for_host_report_path(:id => record.last_host_report_object_any_format&.id), opts)
        else
          opts.merge!(:disabled => true, :class => "disabled", :onclick => 'return false')
          opts["data-original-title"] = date + _("report already deleted") unless record.last_report.nil?
          link_to_if_authorized(time, hash_for_host_reports_path, opts)
        end
      end
    end

    included do
      prepend Overrides
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_host_reports-1.0.2 app/helpers/concerns/foreman_host_reports/hosts_helper_extensions.rb
foreman_host_reports-1.0.1 app/helpers/concerns/foreman_host_reports/hosts_helper_extensions.rb
foreman_host_reports-1.0.0 app/helpers/concerns/foreman_host_reports/hosts_helper_extensions.rb