Class: UserPattern::DashboardController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/user_pattern/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



10
11
12
13
14
# File 'app/controllers/user_pattern/dashboard_controller.rb', line 10

def index
  UserPattern.buffer.flush
  load_stats
  apply_sort!
end

#stylesheetObject



23
24
25
26
27
# File 'app/controllers/user_pattern/dashboard_controller.rb', line 23

def stylesheet
  css_path = UserPattern::Engine.root.join('app', 'assets', 'stylesheets', 'user_pattern', 'dashboard.css')
  expires_in 1.hour, public: true
  render plain: css_path.read, content_type: 'text/css'
end

#violationsObject



16
17
18
19
20
21
# File 'app/controllers/user_pattern/dashboard_controller.rb', line 16

def violations
  @violations = Violation
                .recent(params[:days]&.to_i || 7)
                .order(occurred_at: :desc)
  @violations = @violations.where(model_type: params[:model_type]) if params[:model_type].present?
end