From: Toshi MARUYAMA Date: Sat, 24 Oct 2020 14:39:47 +0000 (+0000) Subject: shorten long line of app/models/time_entry.rb X-Git-Tag: 4.2.0~636 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a0a45967b5396ec5183b749f8ed1d34e0301390;p=redmine.git shorten long line of app/models/time_entry.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20181 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index b2d3f58e4..0dc343475 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -28,17 +28,21 @@ class TimeEntry < ActiveRecord::Base belongs_to :activity, :class_name => 'TimeEntryActivity' acts_as_customizable - acts_as_event :title => - Proc.new {|o| - related = o.issue if o.issue && o.issue.visible? - related ||= o.project - "#{l_hours(o.hours)} (#{related.event_title})" - }, - :url => Proc.new {|o| {:controller => 'timelog', :action => 'index', :project_id => o.project, :issue_id => o.issue}}, - :author => :user, - :group => :issue, - :description => :comments - + acts_as_event( + :title => + Proc.new do |o| + related = o.issue if o.issue && o.issue.visible? + related ||= o.project + "#{l_hours(o.hours)} (#{related.event_title})" + end, + :url => + Proc.new do |o| + {:controller => 'timelog', :action => 'index', :project_id => o.project, :issue_id => o.issue} + end, + :author => :user, + :group => :issue, + :description => :comments + ) acts_as_activity_provider :timestamp => "#{table_name}.created_on", :author_key => :user_id, :scope => proc { joins(:project).preload(:project) } @@ -66,7 +70,9 @@ class TimeEntry < ActiveRecord::Base where("#{Issue.table_name}.root_id = #{issue.root_id} AND #{Issue.table_name}.lft >= #{issue.lft} AND #{Issue.table_name}.rgt <= #{issue.rgt}") } - safe_attributes 'user_id', 'hours', 'comments', 'project_id', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values', 'custom_fields' + safe_attributes 'user_id', 'hours', 'comments', 'project_id', + 'issue_id', 'activity_id', 'spent_on', + 'custom_field_values', 'custom_fields' # Returns a SQL conditions string used to find all time entries visible by the specified user def self.visible_condition(user, options={})