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' ul.dropdown-menu role='menu'
- if current_user.admin? - if current_user.admin?
li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path) li = link_to(t('breadcrumbs.dashboard.show'), admin_dashboard_path)
li = link_to(t('breadcrumbs.statistics.show'), statistics_path)
li.divider li.divider
- models = [ExecutionEnvironment, Exercise, ExerciseCollection, ProxyExercise, Tag, Consumer, CodeHarborLink, UserExerciseFeedback, - models = [ExecutionEnvironment, Exercise, ExerciseCollection, ProxyExercise, Tag, Consumer, CodeHarborLink, UserExerciseFeedback,
ErrorTemplate, ErrorTemplateAttribute, ExternalUser, FileType, FileTemplate, InternalUser].sort_by {|model| model.model_name.human(count: 2) } 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 show: Dashboard
sessions: sessions:
destroy_through_lti: Code-Abgabe destroy_through_lti: Code-Abgabe
statistics:
show: "Statistiken"
consumers: consumers:
show: show:
link: Konsument link: Konsument

View File

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

View File

@ -42,6 +42,8 @@ Rails.application.routes.draw do
get '/help', to: 'application#help' get '/help', to: 'application#help'
get 'statistics/', to: 'statistics#show'
concern :statistics do concern :statistics do
member do member do
get :statistics get :statistics