Add snapshots to label printing [SCI-6328] (#3760)

Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
aignatov-bio 2022-01-04 14:12:35 +01:00 committed by GitHub
parent 7c4143249e
commit 997fbb80d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,8 @@ class RepositoryRowsController < ApplicationController
MAX_PRINTABLE_ITEM_NAME_LENGTH = 64
before_action :load_repository, except: :show
before_action :load_repository, except: %i(show print_modal print)
before_action :load_repository_or_snapshot, only: %i(print_modal print)
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)
@ -261,6 +262,13 @@ class RepositoryRowsController < ApplicationController
render_404 unless @repository
end
def load_repository_or_snapshot
@repository = Repository.accessible_by_teams(current_team).find_by(id: params[:repository_id])
@repository ||= RepositorySnapshot.find_by(id: params[:repository_id])
render_404 unless @repository
end
def load_repository_row
@repository_row = @repository.repository_rows.eager_load(:repository_columns).find_by(id: params[:id])
render_404 unless @repository_row