From 01e8cfc5c1500a96cb37c2aadcbc8f45d1fc844a Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 23 Jan 2023 08:14:10 +0100 Subject: [PATCH] more --- .../admin/education/schools/_form.html.erb | 62 +++++++--------- .../admin/education/schools/show.html.erb | 73 ++++++++---------- .../education/schools/show/_roles.html.erb | 74 +++++++++---------- .../teachers/show/_programs.html.erb | 2 +- 4 files changed, 91 insertions(+), 120 deletions(-) diff --git a/app/views/admin/education/schools/_form.html.erb b/app/views/admin/education/schools/_form.html.erb index 605b29b3c..2b34f9c9f 100644 --- a/app/views/admin/education/schools/_form.html.erb +++ b/app/views/admin/education/schools/_form.html.erb @@ -3,45 +3,35 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <div class="row"> - <div class="col-md-6"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> - </div> - <div class="card-body"> - <%= f.input :name %> - <%= f.input :phone %> - <%= f.input :address %> - <div class="row"> - <div class="col-md-4"> - <%= f.input :zipcode %> - </div> - <div class="col-md-8"> - <%= f.input :city %> - </div> + <div class="col-xxl-6"> + <%= osuny_panel title: t('metadata') do %> + <%= f.input :name %> + <%= f.input :phone %> + <%= f.input :address %> + <div class="row pure__row--small"> + <div class="col-md-4"> + <%= f.input :zipcode %> + </div> + <div class="col-md-8"> + <%= f.input :city %> </div> - <%= f.input :country, input_html: { class: 'form-select' } %> - <%= f.input :logo, - as: :single_deletable_file, - input_html: { accept: '.jpg,.jpeg,.png,.svg' }, - preview: 200, - direct_upload: true %> </div> - </div> + <%= f.input :country, input_html: { class: 'form-select' } %> + <%= f.input :logo, + as: :single_deletable_file, + input_html: { accept: '.jpg,.jpeg,.png,.svg' }, + preview: 200, + direct_upload: true %> + <% end %> </div> - <div class="col-md-6"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= Education::Program.model_name.human(count: 2) %></h5> - </div> - <div class="card-body"> - <%= f.association :programs, - as: :check_boxes, - collection: collection_tree(current_university.education_programs), - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } %> - </div> - </div> + <div class="col-xxl-6"> + <%= osuny_panel title: Education::Program.model_name.human(count: 2) do %> + <%= f.association :programs, + as: :check_boxes, + collection: collection_tree(current_university.education_programs), + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] } %> + <% end %> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/education/schools/show.html.erb b/app/views/admin/education/schools/show.html.erb index b0d40b059..f3bb83bff 100644 --- a/app/views/admin/education/schools/show.html.erb +++ b/app/views/admin/education/schools/show.html.erb @@ -2,57 +2,42 @@ <div class="row"> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> - </div> - <div class="card-body"> - <h3 class="h5"><%= Education::School.human_attribute_name('address') %></h3> - <p> - <%= @school.address %><br> - <%= @school.zipcode %> <%= @school.city %><br> - <%= @school.country %> - </p> - <h3 class="h5"><%= Education::School.human_attribute_name('phone') %></h3> - <p><%= @school.phone %></p> - </div> - </div> + <div class="col-xxl-4"> + <%= osuny_panel title: t('metadata') do %> + <%= osuny_label Education::School.human_attribute_name('address') %> + <p> + <%= @school.address %><br> + <%= @school.zipcode %> <%= @school.city %><br> + <%= @school.country %> + </p> + <%= osuny_label Education::School.human_attribute_name('phone') %> + <p><%= @school.phone %></p> + <% end %> </div> <% if @school.programs.any? %> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= Education::School.human_attribute_name('programs') %></h2> - </div> - <div class="card-body"> - <ul class="list-unstyled"> - <% @school.programs.ordered.each do |program| %> - <li><%= link_to_if can?(:read, program), program, [:admin, program] %></li> - <% end %> - </ul> - <%= @school.alumni.count %> - <%= University::Person::Alumnus.model_name.human(count: 2).downcase %> - </div> - </div> + <div class="col-xxl-4"> + <%= osuny_panel title: Education::School.human_attribute_name('programs') do %> + <ul class="list-unstyled"> + <% @school.programs.ordered.each do |program| %> + <li><%= link_to_if can?(:read, program), program, [:admin, program] %></li> + <% end %> + </ul> + <%= @school.alumni.count %> + <%= University::Person::Alumnus.model_name.human(count: 2).downcase %> + <% end %> </div> <% end %> <% if @school.websites.any? %> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= Education::School.human_attribute_name('websites') %></h2> - </div> - <div class="card-body"> - <ul class="list-unstyled"> - <% @school.websites.each do |website| %> - <li><%= link_to website, [:admin, website] %></li> - <% end %> - </ul> - </div> - </div> + <div class="col-xxl-4"> + <%= osuny_panel title: Education::School.human_attribute_name('websites') do %> + <ul class="list-unstyled"> + <% @school.websites.each do |website| %> + <li><%= link_to website, [:admin, website] %></li> + <% end %> + </ul> + <% end %> </div> <% end %> diff --git a/app/views/admin/education/schools/show/_roles.html.erb b/app/views/admin/education/schools/show/_roles.html.erb index 224bc030b..ee8477df5 100644 --- a/app/views/admin/education/schools/show/_roles.html.erb +++ b/app/views/admin/education/schools/show/_roles.html.erb @@ -1,42 +1,38 @@ -<div class="card flex-fill w-100"> - <div class="card-header"> - <div class="float-end"> - <%= link_to t('education.schools.manage_roles'), +<% +action = '' +action += link_to t('education.schools.manage_roles'), admin_education_school_roles_path(school_id: @school.id), - class: button_classes if can?(:update, University::Role) %> - </div> - <h2 class="card-title mb-0 h5"><%= Education::School.human_attribute_name('roles') %></h2> - </div> - <div class="card-body"> - <% if @roles.any? %> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> + class: button_classes if can?(:update, University::Role) +%> +<%= osuny_panel title: Education::School.human_attribute_name('roles'), action: action do %> + <% if @roles.any? %> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th class="ps-0"><%= University::Role.model_name.human %></th> + <th><%= University::Role.human_attribute_name('people') %></th> + </tr> + </thead> + <tbody> + <% roles.each do |role| %> <tr> - <th class="ps-0"><%= University::Role.model_name.human %></th> - <th><%= University::Role.human_attribute_name('people') %></th> + <td class="ps-0"> + <%= link_to_if can?(:read, role), + role, + edit_admin_education_school_role_path(role, { school_id: @school.id }) %> + </td> + <td> + <ul class="list-unstyled"> + <% role.involvements.includes(:person).ordered.each do |involvement| %> + <li><%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %></li> + <% end %> + </ul> + </td> </tr> - </thead> - <tbody> - <% roles.each do |role| %> - <tr> - <td class="ps-0"> - <%= link_to_if can?(:read, role), - role, - edit_admin_education_school_role_path(role, { school_id: @school.id }) %> - </td> - <td> - <ul> - <% role.involvements.includes(:person).ordered.each do |involvement| %> - <li><%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %></li> - <% end %> - </ul> - </td> - </tr> - <% end %> - </tbody> - </table> - </div> - <% end %> - </div> -</div> + <% end %> + </tbody> + </table> + </div> + <% end %> +<% end %> diff --git a/app/views/admin/education/teachers/show/_programs.html.erb b/app/views/admin/education/teachers/show/_programs.html.erb index a777a8467..284eea2a5 100644 --- a/app/views/admin/education/teachers/show/_programs.html.erb +++ b/app/views/admin/education/teachers/show/_programs.html.erb @@ -1,7 +1,7 @@ <% param_name ||= :page %> <% if involvements.total_count > 0 %> <%= osuny_panel title: Education::Program.model_name.human(count: 2), - subtitle: "#{involvements.total_count} #{Education::Program.model_name.human(count: involvements.total_count).downcase}" do %> + subtitle: "#{involvements.total_count} #{Education::Program.model_name.human(count: involvements.total_count).downcase}" do %> <div class="table-responsive"> <table class="<%= table_classes %>"> -- GitLab