From 42193bbe81debe819b638b9b6a7db68b0bf99c13 Mon Sep 17 00:00:00 2001 From: Andrej Date: Fri, 7 Oct 2022 17:08:04 +0200 Subject: [PATCH] Fix view permission at label template table [SCI-7318] --- .../label_templates/label_templates_datatable.js | 4 ++-- app/controllers/label_templates_controller.rb | 1 - app/datatables/label_template_datatable.rb | 6 ++---- app/views/label_templates/index.html.erb | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/label_templates/label_templates_datatable.js b/app/assets/javascripts/label_templates/label_templates_datatable.js index dff0b28d1..b49dc8056 100644 --- a/app/assets/javascripts/label_templates/label_templates_datatable.js +++ b/app/assets/javascripts/label_templates/label_templates_datatable.js @@ -23,10 +23,10 @@ return uniqueFormats[0]; } - function renderCheckboxHTML(data, type, row) { + function renderCheckboxHTML(data) { return `
+ data-label-template-id="${data}">
`; } diff --git a/app/controllers/label_templates_controller.rb b/app/controllers/label_templates_controller.rb index da92d70c4..346561298 100644 --- a/app/controllers/label_templates_controller.rb +++ b/app/controllers/label_templates_controller.rb @@ -31,7 +31,6 @@ class LabelTemplatesController < ApplicationController format.json do render json: ::LabelTemplateDatatable.new( view_context, - can_manage_label_templates?(current_team), @label_templates ) end diff --git a/app/datatables/label_template_datatable.rb b/app/datatables/label_template_datatable.rb index 882623b5d..d050ff686 100644 --- a/app/datatables/label_template_datatable.rb +++ b/app/datatables/label_template_datatable.rb @@ -15,9 +15,8 @@ class LabelTemplateDatatable < CustomDatatable label_templates.created_at ).freeze - def initialize(view, can_manage_templates, label_templates) + def initialize(view, label_templates) super(view) - @manage_template = can_manage_templates @label_templates = label_templates end @@ -49,8 +48,7 @@ class LabelTemplateDatatable < CustomDatatable 'data-set-default-url': set_default_label_template_path(record), 'data-default': record.default, 'data-format': record.label_format - }, - 'manage_permission' => @manage_template + } } end end diff --git a/app/views/label_templates/index.html.erb b/app/views/label_templates/index.html.erb index a2ab133e1..30620d983 100644 --- a/app/views/label_templates/index.html.erb +++ b/app/views/label_templates/index.html.erb @@ -30,8 +30,7 @@
- > +