Add more data routes

This commit is contained in:
Maximilian Grundke
2018-04-11 13:54:38 +02:00
parent 2a4e9bc94b
commit 5ae92dc484
5 changed files with 33 additions and 6 deletions

View File

@ -1,12 +1,13 @@
class StatisticsController < ApplicationController
include StatisticsHelper
before_action :authorize!, only: [:graphs, :user_activity, :rfc_activity]
def policy_class
StatisticsPolicy
end
def show
authorize self
respond_to do |format|
format.html
format.json { render(json: statistics_data) }
@ -14,11 +15,23 @@ class StatisticsController < ApplicationController
end
def graphs
authorize self
end
def user_activity
respond_to do |format|
format.html
format.json { render(json: graph_live_data) }
format.json { render(json: user_activity_live_data) }
end
end
def rfc_activity
respond_to do |format|
format.json { render(json: rfc_activity_live_data) }
end
end
def authorize!
authorize self
end
private :authorize!
end