Skip to content
Snippets Groups Projects
Commit 4fff19b7 authored by pabois's avatar pabois
Browse files

dashboards

parent 7124979d
No related branches found
No related tags found
No related merge requests found
class Admin::Administration::DashboardController < Admin::Administration::ApplicationController
def index
raise_403_unless feature_administration?
@namespace = Administration
breadcrumb
render 'admin/dashboard/namespace'
......
class Admin::Communication::DashboardController < Admin::Communication::ApplicationController
def index
raise_403_unless feature_communication?
@namespace = Communication
breadcrumb
render 'admin/dashboard/namespace'
......
class Admin::Education::DashboardController < Admin::Education::ApplicationController
def index
raise_403_unless feature_education?
@namespace = Education
breadcrumb
render 'admin/dashboard/namespace'
......
class Admin::Education::TeachersController < Admin::Education::ApplicationController
before_action :load_teacher, only: [:show, :edit, :update]
load_and_authorize_resource class: University::Person::Teacher,
through: :current_university,
through_association: :people
has_scope :for_search_term
has_scope :for_program
......@@ -47,14 +49,6 @@ class Admin::Education::TeachersController < Admin::Education::ApplicationContro
add_breadcrumb @teacher, admin_education_teacher_path(@teacher) if @teacher
end
def load_teacher
@teacher = current_university.people
.for_language_id(current_university.default_language_id)
.teachers
.accessible_by(current_ability)
.find(params[:id])
end
def teacher_params
params.require(:university_person).permit(
involvements_attributes: [:id, :target_id, :target_type, :description, :_destroy]
......
class Admin::Research::DashboardController < Admin::Research::ApplicationController
def index
raise_403_unless feature_research?
@namespace = Research
breadcrumb
render 'admin/dashboard/namespace'
......
class Admin::University::DashboardController < Admin::University::ApplicationController
def index
raise_403_unless can?(:read, University::Person) || can?(:read, University::Organization) || can?(:read, User)
@namespace = University
breadcrumb
render 'admin/dashboard/namespace'
......
......@@ -3,24 +3,12 @@ module ApplicationController::WithFeatures
included do
def feature_administration?
current_university.feature_administration &&
can?(:read, Administration::Qualiopi::Criterion)
end
helper_method :feature_administration?
def feature_communication?
current_university.feature_communication &&
can?(:read, Communication::Website)
end
helper_method :feature_communication?
def feature_education?
current_university.feature_education &&
can?(:read, Education::Program)
can?(:read, Education::Program)
end
helper_method :feature_education?
def feature_research?
current_university.feature_research && (
can?(:read, Research::Journal) ||
......@@ -29,6 +17,19 @@ module ApplicationController::WithFeatures
)
end
helper_method :feature_research?
def feature_communication?
current_university.feature_communication &&
can?(:read, Communication::Website)
end
helper_method :feature_communication?
def feature_administration?
current_university.feature_administration &&
can?(:read, Administration::Qualiopi::Criterion)
end
helper_method :feature_administration?
end
end
......@@ -9,6 +9,7 @@
<div class="row pt-5 mt-5">
<% @namespace.parts.each do |part| %>
<%
next unless can? :read, part.first
class_name = part.first
path = send part.last
title = class_name.model_name.human(count: 2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment