comparison app/helpers/my_helper.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children 4f746d8966dd 51364c0cd58f e248c7af89ec
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2012 Jean-Philippe Lang 4 # Copyright (C) 2006-2013 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.
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)
22 Issue.visible.
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).
25 includes(:project, :tracker, :priority, :assigned_to).
26 all
27 end
28
29 def documents_items
30 Document.visible.order("#{Document.table_name}.created_on DESC").limit(10).all
31 end
32
33 def issuesassignedtome_items
34 Issue.visible.open.
35 where(:assigned_to_id => ([User.current.id] + User.current.group_ids)).
36 limit(10).
37 includes(:status, :project, :tracker, :priority).
38 order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC").
39 all
40 end
41
42 def issuesreportedbyme_items
43 Issue.visible.
44 where(:author_id => User.current.id).
45 limit(10).
46 includes(:status, :project, :tracker).
47 order("#{Issue.table_name}.updated_on DESC").
48 all
49 end
50
51 def issueswatched_items
52 Issue.visible.on_active_project.watched_by(User.current.id).recently_updated.limit(10).all
53 end
54
55 def news_items
56 News.visible.
57 where(:project_id => User.current.projects.map(&:id)).
58 limit(10).
59 includes(:project, :author).
60 order("#{News.table_name}.created_on DESC").
61 all
62 end
63
64 def timelog_items
65 TimeEntry.
66 where("#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", User.current.id, Date.today - 6, Date.today).
67 includes(:activity, :project, {:issue => [:tracker, :status]}).
68 order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC").
69 all
70 end
21 end 71 end