Project

General

Profile

Patch #738 » mypage-block-projects.patch

chris mcharg, 2008-02-25 15:50

View differences:

app/controllers/my_controller.rb
23 23

  
24 24
  BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
25 25
             'issuesreportedbyme' => :label_reported_issues,
26
             'projectsiamin' => :label_projects_i_am_in,
26 27
             'issueswatched' => :label_watched_issues,
27 28
             'news' => :label_news_latest,
28 29
             'calendar' => :label_calendar,
app/views/my/blocks/_projectsiamin.rhtml
1
<h3><%=l(:label_projects_i_am_in)%></h3>
2
<%
3
projects = Project.find :all,
4
                        :conditions => "#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND" +
5
                            " #{Project.table_name}.id IN" +
6
                            " (#{User.current.memberships.collect{|m| m.project_id}.join(',')})",
7
                        :include => :parent
8
@project_tree = projects.group_by {|p| p.parent || p}
9
@project_tree.each_key {|p| @project_tree[p] -= [p]}
10
%>
11
<% if @project_tree.any? %>
12
<ul>
13
<% @project_tree.keys.sort.each do |project| %>
14
<li>
15
<%= link_to h(project.name), {:controller => 'projects', :action => 'show', :id => project} %>
16
<% if @project_tree[project].any? %>
17
    <br />
18
    <%= l(:label_subproject_plural) %>:
19
    <%= @project_tree[project].sort.collect {|subproject| 
20
       link_to(h(subproject.name), {:controller => 'projects', :action => 'show', :id => subproject})}.join(', ') %>
21
<% end %>
22
</li>
23
<% end %>
24
</ul>
25
<% end %>
26
<p class="small"><%= link_to l(:label_project_all), :controller => 'projects', :action => 'index' %></p>
lang/en.yml
271 271
label_help: Help
272 272
label_reported_issues: Reported issues
273 273
label_assigned_to_me_issues: Issues assigned to me
274
label_projects_i_am_in: Projects I am in
274 275
label_last_login: Last connection
275 276
label_last_updates: Last updated
276 277
label_last_updates_plural: %d last updated
(1-1/2)