Skip to content

Commit

Permalink
Add sanger tab
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinco committed Jan 10, 2025
1 parent 06bccc9 commit 61c1ff3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/controllers/products_common_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def manage
@active_tab = "admin_products"
end

def manage_sanger
authorize! :view_details, @product
@active_tab = "sanger"
end

private

def resource_params
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ServicesController < ProductsCommonController
def permitted_params
params = super

if @facility.sanger_sequencing_enabled?
if current_facility.sanger_sequencing_enabled?
params += %i[sanger_sequencing_enabled sanger_sequencing_primer]
end

Expand All @@ -33,7 +33,7 @@ def ensure_sanger_url_service
sanger_external_service =
@product
.external_services
.matching_location(new_sanger_sequencing_submissions_path)
.matching_location(new_sanger_sequencing_submission_path)
.first

if sanger_external_service.blank?
Expand Down
1 change: 1 addition & 0 deletions app/lib/facility_product_routing_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module FacilityProductRoutingConcern

def facility_product_routing_concern
get :manage, on: :member
get :manage_sanger, on: :member
resources :users, controller: "product_users", except: [:show, :edit, :create] do
get "search", on: :collection
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/shared/_tabnav_product.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
- unless @product.is_a?(Bundle)
- if ResearchSafetyCertificate.any?
= tab ProductResearchSafetyCertificationRequirement.model_name.human.pluralize, facility_product_product_research_safety_certification_requirements_path(current_facility, @product), secondary_tab == "certification_reqs"
- if @product.sanger_sequencing_enabled? && can?(:manage, @facility)
= tab t("views.admin.products.tabnav.sanger"), [:manage_sanger, current_facility, @product], (secondary_tab == "sanger")

= render_view_hook "additional_tabs", secondary_tab: secondary_tab
11 changes: 11 additions & 0 deletions app/views/products_common/manage_sanger.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
= content_for :h1 do
= current_facility
= content_for :sidebar do
= render "admin/shared/sidenav_product", sidenav_tab: @product.class.name.pluralize.underscore
= content_for :tabnav do
= render "admin/shared/tabnav_product", secondary_tab: "details"

%h2 Sanger Configuration

= readonly_form_for @product.class.name.underscore, @product do |f|
= f.input :sanger_sequencing_primer
7 changes: 7 additions & 0 deletions app/views/services/_service_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
label: false,
inline_label: Service.human_attribute_name(:sanger_sequencing_enabled),
hint: t("services.service_fields.sanger.instruct.sanger_sequencing_enabled")

.well
%h3 Sanger Configuration
= f.input :sanger_sequencing_primer,
as: :boolean,
label: false,
inline_label: Service.human_attribute_name(:sanger_sequencing_primer)
1 change: 1 addition & 0 deletions config/locales/views/admin/en.products.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ en:
accessories: "Accessories"
surveys: "Order Forms"
notifications: "Notifications"
sanger: "Sanger"

services:
index:
Expand Down

0 comments on commit 61c1ff3

Please sign in to comment.