From 0923d5c567e754f949950cb0c8f2cd123cd54b2d Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Mon, 22 Nov 2021 10:51:50 +0100
Subject: [PATCH] wip #67

---
 app/controllers/admin/education/schools_controller.rb | 2 +-
 app/views/admin/education/schools/_form.html.erb      | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/controllers/admin/education/schools_controller.rb b/app/controllers/admin/education/schools_controller.rb
index 2fa2f4fa1..18ed93ed4 100644
--- a/app/controllers/admin/education/schools_controller.rb
+++ b/app/controllers/admin/education/schools_controller.rb
@@ -54,6 +54,6 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl
 
   def school_params
     params.require(:education_school)
-          .permit(:university_id, :name, :address, :zipcode, :city, :country, :phone)
+          .permit(:university_id, :name, :address, :zipcode, :city, :country, :phone, program_ids: [])
   end
 end
diff --git a/app/views/admin/education/schools/_form.html.erb b/app/views/admin/education/schools/_form.html.erb
index 9ce2da5d4..e4866ce86 100644
--- a/app/views/admin/education/schools/_form.html.erb
+++ b/app/views/admin/education/schools/_form.html.erb
@@ -4,7 +4,7 @@
       <%= f.input :name %>
       <%= f.input :phone %>
     </div>
-    <div class="col-md-8">
+    <div class="col-md-4">
       <%= f.input :address %>
       <div class="row">
         <div class="col-md-4">
@@ -16,6 +16,11 @@
       </div>
       <%= f.input :country %>
     </div>
+    <div class="col-md-4">
+      <%= f.association :programs,
+                        as: :check_boxes,
+                        collection: current_university.education_programs.ordered %>
+    </div>
   </div>
   <% content_for :action_bar_right do %>
     <%= submit f %>
-- 
GitLab