diff --git a/app/views/admin/education/program/teachers/_form.html.erb b/app/views/admin/education/program/teachers/_form.html.erb index d15ac983106c67742ad2d26e56bef5d49bafd546..e8c8b9067196b35f5d0599974470e4820b0a1d1d 100644 --- a/app/views/admin/education/program/teachers/_form.html.erb +++ b/app/views/admin/education/program/teachers/_form.html.erb @@ -1,14 +1,16 @@ <%= simple_form_for [:admin, teacher] do |f| %> - <div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('admin.infos') %></h5> - </div> - <div class="card-body"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('admin.infos') %></h5> + </div> + <div class="card-body"> + <div class="row"> + <div class="col-md-6"> <% teacher_ids = @program.teachers.where.not(id: teacher.id).pluck(:person_id) %> <%= f.association :person, collection: current_university.people.teachers.where.not(id: teacher_ids).ordered %> - <%= f.input :description, input_html: { rows: 5 } %> + </div> + <div class="col-md-6"> + <%= f.input :description, as: :string %> </div> </div> </div> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 93f13b21d0a0ed975957901b2e49f4147eb8c44b..e6c1563c711d8ac056d5ad655e10635548221c6f 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -104,39 +104,41 @@ <% end %> <h3 class="h5 <%= 'mt-4' if i > 0 %>"><%= Education::Program.human_attribute_name('teachers') %></h3> <p><%= link_to t('create'), new_admin_education_program_teacher_path(program_id: @program.id), class: 'btn btn-primary' %></p> - <table class="table"> - <thead> - <tr> - <th><%= Education::Program::Teacher.model_name.human %></th> - <th><%= Education::Program::Teacher.human_attribute_name('description') %></th> - <th></th> - </tr> - </thead> - <tbody> - <% @program.teachers.includes(:person).ordered.each do |teacher| %> + <% if @program.teachers.any? %> + <table class="table"> + <thead> <tr> - <td> - <%= link_to_if can?(:read, teacher.person), - teacher.person, - admin_education_teacher_path(teacher.person) %> - </td> - <td><%= teacher.description %></td> - <td class="text-end pe-0"> - <div class="btn-group" role="group"> - <%= link_to t('edit'), - edit_admin_education_program_teacher_path(teacher, { program_id: @program.id }), - class: button_classes %> - <%= link_to t('delete'), - admin_education_program_teacher_path(teacher, { program_id: @program.id }), - method: :delete, - data: { confirm: t('please_confirm') }, - class: button_classes_danger %> - </div> - </td> + <th><%= Education::Program::Teacher.model_name.human %></th> + <th><%= Education::Program::Teacher.human_attribute_name('description') %></th> + <th></th> </tr> - <% end %> - </tbody> - </table> + </thead> + <tbody> + <% @program.teachers.includes(:person).ordered.each do |teacher| %> + <tr> + <td> + <%= link_to_if can?(:read, teacher.person), + teacher.person, + admin_education_teacher_path(teacher.person) %> + </td> + <td><%= teacher.description %></td> + <td class="text-end pe-0"> + <div class="btn-group" role="group"> + <%= link_to t('edit'), + edit_admin_education_program_teacher_path(teacher, { program_id: @program.id }), + class: button_classes %> + <%= link_to t('delete'), + admin_education_program_teacher_path(teacher, { program_id: @program.id }), + method: :delete, + data: { confirm: t('please_confirm') }, + class: button_classes_danger %> + </div> + </td> + </tr> + <% end %> + </tbody> + </table> + <% end %> </div> </div> </div>