diff --git a/app/controllers/admin/facility_groups_controller.rb b/app/controllers/admin/facility_groups_controller.rb index 135a1f7412..aef8792624 100644 --- a/app/controllers/admin/facility_groups_controller.rb +++ b/app/controllers/admin/facility_groups_controller.rb @@ -48,6 +48,15 @@ def destroy end end + def upload + authorize FacilityGroup + if params[:facilities_csv] + redirect_to admin_facilities_url, notice: "File uploaded #{params[:facilities_csv].original_filename}" + else + render :upload + end + end + private def set_organizations diff --git a/app/policies/facility_group_policy.rb b/app/policies/facility_group_policy.rb index 6628f1fe5e..7a4b4d93c0 100644 --- a/app/policies/facility_group_policy.rb +++ b/app/policies/facility_group_policy.rb @@ -31,6 +31,10 @@ def graphics? show? end + def upload? + user.owner? || user.organization_owner? + end + private def destroyable? diff --git a/app/views/admin/facilities/index.html.erb b/app/views/admin/facilities/index.html.erb index 55d02d0a36..81ff0ece6a 100644 --- a/app/views/admin/facilities/index.html.erb +++ b/app/views/admin/facilities/index.html.erb @@ -1,9 +1,13 @@ <% if policy(FacilityGroup).new? %> - <%= link_to '+ Facility group', new_admin_facility_group_path, class: "btn btn-sm btn-primary float-right" %> +