Merge pull request #4508 from rekonder/aj_SCI_7318

Fix view permission at label template table [SCI-7318]
This commit is contained in:
Alex Kriuchykhin 2022-10-10 15:59:02 +02:00 committed by GitHub
commit 3a9b568358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 9 deletions

View file

@ -23,10 +23,10 @@
return uniqueFormats[0];
}
function renderCheckboxHTML(data, type, row) {
function renderCheckboxHTML(data) {
return `<div class="sci-checkbox-container">
<input type="checkbox" class="sci-checkbox label-row-checkbox" data-action='toggle'
data-label-template-id="${data}" ${row.manage_permission ? '' : 'disabled'}>
data-label-template-id="${data}">
<span class="sci-checkbox-label"></span>
</div>`;
}

View file

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

View file

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

View file

@ -30,8 +30,7 @@
<tr>
<th id="select-all">
<div class="sci-checkbox-container">
<input name="select_all" type="checkbox" class="sci-checkbox"
<%= can_manage_label_templates?(current_team) ? '' : 'disabled' %>>
<input name="select_all" type="checkbox" class="sci-checkbox">
<span class="sci-checkbox-label"></span>
</div>
</th>