mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-30 20:23:14 +08:00
Merge pull request #2041 from mlorb/ml-sci-3847
Fix missing icon on shared inventories in global search [SCI-3847]
This commit is contained in:
commit
e596afa595
3 changed files with 4 additions and 9 deletions
|
@ -129,14 +129,13 @@ class SearchController < ApplicationController
|
|||
|
||||
current_user.teams.includes(:repositories).each do |team|
|
||||
team_results = {}
|
||||
team_results[:team] = team
|
||||
team_results[:count] = 0
|
||||
team_results[:repositories] = {}
|
||||
Repository.accessible_by_teams(team).each do |repository|
|
||||
repository_results = {}
|
||||
repository_results[:id] = repository.id
|
||||
if (shared_repo = repository.team_repositories.where(team: team).take)
|
||||
repository_results[:shared] = shared_repo[:permission_level]
|
||||
end
|
||||
repository_results[:repository] = repository
|
||||
repository_results[:count] = 0
|
||||
search_results.each do |result|
|
||||
if repository.id == result.id
|
||||
|
|
|
@ -11,7 +11,7 @@ module InventoriesHelper
|
|||
else
|
||||
# The icon should be hiden if repo is not shared (we're updating it dinamically)
|
||||
css_classes = ["repository-share-status"]
|
||||
css_classes.push("hidden") unless inventory.i_shared?(current_team)
|
||||
css_classes.push("hidden") unless inventory.i_shared?(team)
|
||||
css_title = t('repositories.icon_title.i_shared')
|
||||
|
||||
content_tag :span, title: css_title, class: css_classes.join(" ") do
|
||||
|
|
|
@ -233,11 +233,7 @@
|
|||
search_id: @search_id}.to_query %>">
|
||||
<span class="badge pull-right"><%= values[:count] %></span>
|
||||
<%= repository %>
|
||||
<% if values[:shared] == 'write' %>
|
||||
<%= draw_custom_icon('shared-edit') %>
|
||||
<% elsif values[:shared] == 'read' %>
|
||||
<%= draw_custom_icon('shared-read') %>
|
||||
<% end %>
|
||||
<%= inventory_shared_status_icon(values[:repository], results[:team]) %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue