Commit 89beb41af79e9802f07eb2946c76c140269f8302

Authored by Luciano Prestes
1 parent 80cb621a

Link to control panel in software information block shown only to admins of software

Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Signed-off-by: Parley Martins <parley@outlook.com>
lib/ext/search_controller.rb
@@ -3,7 +3,7 @@ require_dependency &#39;search_controller&#39; @@ -3,7 +3,7 @@ require_dependency &#39;search_controller&#39;
3 class SearchController 3 class SearchController
4 4
5 def communities 5 def communities
6 - unfiltered_list = visible_profiles(Community).select{ |com| com.name.downcase =~ /#{params[:query].downcase}/} 6 + unfiltered_list = visible_profiles(Community).select{ |com| com.name.downcase =~ /#{params[:query]}.downcase/}
7 list_without_software_and_institution = [] 7 list_without_software_and_institution = []
8 unfiltered_list.each do |p| 8 unfiltered_list.each do |p|
9 if p.class == Community and !p.software? and !p.institution? 9 if p.class == Community and !p.software? and !p.institution?
views/blocks/software_information.html.erb
@@ -13,7 +13,9 @@ @@ -13,7 +13,9 @@
13 <%= link_to profile_image(block.owner, :big) +"\n", profile.url %> 13 <%= link_to profile_image(block.owner, :big) +"\n", profile.url %>
14 </span> 14 </span>
15 <div class='admin-link'> 15 <div class='admin-link'>
16 - <%= link_to _('Control panel'), block.owner.admin_url %> 16 + <% if block.owner.admins.include?(current_user.person) %>
  17 + <%= link_to _('Control panel'), block.owner.admin_url %>
  18 + <% end %>
17 </div> 19 </div>
18 </div> 20 </div>
19 </div> 21 </div>
@@ -27,7 +29,7 @@ @@ -27,7 +29,7 @@
27 <b> 29 <b>
28 <%= block.owner.software_info.finality %> 30 <%= block.owner.software_info.finality %>
29 </b> 31 </b>
30 - </td> 32 + </td>
31 </tr> 33 </tr>
32 <tr> 34 <tr>
33 <td colspan="2"> 35 <td colspan="2">