render_project_action_links.patch

Michael Esemplare, 2014-03-19 07:41

Download (2.07 KB)

View differences:

app/helpers/projects_helper.rb (working copy)
51 51
    content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
52 52
  end
53
  def render_project_action_links
54
    links = []
55
    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)
56
    links << link_to(l(:label_issue_view_all), issues_path) if User.current.allowed_to?(:view_issues, nil, :global => true)
57
    links << link_to(l(:label_overall_spent_time), time_entries_path) if User.current.allowed_to?(:view_time_entries, nil, :global => true)
58
    links << link_to(l(:label_overall_activity), { :controller => 'activities', :action => 'index', :id => nil })
59
    links.join(" | ").html_safe
60
  end
61

  
53 62
  # Renders the projects index
54 63
  def render_project_hierarchy(projects)
55 64
    render_project_nested_lists(projects) do |project|
app/views/projects/index.html.erb (working copy)
3 3
<% end %>
4 4
<div class="contextual">
5
    <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') + ' |' if User.current.allowed_to?(:add_project, nil, :global => true) %>
6
    <%= link_to(l(:label_issue_view_all), issues_path) + ' |' if User.current.allowed_to?(:view_issues, nil, :global => true) %>
7
    <%= link_to(l(:label_overall_spent_time), time_entries_path) + ' |' if User.current.allowed_to?(:view_time_entries, nil, :global => true) %>
8
    <%= link_to l(:label_overall_activity),
9
                { :controller => 'activities', :action => 'index',
10
                  :id => nil } %>
5
    <%= render_project_action_links %>
11 6
</div>
12 7
<h2><%= l(:label_project_plural) %></h2>