mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-09 21:56:32 +08:00
Merge pull request #4407 from aignatov-bio/ai-sci-7148-make-zebra-printers-switchable
Add ability to disable zebra printers [SCI-7148]
This commit is contained in:
commit
06548c247f
5 changed files with 16 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ var RepositoryDatatable = (function(global) {
|
||||||
var TABLE_WRAPPER_ID = '.repository-table';
|
var TABLE_WRAPPER_ID = '.repository-table';
|
||||||
var TABLE = null;
|
var TABLE = null;
|
||||||
var EDITABLE = false;
|
var EDITABLE = false;
|
||||||
var SELECT_ALL_SELECTOR = '#checkbox > input[name=select_all]';
|
var SELECT_ALL_SELECTOR = '#checkbox input[name=select_all]';
|
||||||
const STATUS_POLLING_INTERVAL = 10000;
|
const STATUS_POLLING_INTERVAL = 10000;
|
||||||
|
|
||||||
var rowsSelected = [];
|
var rowsSelected = [];
|
||||||
|
|
@ -156,7 +156,6 @@ var RepositoryDatatable = (function(global) {
|
||||||
var $chkboxAll = $('.repository-row-selector', $table);
|
var $chkboxAll = $('.repository-row-selector', $table);
|
||||||
var $chkboxChecked = $('.repository-row-selector:checked', $table);
|
var $chkboxChecked = $('.repository-row-selector:checked', $table);
|
||||||
var chkboxSelectAll = $(SELECT_ALL_SELECTOR, $header).get(0);
|
var chkboxSelectAll = $(SELECT_ALL_SELECTOR, $header).get(0);
|
||||||
|
|
||||||
// If none of the checkboxes are checked
|
// If none of the checkboxes are checked
|
||||||
if ($chkboxChecked.length === 0) {
|
if ($chkboxChecked.length === 0) {
|
||||||
chkboxSelectAll.checked = false;
|
chkboxSelectAll.checked = false;
|
||||||
|
|
@ -442,8 +441,10 @@ var RepositoryDatatable = (function(global) {
|
||||||
className: 'dt-body-center',
|
className: 'dt-body-center',
|
||||||
sWidth: '1%',
|
sWidth: '1%',
|
||||||
render: function(data, type, row) {
|
render: function(data, type, row) {
|
||||||
return `<input class='repository-row-selector sci-checkbox' type='checkbox' data-editable="${row.recordEditable}">
|
return `<div class="sci-checkbox-container">
|
||||||
<span class='sci-checkbox-label'></span>`;
|
<input class='repository-row-selector sci-checkbox' type='checkbox' data-editable="${row.recordEditable}">
|
||||||
|
<span class='sci-checkbox-label'></span>
|
||||||
|
</div>`;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
// Assigned column is not searchable
|
// Assigned column is not searchable
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class RepositoryRowsController < ApplicationController
|
||||||
|
|
||||||
def print_modal
|
def print_modal
|
||||||
@repository_rows = @repository.repository_rows.where(id: params[:rows])
|
@repository_rows = @repository.repository_rows.where(id: params[:rows])
|
||||||
@printers = LabelPrinter.all
|
@printers = LabelPrinter.available_printers
|
||||||
@label_templates = LabelTemplate.where(team_id: current_team).order(:name)
|
@label_templates = LabelTemplate.where(team_id: current_team).order(:name)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,12 @@ class LabelPrinter < ApplicationRecord
|
||||||
validates :type_of, presence: true
|
validates :type_of, presence: true
|
||||||
validates :language_type, presence: true
|
validates :language_type, presence: true
|
||||||
|
|
||||||
|
def self.available_printers
|
||||||
|
printers = all
|
||||||
|
printers = printers.where.not(type_of: :zebra) unless Rails.configuration.x.zebra_print_enabled
|
||||||
|
printers
|
||||||
|
end
|
||||||
|
|
||||||
def display_name
|
def display_name
|
||||||
"#{name} • #{description}"
|
"#{name} • #{description}"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,10 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="checkbox" data-unmanageable="true">
|
<th id="checkbox" data-unmanageable="true">
|
||||||
|
<div class="sci-checkbox-container">
|
||||||
<input name="select_all" value="1" type="checkbox" class="sci-checkbox">
|
<input name="select_all" value="1" type="checkbox" class="sci-checkbox">
|
||||||
<span class="sci-checkbox-label"></span>
|
<span class="sci-checkbox-label"></span>
|
||||||
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th id="assigned" data-unmanageable="true"><%= t("repositories.table.assigned") %></th>
|
<th id="assigned" data-unmanageable="true"><%= t("repositories.table.assigned") %></th>
|
||||||
<% if @repository.is_a?(LinkedRepository) %>
|
<% if @repository.is_a?(LinkedRepository) %>
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ module Scinote
|
||||||
|
|
||||||
config.x.webhooks_enabled = ENV['ENABLE_WEBHOOKS'] == 'true'
|
config.x.webhooks_enabled = ENV['ENABLE_WEBHOOKS'] == 'true'
|
||||||
|
|
||||||
|
config.x.zebra_print_enabled = ENV['ENABLE_ZEBRA_PRINTERS'] == 'true'
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
config.log_formatter = proc do |severity, datetime, progname, msg|
|
config.log_formatter = proc do |severity, datetime, progname, msg|
|
||||||
"[#{datetime}] #{severity}: #{msg}\n"
|
"[#{datetime}] #{severity}: #{msg}\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue