Scaffold controller and route
This commit is contained in:
3
app/assets/stylesheets/statistics.scss
Normal file
3
app/assets/stylesheets/statistics.scss
Normal file
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the Statistics controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
11
app/controllers/statistics_controller.rb
Normal file
11
app/controllers/statistics_controller.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class StatisticsController < ApplicationController
|
||||
|
||||
def policy_class
|
||||
StatisticsPolicy
|
||||
end
|
||||
|
||||
def show
|
||||
authorize self
|
||||
end
|
||||
|
||||
end
|
2
app/policies/statistics_policy.rb
Normal file
2
app/policies/statistics_policy.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class StatisticsPolicy < AdminOnlyPolicy
|
||||
end
|
@ -7,6 +7,7 @@
|
||||
ul.dropdown-menu role='menu'
|
||||
- if current_user.admin?
|
||||
li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path)
|
||||
li = link_to(t('breadcrumbs.statistics.show'), statistics_path)
|
||||
li.divider
|
||||
- models = [ExecutionEnvironment, Exercise, ExerciseCollection, ProxyExercise, Tag, Consumer, CodeHarborLink, UserExerciseFeedback,
|
||||
ErrorTemplate, ErrorTemplateAttribute, ExternalUser, FileType, FileTemplate, InternalUser].sort_by {|model| model.model_name.human(count: 2) }
|
||||
|
1
app/views/statistics/show.html.slim
Normal file
1
app/views/statistics/show.html.slim
Normal file
@ -0,0 +1 @@
|
||||
h1 = t('shared.statistics')
|
@ -217,6 +217,8 @@ de:
|
||||
show: Dashboard
|
||||
sessions:
|
||||
destroy_through_lti: Code-Abgabe
|
||||
statistics:
|
||||
show: "Statistiken"
|
||||
consumers:
|
||||
show:
|
||||
link: Konsument
|
||||
|
@ -217,6 +217,8 @@ en:
|
||||
show: Dashboard
|
||||
sessions:
|
||||
destroy_through_lti: Code Submission
|
||||
statistics:
|
||||
show: "Statistics"
|
||||
consumers:
|
||||
show:
|
||||
link: Consumer
|
||||
|
@ -42,6 +42,8 @@ Rails.application.routes.draw do
|
||||
|
||||
get '/help', to: 'application#help'
|
||||
|
||||
get 'statistics/', to: 'statistics#show'
|
||||
|
||||
concern :statistics do
|
||||
member do
|
||||
get :statistics
|
||||
|
Reference in New Issue
Block a user