diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index d0698f9fe..c57c5b113 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -65,6 +65,7 @@ var RepositoryDatatable = (function(global) { $('#restoreRepositoryRecords').prop('disabled', true); $('#deleteRepositoryRecords').prop('disabled', true); $('#editDeleteCopy').hide(); + $('#toolbarPrintLabel').hide(); } else { if (rowsSelected.length === 1) { $('#editRepositoryRecord').prop('disabled', false); @@ -82,6 +83,7 @@ var RepositoryDatatable = (function(global) { $('#archiveRepositoryRecordsButton').prop('disabled', true); } $('#editDeleteCopy').show(); + $('#toolbarPrintLabel').show(); } } else if (currentMode === 'editMode') { $(TABLE_WRAPPER_ID).addClass('editing'); @@ -100,6 +102,8 @@ var RepositoryDatatable = (function(global) { $('.repository-row-selector').prop('disabled', true); $('.dataTables_filter input').prop('disabled', true); } + + $('#toolbarPrintLabel').data('rows', JSON.stringify(rowsSelected)); } function clearRowSelection() { diff --git a/app/assets/javascripts/sitewide/repository_row_info_modal.js b/app/assets/javascripts/sitewide/repository_row_info_modal.js index 8044aea9a..b80b1029f 100644 --- a/app/assets/javascripts/sitewide/repository_row_info_modal.js +++ b/app/assets/javascripts/sitewide/repository_row_info_modal.js @@ -56,6 +56,7 @@ $.ajax({ method: 'GET', url: $(this).data('url'), + data: { rows: JSON.parse($(this).data('rows')) }, dataType: 'json' }).done(function(xhr, settings, data) { $('body').append($.parseHTML(data.responseJSON.html)); diff --git a/app/controllers/repository_rows_controller.rb b/app/controllers/repository_rows_controller.rb index 20664ba8c..bf285b3cc 100644 --- a/app/controllers/repository_rows_controller.rb +++ b/app/controllers/repository_rows_controller.rb @@ -5,7 +5,7 @@ class RepositoryRowsController < ApplicationController include MyModulesHelper before_action :load_repository, except: :show - before_action :load_repository_row, only: %i(update assigned_task_list print_modal) + before_action :load_repository_row, only: %i(update assigned_task_list) before_action :check_read_permissions, except: %i(show create update delete_records copy_records) before_action :check_snapshotting_status, only: %i(create update delete_records copy_records) before_action :check_create_permissions, only: :create @@ -72,6 +72,7 @@ class RepositoryRowsController < ApplicationController end def print_modal + @repository_rows = @repository.repository_rows.where(id: params[:rows]) @printers = ['test1', 'test2', 'test3'] respond_to do |format| format.json do diff --git a/app/views/repositories/_print_label_modal.html.erb b/app/views/repositories/_print_label_modal.html.erb index 21f55a3f0..344f7e93a 100644 --- a/app/views/repositories/_print_label_modal.html.erb +++ b/app/views/repositories/_print_label_modal.html.erb @@ -4,10 +4,14 @@
<%= t('repositories.index.view_only_permission_label') %>
<% end %> <% end %> +