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 3 class SearchController
4 4  
5 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 7 list_without_software_and_institution = []
8 8 unfiltered_list.each do |p|
9 9 if p.class == Community and !p.software? and !p.institution?
... ...
views/blocks/software_information.html.erb
... ... @@ -13,7 +13,9 @@
13 13 <%= link_to profile_image(block.owner, :big) +"\n", profile.url %>
14 14 </span>
15 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 19 </div>
18 20 </div>
19 21 </div>
... ... @@ -27,7 +29,7 @@
27 29 <b>
28 30 <%= block.owner.software_info.finality %>
29 31 </b>
30   - </td>
  32 + </td>
31 33 </tr>
32 34 <tr>
33 35 <td colspan="2">
... ...