annotate .svn/pristine/67/67470de29b42ab68f2ad12b7d5476c24aca2eaa2.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents e248c7af89ec
children
rev   line source
Chris@1494 1 # encoding: utf-8
Chris@1494 2 #
Chris@1494 3 # Redmine - project management software
Chris@1494 4 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@1494 5 #
Chris@1494 6 # This program is free software; you can redistribute it and/or
Chris@1494 7 # modify it under the terms of the GNU General Public License
Chris@1494 8 # as published by the Free Software Foundation; either version 2
Chris@1494 9 # of the License, or (at your option) any later version.
Chris@1494 10 #
Chris@1494 11 # This program is distributed in the hope that it will be useful,
Chris@1494 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1494 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1494 14 # GNU General Public License for more details.
Chris@1494 15 #
Chris@1494 16 # You should have received a copy of the GNU General Public License
Chris@1494 17 # along with this program; if not, write to the Free Software
Chris@1494 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1494 19
Chris@1494 20 module MyHelper
Chris@1494 21 def calendar_items(startdt, enddt)
Chris@1494 22 Issue.visible.
Chris@1494 23 where(:project_id => User.current.projects.map(&:id)).
Chris@1494 24 where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", startdt, enddt, startdt, enddt).
Chris@1494 25 includes(:project, :tracker, :priority, :assigned_to).
Chris@1494 26 all
Chris@1494 27 end
Chris@1494 28
Chris@1494 29 def documents_items
Chris@1494 30 Document.visible.order("#{Document.table_name}.created_on DESC").limit(10).all
Chris@1494 31 end
Chris@1494 32
Chris@1494 33 def issuesassignedtome_items
Chris@1494 34 Issue.visible.open.
Chris@1494 35 where(:assigned_to_id => ([User.current.id] + User.current.group_ids)).
Chris@1494 36 limit(10).
Chris@1494 37 includes(:status, :project, :tracker, :priority).
Chris@1494 38 order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC").
Chris@1494 39 all
Chris@1494 40 end
Chris@1494 41
Chris@1494 42 def issuesreportedbyme_items
Chris@1494 43 Issue.visible.
Chris@1494 44 where(:author_id => User.current.id).
Chris@1494 45 limit(10).
Chris@1494 46 includes(:status, :project, :tracker).
Chris@1494 47 order("#{Issue.table_name}.updated_on DESC").
Chris@1494 48 all
Chris@1494 49 end
Chris@1494 50
Chris@1494 51 def issueswatched_items
Chris@1494 52 Issue.visible.on_active_project.watched_by(User.current.id).recently_updated.limit(10).all
Chris@1494 53 end
Chris@1494 54
Chris@1494 55 def news_items
Chris@1494 56 News.visible.
Chris@1494 57 where(:project_id => User.current.projects.map(&:id)).
Chris@1494 58 limit(10).
Chris@1494 59 includes(:project, :author).
Chris@1494 60 order("#{News.table_name}.created_on DESC").
Chris@1494 61 all
Chris@1494 62 end
Chris@1494 63
Chris@1494 64 def timelog_items
Chris@1494 65 TimeEntry.
Chris@1494 66 where("#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", User.current.id, Date.today - 6, Date.today).
Chris@1494 67 includes(:activity, :project, {:issue => [:tracker, :status]}).
Chris@1494 68 order("#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC").
Chris@1494 69 all
Chris@1494 70 end
Chris@1494 71 end