Sha256: e3be42b4df8b7aa430c4d7f034b52b8bea6051d79ea705aa34cb9e93405a6df6
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require_dependency "audit_rails/application_controller" module AuditRails class AuditsController < ApplicationController def index @audits = AuditRails::Audit.reverse_chronological respond_to do |format| format.html # index.html.erb format.json { render json: @audits } format.xls { send_data @audits.to_xls(:columns => [:user_name, :action, :description, :created_at], :headers => ['User name', 'Action', 'Details', 'When?']), filename: 'audits.xls'} end end def create add_to_audit("visit-site", "xyz", "Fake User") render :nothing => true, :status => 200, :content_type => 'text/html' end def analytics @range_begin = params[:analytics] ? params[:analytics][:range_begin] : nil @range_end = params[:analytics] ? params[:analytics][:range_end] : nil @analysis_by_user_name = AuditRails::Audit.in_range(@range_begin, @range_end).analysis_by_user_name @analysis_by_page_views = AuditRails::Audit.in_range(@range_begin, @range_end).analysis_by_page_views @total = AuditRails::Audit.in_range(@range_begin, @range_end).count @no_audits = AuditRails::Audit.count == 0 end end end
Version data entries
3 entries across 3 versions & 1 rubygems