Browse Source

Extract code to render project context links to helper (#16381).

Patch by Michael Esemplare.

git-svn-id: http://svn.redmine.org/redmine/trunk@12986 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.6.0
Jean-Philippe Lang 10 years ago
parent
commit
f4e5025aed
2 changed files with 10 additions and 6 deletions
  1. 9
    0
      app/helpers/projects_helper.rb
  2. 1
    6
      app/views/projects/index.html.erb

+ 9
- 0
app/helpers/projects_helper.rb View File

@@ -51,6 +51,15 @@ module ProjectsHelper
content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
end

def render_project_action_links
links = []
links << link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true)
links << link_to(l(:label_issue_view_all), issues_path) if User.current.allowed_to?(:view_issues, nil, :global => true)
links << link_to(l(:label_overall_spent_time), time_entries_path) if User.current.allowed_to?(:view_time_entries, nil, :global => true)
links << link_to(l(:label_overall_activity), { :controller => 'activities', :action => 'index', :id => nil })
links.join(" | ").html_safe
end

# Renders the projects index
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|

+ 1
- 6
app/views/projects/index.html.erb View File

@@ -3,12 +3,7 @@
<% end %>

<div class="contextual">
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
<%= link_to(l(:label_issue_view_all), issues_path) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
<%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
<%= link_to l(:label_overall_activity),
{ :controller => 'activities', :action => 'index',
:id => nil } %>
<%= render_project_action_links %>
</div>

<h2><%= l(:label_project_plural) %></h2>

Loading…
Cancel
Save