mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 03:06:28 +08:00
Add snapshots to label printing [SCI-6328] (#3760)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
7c4143249e
commit
997fbb80d3
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue