Check permissions before setting attributes for no_results_box

pull/6067/head
Wieland Lindenthal 7 years ago
parent 49838f3b0c
commit 9f115a7805
  1. 8
      app/helpers/projects_helper.rb
  2. 2
      app/views/projects/index.html.erb

@ -138,6 +138,14 @@ module ProjectsHelper
blacklist.include?(filter.class)
end
def no_projects_result_box_params
if User.current.allowed_to?(:add_project, nil, global: true)
{ action_url: new_project_path, display_action: true }
else
{}
end
end
def project_more_menu_items(project)
[project_more_menu_subproject_item(project),
project_more_menu_settings_item(project),

@ -164,7 +164,7 @@ See doc/COPYRIGHT.rdoc for more details.
</div>
</div>
<% else %>
<%= no_results_box(action_url: new_project_path, display_action: true) %>
<%= no_results_box(no_projects_result_box_params) %>
<% end %>
<% if User.current.admin? %>

Loading…
Cancel
Save