Skip to content
Snippets Groups Projects
Commit e5947131 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

better

parent 8be6deb6
No related branches found
No related tags found
No related merge requests found
<%= 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>
......
......@@ -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>
......
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