mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-11 08:51:32 +08:00
Merge pull request #8510 from aignatov-bio/ai-sci-11917-fix-redirect-for-locations
Fix redirect for storage locations in activities [SCI-11917]
This commit is contained in:
commit
edeb24e6e4
4 changed files with 12 additions and 6 deletions
|
|
@ -29,7 +29,7 @@ class StorageLocationRepositoryRowsController < ApplicationController
|
||||||
end
|
end
|
||||||
storage_location_repository_row = StorageLocationRepositoryRow.new(
|
storage_location_repository_row = StorageLocationRepositoryRow.new(
|
||||||
repository_row: @repository_row,
|
repository_row: @repository_row,
|
||||||
storage_location: @storage_location,
|
container_storage_location: @storage_location,
|
||||||
metadata: { position: position[0..1] },
|
metadata: { position: position[0..1] },
|
||||||
created_by: current_user
|
created_by: current_user
|
||||||
)
|
)
|
||||||
|
|
@ -41,7 +41,7 @@ class StorageLocationRepositoryRowsController < ApplicationController
|
||||||
else
|
else
|
||||||
storage_location_repository_row = StorageLocationRepositoryRow.new(
|
storage_location_repository_row = StorageLocationRepositoryRow.new(
|
||||||
repository_row: @repository_row,
|
repository_row: @repository_row,
|
||||||
storage_location: @storage_location,
|
container_storage_location: @storage_location,
|
||||||
created_by: current_user
|
created_by: current_user
|
||||||
)
|
)
|
||||||
storage_location_repository_row.with_lock do
|
storage_location_repository_row.with_lock do
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,9 @@ class StorageLocationsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
def show
|
||||||
|
redirect_to storage_locations_path(parent_id: @storage_location.id) and return unless @storage_location.container
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,10 @@ module GlobalActivitiesHelper
|
||||||
project_folder_path(obj, team: obj.team.id)
|
project_folder_path(obj, team: obj.team.id)
|
||||||
end
|
end
|
||||||
when StorageLocation
|
when StorageLocation
|
||||||
path = if obj.new_record?
|
path = if obj.container
|
||||||
storage_locations_path(team: activity.team.id)
|
storage_location_path(obj, team: obj.team_id)
|
||||||
else
|
else
|
||||||
storage_location_path(obj, team: activity.team.id)
|
storage_locations_path(parent_id: obj.id, team: obj.team_id)
|
||||||
end
|
end
|
||||||
when Form
|
when Form
|
||||||
path = form_path(obj, team: obj.team.id)
|
path = form_path(obj, team: obj.team.id)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ class StorageLocationRepositoryRow < ApplicationRecord
|
||||||
default_scope -> { kept }
|
default_scope -> { kept }
|
||||||
|
|
||||||
belongs_to :storage_location, inverse_of: :storage_location_repository_rows
|
belongs_to :storage_location, inverse_of: :storage_location_repository_rows
|
||||||
|
belongs_to :container_storage_location, -> { where(container: true) },
|
||||||
|
class_name: 'StorageLocation',
|
||||||
|
foreign_key: 'storage_location_id',
|
||||||
|
inverse_of: :storage_location_repository_rows
|
||||||
belongs_to :repository_row, inverse_of: :storage_location_repository_rows
|
belongs_to :repository_row, inverse_of: :storage_location_repository_rows
|
||||||
belongs_to :created_by, class_name: 'User'
|
belongs_to :created_by, class_name: 'User'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue