Routes, empty views and controller changes for statistics concerning external_users, exercises and external_users having exercises
This commit is contained in:
@@ -7,6 +7,7 @@ class ExercisesController < ApplicationController
|
||||
before_action :handle_file_uploads, only: [:create, :update]
|
||||
before_action :set_execution_environments, only: [:create, :edit, :new, :update]
|
||||
before_action :set_exercise, only: MEMBER_ACTIONS + [:clone, :implement, :run, :statistics, :submit, :reload]
|
||||
before_action :set_external_user, only: [:statistics]
|
||||
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
||||
before_action :set_teams, only: [:create, :edit, :new, :update]
|
||||
|
||||
@@ -125,6 +126,14 @@ class ExercisesController < ApplicationController
|
||||
end
|
||||
private :set_exercise
|
||||
|
||||
def set_external_user
|
||||
if params[:external_user_id]
|
||||
@external_user = ExternalUser.find(params[:external_user_id])
|
||||
authorize!
|
||||
end
|
||||
end
|
||||
private :set_exercise
|
||||
|
||||
def set_file_types
|
||||
@file_types = FileType.all.order(:name)
|
||||
end
|
||||
@@ -143,6 +152,11 @@ class ExercisesController < ApplicationController
|
||||
end
|
||||
|
||||
def statistics
|
||||
if(@external_user)
|
||||
render 'exercises/external_users/statistics'
|
||||
else
|
||||
render 'exercises/statistics'
|
||||
end
|
||||
end
|
||||
|
||||
def submit
|
||||
|
@@ -13,4 +13,10 @@ class ExternalUsersController < ApplicationController
|
||||
@user = ExternalUser.find(params[:id])
|
||||
authorize!
|
||||
end
|
||||
|
||||
def statistics
|
||||
@user = ExternalUser.find(params[:id])
|
||||
authorize!
|
||||
end
|
||||
|
||||
end
|
||||
|
@@ -1,2 +1,5 @@
|
||||
class ExternalUserPolicy < AdminOnlyPolicy
|
||||
def statistics?
|
||||
admin?
|
||||
end
|
||||
end
|
||||
|
1
app/views/exercises/external_users/statistics.html.slim
Normal file
1
app/views/exercises/external_users/statistics.html.slim
Normal file
@@ -0,0 +1 @@
|
||||
h1 = "#{@exercise} for external user #{@external_user}"
|
2
app/views/external_users/statistics.html.slim
Normal file
2
app/views/external_users/statistics.html.slim
Normal file
@@ -0,0 +1,2 @@
|
||||
h1 = @user
|
||||
H2 = 'Hallo'
|
Reference in New Issue
Block a user