2019-08-26 14:56:46 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module InventoriesHelper
|
|
|
|
def inventory_shared_status_icon(inventory, team)
|
|
|
|
if inventory.shared_with?(team)
|
2019-08-26 17:20:18 +08:00
|
|
|
if can_manage_repository_rows?(inventory)
|
2019-09-02 16:30:29 +08:00
|
|
|
draw_custom_icon('shared-edit', inventory.team)
|
2019-08-26 14:56:46 +08:00
|
|
|
else
|
2019-09-02 16:30:29 +08:00
|
|
|
draw_custom_icon('shared-read', inventory.team)
|
2019-08-26 14:56:46 +08:00
|
|
|
end
|
2019-08-26 16:45:40 +08:00
|
|
|
else
|
|
|
|
# The icon should be hiden if repo is not shared (we're updating it dinamically)
|
|
|
|
css_classes = ["repository-share-status"]
|
2019-09-10 17:20:18 +08:00
|
|
|
css_classes.push("hidden") unless inventory.i_shared?(team)
|
2019-09-02 16:30:29 +08:00
|
|
|
css_title = t('repositories.icon_title.i_shared')
|
2019-08-26 16:45:40 +08:00
|
|
|
|
2019-09-02 16:30:29 +08:00
|
|
|
content_tag :span, title: css_title, class: css_classes.join(" ") do
|
2019-08-26 16:45:40 +08:00
|
|
|
draw_custom_icon('i-shared')
|
|
|
|
end
|
2019-08-26 14:56:46 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|