mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Fixed bugs with duplicated generated csv, toggle columns and exportig right columns of selected repository
This commit is contained in:
parent
ede744849b
commit
4df8e1ffe3
3 changed files with 15 additions and 27 deletions
|
@ -226,7 +226,8 @@ $('form#form-export').submit(function(e) {
|
|||
appendSamplesIdToForm(form);
|
||||
|
||||
// Append visible column information
|
||||
$('table#repository-table thead tr').children('th').each(function(i) {
|
||||
$('.active table#repository-table thead tr').children('th')
|
||||
.each(function(i) {
|
||||
var th = $(this);
|
||||
var val;
|
||||
if ($(th).attr('id') === 'checkbox' || $(th).attr('id') === 'assigned')
|
||||
|
@ -685,26 +686,7 @@ function updateButtons() {
|
|||
$('th').removeClass('disable-click');
|
||||
$('.repository-row-selector').removeClass('disabled');
|
||||
$('.repository-row-selector').prop('disabled', false);
|
||||
if (rowsSelected.length === 1) {
|
||||
$('#editRepositoryRecord').prop('disabled', false);
|
||||
$('#editRepositoryRecord').removeClass('disabled');
|
||||
$('#deleteRepositoryRecordsButton').prop('disabled', false);
|
||||
$('#deleteRepositoryRecordsButton').removeClass('disabled');
|
||||
$('#exportRepositoriesButton').removeClass('disabled');
|
||||
$('#exportRepositoriesButton').prop('disabled', false);
|
||||
$('#exportRepositoriesButton').on('click', function() {
|
||||
$('#exportRepositoryModal')
|
||||
.modal('show')
|
||||
});
|
||||
$('#export-repositories').on('click', function() {
|
||||
animateSpinner(null, true);
|
||||
$('#form-export').submit();
|
||||
});
|
||||
$('#assignRepositoryRecords').removeClass('disabled');
|
||||
$('#assignRepositoryRecords').prop('disabled', false);
|
||||
$('#unassignRepositoryRecords').removeClass('disabled');
|
||||
$('#unassignRepositoryRecords').prop('disabled', false);
|
||||
} else if (rowsSelected.length === 0) {
|
||||
if (rowsSelected.length === 0) {
|
||||
$('#editRepositoryRecord').prop('disabled', true);
|
||||
$('#editRepositoryRecord').addClass('disabled');
|
||||
$('#deleteRepositoryRecordsButton').prop('disabled', true);
|
||||
|
@ -718,8 +700,13 @@ function updateButtons() {
|
|||
$('#unassignRepositoryRecords').addClass('disabled');
|
||||
$('#unassignRepositoryRecords').prop('disabled', true);
|
||||
} else {
|
||||
$('#editRepositoryRecord').prop('disabled', true);
|
||||
$('#editRepositoryRecord').addClass('disabled');
|
||||
if (rowsSelected.length === 1) {
|
||||
$('#editRepositoryRecord').prop('disabled', false);
|
||||
$('#editRepositoryRecord').removeClass('disabled');
|
||||
} else {
|
||||
$('#editRepositoryRecord').prop('disabled', true);
|
||||
$('#editRepositoryRecord').addClass('disabled');
|
||||
}
|
||||
$('#deleteRepositoryRecordsButton').prop('disabled', false);
|
||||
$('#deleteRepositoryRecordsButton').removeClass('disabled');
|
||||
$('#exportRepositoriesButton').removeClass('disabled');
|
||||
|
@ -748,6 +735,7 @@ function updateButtons() {
|
|||
$('#deleteRepositoryRecordsButton').prop('disabled', true);
|
||||
$('#exportRepositoriesButton').addClass('disabled');
|
||||
$('#exportRepositoriesButton').off('click');
|
||||
$('#export-repositories').off('click');
|
||||
$('#assignRepositoryRecords').addClass('disabled');
|
||||
$('#assignRepositoryRecords').prop('disabled', true);
|
||||
$('#unassignRepositoryRecords').addClass('disabled');
|
||||
|
@ -1045,6 +1033,7 @@ function changeToEditMode() {
|
|||
if (!_.isEmpty(searchText)) {
|
||||
table.search(searchText).draw();
|
||||
}
|
||||
initRowSelection();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class RepositoriesController < ApplicationController
|
||||
before_action :load_vars, except: [:repository_table_index, :export_repository]
|
||||
before_action :load_vars, except: %i(repository_table_index export_repository)
|
||||
before_action :check_view_all_permissions, only: :index
|
||||
before_action :check_edit_and_destroy_permissions, only:
|
||||
%(destroy destroy_modal rename_modal update)
|
||||
|
@ -7,7 +7,6 @@ class RepositoriesController < ApplicationController
|
|||
%(copy_modal copy)
|
||||
before_action :check_create_permissions, only:
|
||||
%(create_new_modal create)
|
||||
before_action :generate_zip, only: :export_repository
|
||||
|
||||
def index
|
||||
render('repositories/index')
|
||||
|
@ -273,8 +272,7 @@ class RepositoriesController < ApplicationController
|
|||
sample_row << I18n.l(row.created_at, format: :full)
|
||||
else
|
||||
record = row_record.joins(:repository_columns, :repository_cells)
|
||||
.where(repository_columns: { id: header })
|
||||
.take
|
||||
.where(repository_columns: { id: header }).take
|
||||
if record
|
||||
sample_row << record.repository_cells.take.value.data
|
||||
else
|
||||
|
|
|
@ -88,3 +88,4 @@
|
|||
repository_index_link: repository_table_index_path(repository)
|
||||
}
|
||||
%>
|
||||
|
||||
|
|
Loading…
Reference in a new issue