Add new templates section and navigation [SCI-7017]

This commit is contained in:
Anton 2022-07-26 13:52:40 +02:00
parent e4525dddf5
commit 6131b6c0b7
10 changed files with 59 additions and 3 deletions

View file

@ -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

View file

@ -76,6 +76,8 @@ class ProtocolsController < ApplicationController
before_action :set_importer, only: %i(load_from_file import)
layout 'fluid'
def index; end
def datatable

View file

@ -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?

View file

@ -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

View file

@ -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 %>
<div class="content-pane flexible">
</div>
<% end %>

View file

@ -5,7 +5,11 @@
<% provide(:head_title, t("protocols.index.head_title")) %>
<% if current_team %>
<div class="content-pane" id="protocols-index">
<% provide(:sidebar_title, t('sidebar.templates.sidebar_title')) %>
<%= content_for :sidebar do %>
<%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :protocol} %>
<% end %>
<div class="content-pane flexible" id="protocols-index">
<ul class="nav nav-tabs nav-settings">
<li role="presentation" class="<%= "active" if @type == :public %>">
<%= link_to t("protocols.index.navigation.public"), protocols_path(team: @current_team, type: :public) %>

View file

@ -1,3 +1,7 @@
<% provide(:sidebar_title, t('sidebar.templates.sidebar_title')) %>
<%= content_for :sidebar do %>
<%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :protocol} %>
<% end %>
<div class="content-pane protocols-show" >
<div class="protocol-position-container">
<div class="protocol-actions">

View file

@ -0,0 +1,12 @@
<ul class="sidebar-branch">
<li class="sidebar-leaf">
<%= link_to t('sidebar.templates.protocol_templates'),
protocols_path,
class: "sidebar-link #{'selected' if active == :protocol}" %>
</li>
<li class="sidebar-leaf">
<%= link_to t('sidebar.templates.label_templates'),
label_templates_path,
class: "sidebar-link #{'selected' if active == :label}" %>
</li>
</ul>

View file

@ -240,7 +240,7 @@ en:
dashboard: "Overview"
projects: "Projects"
repositories: "Inventories"
templates: "Protocols"
templates: "Templates"
reports: "Reports"
settings: "Settings"
activities: "Activities"
@ -283,6 +283,10 @@ en:
archive: "Archived results"
repositories:
sidebar_title: "INVENTORIES"
templates:
sidebar_title: "TEMPLATES"
protocol_templates: "Protocol templates"
label_templates: "Label Templates"
nav2:
all_projects:

View file

@ -54,6 +54,8 @@ Rails.application.routes.draw do
get :update_progress_modal, on: :member
end
resources :label_templates
get 'users/settings/account/connected_accounts',
to: 'users/settings/account/connected_accounts#index',
as: 'connected_accounts'