diff --git a/app/controllers/label_templates_controller.rb b/app/controllers/label_templates_controller.rb new file mode 100644 index 000000000..1439528bf --- /dev/null +++ b/app/controllers/label_templates_controller.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class LabelTemplatesController < ApplicationController + before_action :check_view_permissions + + layout 'fluid' + + def index; end + + private + + def check_view_permissions + render_403 unless can_view_label_templates?(current_team) + end +end diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 20349cc65..c02c10e2a 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -76,6 +76,8 @@ class ProtocolsController < ApplicationController before_action :set_importer, only: %i(load_from_file import) + layout 'fluid' + def index; end def datatable diff --git a/app/helpers/left_menu_bar_helper.rb b/app/helpers/left_menu_bar_helper.rb index 32229e95f..e4f074077 100644 --- a/app/helpers/left_menu_bar_helper.rb +++ b/app/helpers/left_menu_bar_helper.rb @@ -14,7 +14,8 @@ module LeftMenuBarHelper def templates_are_selected? # TODO - controller_name == 'protocols' + controller_name == 'protocols' || + controller_name == 'label_templates' end def reports_are_selected? diff --git a/app/permissions/team.rb b/app/permissions/team.rb index a58184cae..88b7117f5 100644 --- a/app/permissions/team.rb +++ b/app/permissions/team.rb @@ -56,6 +56,10 @@ Canaid::Permissions.register_for(Team) do can :manage_reports do |user, team| user.is_normal_user_or_admin_of_team?(team) end + + can :view_label_templates do |user, team| + user.is_normal_user_or_admin_of_team?(team) + end end Canaid::Permissions.register_for(ProjectFolder) do diff --git a/app/views/label_templates/index.html.erb b/app/views/label_templates/index.html.erb new file mode 100644 index 000000000..daab4ba32 --- /dev/null +++ b/app/views/label_templates/index.html.erb @@ -0,0 +1,8 @@ +<% if current_team %> + <% provide(:sidebar_title, t('sidebar.templates.sidebar_title')) %> + <%= content_for :sidebar do %> + <%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :label} %> + <% end %> +