Scaffold controller and route

This commit is contained in:
Maximilian Grundke
2018-03-13 16:23:49 +01:00
parent 84bd85703d
commit 7031dd389e
8 changed files with 24 additions and 0 deletions

View 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/

View File

@ -0,0 +1,11 @@
class StatisticsController < ApplicationController
def policy_class
StatisticsPolicy
end
def show
authorize self
end
end

View File

@ -0,0 +1,2 @@
class StatisticsPolicy < AdminOnlyPolicy
end

View File

@ -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) }

View File

@ -0,0 +1 @@
h1 = t('shared.statistics')

View File

@ -217,6 +217,8 @@ de:
show: Dashboard
sessions:
destroy_through_lti: Code-Abgabe
statistics:
show: "Statistiken"
consumers:
show:
link: Konsument

View File

@ -217,6 +217,8 @@ en:
show: Dashboard
sessions:
destroy_through_lti: Code Submission
statistics:
show: "Statistics"
consumers:
show:
link: Consumer

View File

@ -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