Sha256: 242b4834ca02bbb162a3f81fe482f1566eaa5c3f1701f87bd0887f5260e7fdd0
Contents?: true
Size: 1.17 KB
Versions: 62
Compression:
Stored size: 1.17 KB
Contents
module Workarea module Admin module Visiting extend ActiveSupport::Concern included do helper_method :most_visited after_action :save_visit end def most_visited @most_visited ||= User::AdminVisit.most_visited(current_user.id) end private def save_visit return unless save_visit? User::AdminVisit.create!( name: response_title, path: request.path, user_id: current_user.id ) end def save_visit? !request.xhr? && request.get? && !response.redirect? && !request.path.in?(excluded_paths) && response_title.present? end def excluded_paths Workarea.config.admin_visit_excluded_paths.map do |path_method| send(path_method) end end def response_title @response_title ||= Nokogiri::XML(response.body) .css('title') .try(:text) .to_s .gsub(/\[#{Rails.env.upcase}\]/, '') .strip end end end end
Version data entries
62 entries across 62 versions & 1 rubygems