mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Fix missing toolbar buttons for shared inventories [SCI-8481] (#5481)
This commit is contained in:
parent
384434ba80
commit
1ea7f53e4b
1 changed files with 6 additions and 5 deletions
|
@ -12,8 +12,9 @@ module Toolbars
|
|||
@current_team = current_team
|
||||
@repositories = Repository.readable_by_user(current_user)
|
||||
.where(id: repository_ids)
|
||||
@repository = @repositories.length == 1 ? @repositories.first : nil
|
||||
@repository = @repositories.first
|
||||
@archived_state = @repositories.all.any?(&:archived?)
|
||||
@single = @repositories.uniq.length == 1
|
||||
end
|
||||
|
||||
def actions
|
||||
|
@ -29,7 +30,7 @@ module Toolbars
|
|||
private
|
||||
|
||||
def rename_action
|
||||
return unless @repository
|
||||
return unless @single && can_manage_repository?(@repository)
|
||||
|
||||
{
|
||||
name: 'rename',
|
||||
|
@ -42,7 +43,7 @@ module Toolbars
|
|||
end
|
||||
|
||||
def duplicate_action
|
||||
return unless @repository && can_create_repositories?(@current_team)
|
||||
return unless @single && can_create_repositories?(@current_team)
|
||||
|
||||
{
|
||||
name: 'duplicate',
|
||||
|
@ -69,7 +70,7 @@ module Toolbars
|
|||
end
|
||||
|
||||
def share_action
|
||||
return unless @repository && can_share_repository?(@repository)
|
||||
return unless @single && can_share_repository?(@repository)
|
||||
|
||||
{
|
||||
name: 'share',
|
||||
|
@ -96,7 +97,7 @@ module Toolbars
|
|||
end
|
||||
|
||||
def delete_action
|
||||
return unless @repository
|
||||
return unless @single && can_delete_repository?(@repository)
|
||||
|
||||
{
|
||||
name: 'delete',
|
||||
|
|
Loading…
Reference in a new issue