Skip to content
Snippets Groups Projects
Unverified Commit 082aefcd authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

teacher involvements

parent 43275d3f
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ class Admin::Education::Program::TeachersController < Admin::Education::Program:
def destroy
@involvement.destroy
redirect_to admin_education_program_path(@program), notice: t('admin.successfully_destroyed_html', model: @involvement.to_s)
redirect_back fallback_location: admin_education_program_path(@program), notice: t('admin.successfully_destroyed_html', model: @involvement.to_s)
end
protected
......
......@@ -7,7 +7,7 @@ class Admin::Education::TeachersController < Admin::Education::ApplicationContro
def show
@teacher = current_university.people.teachers.accessible_by(current_ability).find(params[:id])
breadcrumb
@programs = @teacher.education_programs_as_teacher.ordered.page(params[:page])
@involvements = @teacher.involvements_as_teacher.includes(:target).order(:created_at).page(params[:page])
end
protected
......
......@@ -2,16 +2,42 @@
<%= render 'admin/university/people/main_infos', person: @teacher %>
<% if @programs.total_count > 0 %>
<% if @involvements.total_count > 0 %>
<div class="card">
<div class="card-header">
<h2 class="card-title mb-0 h5"><%= "#{Education::Program.model_name.human(count: 2)} (#{@programs.total_count})" %></h2>
<h2 class="card-title mb-0 h5"><%= "#{Education::Program.model_name.human(count: 2)} (#{@involvements.total_count})" %></h2>
</div>
<%= render 'admin/education/programs/list', programs: @programs %>
<% if @programs.total_pages > 1 %>
<table class="table">
<thead>
<tr>
<th><%= Education::Program.model_name.human %></th>
<th><%= Education::Program.human_attribute_name('level') %></th>
<th><%= University::Person::Involvement.human_attribute_name('description') %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @involvements.each do |involvement| %>
<% program = involvement.target %>
<tr>
<td><%= link_to_if can?(:read, program), program, [:admin, program] %></td>
<td><%= program.level_i18n %></td>
<td><%= involvement.description %></td>
<td class="text-end">
<%= link_to t('quit'),
admin_education_program_teacher_path(involvement, { program_id: program.id }),
method: :delete,
data: { confirm: t('please_confirm') },
class: button_classes_danger if can?(:destroy, involvement) %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if @involvements.total_pages > 1 %>
<div class="card-footer">
<%= paginate @programs, theme: 'bootstrap-5' %>
<%= paginate @involvements, theme: 'bootstrap-5' %>
</div>
<% end %>
</div>
......
......@@ -106,6 +106,7 @@ en:
please_confirm_with_children: "WARNING: deleting this element will also remove every child. Are you sure?"
privacy_policy: Privacy policy
privacy_policy_url: https://osuny.org/politique-de-confidentialite
quit: Quit
save: Save
select_language: Select language
simple_form:
......
......@@ -106,6 +106,7 @@ fr:
please_confirm_with_children: "ATTENTION : effacer cet élément supprimera aussi tous ses enfants. Est-ce que vous confirmez ?"
privacy_policy: Politique de confidentialité
privacy_policy_url: https://osuny.org/politique-de-confidentialite
quit: Quitter
save: Enregistrer
select_language: Sélectionnez une langue
simple_form:
......
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