diff --git a/app/assets/stylesheets/statistics.scss b/app/assets/stylesheets/statistics.scss new file mode 100644 index 00000000..3645fc0b --- /dev/null +++ b/app/assets/stylesheets/statistics.scss @@ -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/ diff --git a/app/controllers/statistics_controller.rb b/app/controllers/statistics_controller.rb new file mode 100644 index 00000000..66ffea02 --- /dev/null +++ b/app/controllers/statistics_controller.rb @@ -0,0 +1,11 @@ +class StatisticsController < ApplicationController + + def policy_class + StatisticsPolicy + end + + def show + authorize self + end + +end diff --git a/app/policies/statistics_policy.rb b/app/policies/statistics_policy.rb new file mode 100644 index 00000000..36ca2b51 --- /dev/null +++ b/app/policies/statistics_policy.rb @@ -0,0 +1,2 @@ +class StatisticsPolicy < AdminOnlyPolicy +end diff --git a/app/views/application/_navigation.html.slim b/app/views/application/_navigation.html.slim index a2604c7a..127e170c 100644 --- a/app/views/application/_navigation.html.slim +++ b/app/views/application/_navigation.html.slim @@ -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) } diff --git a/app/views/statistics/show.html.slim b/app/views/statistics/show.html.slim new file mode 100644 index 00000000..14372a07 --- /dev/null +++ b/app/views/statistics/show.html.slim @@ -0,0 +1 @@ +h1 = t('shared.statistics') diff --git a/config/locales/de.yml b/config/locales/de.yml index ce03d90f..4db92696 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -217,6 +217,8 @@ de: show: Dashboard sessions: destroy_through_lti: Code-Abgabe + statistics: + show: "Statistiken" consumers: show: link: Konsument diff --git a/config/locales/en.yml b/config/locales/en.yml index be92de5b..1a7ef575 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -217,6 +217,8 @@ en: show: Dashboard sessions: destroy_through_lti: Code Submission + statistics: + show: "Statistics" consumers: show: link: Consumer diff --git a/config/routes.rb b/config/routes.rb index 264e7471..21b1b719 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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