mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 01:03:18 +08:00
Merge pull request #4508 from rekonder/aj_SCI_7318
Fix view permission at label template table [SCI-7318]
This commit is contained in:
commit
3a9b568358
4 changed files with 5 additions and 9 deletions
|
@ -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>`;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue