mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-23 07:13:57 +08:00
Merge pull request #2575 from okriuchykhin/ok_SCI_4637
Fix selection of the default snapshot on tasks [SCI-4637]
This commit is contained in:
commit
e9a05d2e3d
2 changed files with 6 additions and 4 deletions
|
@ -392,7 +392,7 @@ var MyModuleRepositories = (function() {
|
|||
animateSpinner(null, true);
|
||||
|
||||
if (FULL_VIEW_MODAL.find('.table').data('type') === 'live') {
|
||||
data = { repository_snapshot_id: -1 };
|
||||
data = { repository_id: FULL_VIEW_MODAL.find('.table').data('id') };
|
||||
} else {
|
||||
data = { repository_snapshot_id: FULL_VIEW_MODAL.find('.table').data('id') };
|
||||
}
|
||||
|
|
|
@ -83,13 +83,15 @@ class MyModuleRepositorySnapshotsController < ApplicationController
|
|||
end
|
||||
|
||||
def select
|
||||
if params[:repository_snapshot_id].to_i == -1
|
||||
@my_module.repository_snapshots.where(original_repository: @repository).update(selected: nil)
|
||||
if params[:repository_id]
|
||||
@my_module.repository_snapshots.where(parent_id: params[:repository_id]).update(selected: nil)
|
||||
else
|
||||
repository_snapshot = @my_module.repository_snapshots.find_by(id: params[:repository_snapshot_id])
|
||||
return render_404 unless repository_snapshot
|
||||
|
||||
@my_module.repository_snapshots.where(original_repository: @repository).update(selected: nil)
|
||||
@my_module.repository_snapshots
|
||||
.where(original_repository: repository_snapshot.original_repository)
|
||||
.update(selected: nil)
|
||||
repository_snapshot.update!(selected: true)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue