##// END OF EJS Templates
Merged r15772 (#23472)....
Jean-Philippe Lang -
r15391:374468e88aab
parent child
Show More
@@ -1,75 +1,75
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # Redmine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2016 Jean-Philippe Lang
4 # Copyright (C) 2006-2016 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
20 module MyHelper
20 module MyHelper
21 def calendar_items(startdt, enddt)
21 def calendar_items(startdt, enddt)
22 Issue.visible.
22 Issue.visible.
23 where(:project_id => User.current.projects.map(&:id)).
23 where(:project_id => User.current.projects.map(&:id)).
24 where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", startdt, enddt, startdt, enddt).
24 where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", startdt, enddt, startdt, enddt).
25 includes(:project, :tracker, :priority, :assigned_to).
25 includes(:project, :tracker, :priority, :assigned_to).
26 references(:project, :tracker, :priority, :assigned_to).
26 references(:project, :tracker, :priority, :assigned_to).
27 to_a
27 to_a
28 end
28 end
29
29
30 def documents_items
30 def documents_items
31 Document.visible.order("#{Document.table_name}.created_on DESC").limit(10).to_a
31 Document.visible.order("#{Document.table_name}.created_on DESC").limit(10).to_a
32 end
32 end
33
33
34 def issuesassignedtome_items
34 def issuesassignedtome_items
35 Issue.visible.open.
35 Issue.visible.open.
36 assigned_to(User.current).
36 assigned_to(User.current).
37 limit(10).
37 limit(10).
38 includes(:status, :project, :tracker, :priority).
38 includes(:status, :project, :tracker, :priority).
39 references(:status, :project, :tracker, :priority).
39 references(:status, :project, :tracker, :priority).
40 order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC")
40 order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC")
41 end
41 end
42
42
43 def issuesreportedbyme_items
43 def issuesreportedbyme_items
44 Issue.visible.
44 Issue.visible.open.
45 where(:author_id => User.current.id).
45 where(:author_id => User.current.id).
46 limit(10).
46 limit(10).
47 includes(:status, :project, :tracker).
47 includes(:status, :project, :tracker).
48 references(:status, :project, :tracker).
48 references(:status, :project, :tracker).
49 order("#{Issue.table_name}.updated_on DESC")
49 order("#{Issue.table_name}.updated_on DESC")
50 end
50 end
51
51
52 def issueswatched_items
52 def issueswatched_items
53 Issue.visible.open.on_active_project.watched_by(User.current.id).recently_updated.limit(10)
53 Issue.visible.open.on_active_project.watched_by(User.current.id).recently_updated.limit(10)
54 end
54 end
55
55
56 def news_items
56 def news_items
57 News.visible.
57 News.visible.
58 where(:project_id => User.current.projects.map(&:id)).
58 where(:project_id => User.current.projects.map(&:id)).
59 limit(10).
59 limit(10).
60 includes(:project, :author).
60 includes(:project, :author).
61 references(:project, :author).
61 references(:project, :author).
62 order("#{News.table_name}.created_on DESC").
62 order("#{News.table_name}.created_on DESC").
63 to_a
63 to_a
64 end
64 end
65
65
66 def timelog_items
66 def timelog_items
67 TimeEntry.
67 TimeEntry.
68 where("#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", User.current.id, User.current.today - 6, User.current.today).
68 where("#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", User.current.id, User.current.today - 6, User.current.today).
69 joins(:activity, :project).
69 joins(:activity, :project).
70 references(:issue => [:tracker, :status]).
70 references(:issue => [:tracker, :status]).
71 includes(:issue => [:tracker, :status]).
71 includes(:issue => [:tracker, :status]).
72 order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC").
72 order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC").
73 to_a
73 to_a
74 end
74 end
75 end
75 end
@@ -1,15 +1,15
1 <% reported_issues = issuesreportedbyme_items %>
1 <% reported_issues = issuesreportedbyme_items %>
2 <h3>
2 <h3>
3 <%= link_to l(:label_reported_issues),
3 <%= link_to l(:label_reported_issues),
4 issues_path(:set_filter => 1, :status_id => '*', :author_id => 'me', :sort => 'updated_on:desc') %>
4 issues_path(:set_filter => 1, :status_id => 'o', :author_id => 'me', :sort => 'updated_on:desc') %>
5 (<%= reported_issues.limit(nil).count %>)
5 (<%= reported_issues.limit(nil).count %>)
6 </h3>
6 </h3>
7
7
8 <%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues.to_a } %>
8 <%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues.to_a } %>
9
9
10 <% content_for :header_tags do %>
10 <% content_for :header_tags do %>
11 <%= auto_discovery_link_tag(:atom,
11 <%= auto_discovery_link_tag(:atom,
12 {:controller => 'issues', :action => 'index', :set_filter => 1,
12 {:controller => 'issues', :action => 'index', :set_filter => 1,
13 :author_id => 'me', :format => 'atom', :key => User.current.rss_key},
13 :author_id => 'me', :format => 'atom', :key => User.current.rss_key},
14 {:title => l(:label_reported_issues)}) %>
14 {:title => l(:label_reported_issues)}) %>
15 <% end %>
15 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now