remove trailing white-spaces from app/controllers/timelog_controller.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6518 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
44147ee8f2
commit
dd43df8180
@ -5,12 +5,12 @@
|
|||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
@ -24,14 +24,14 @@ class TimelogController < ApplicationController
|
|||||||
before_filter :find_optional_project, :only => [:index]
|
before_filter :find_optional_project, :only => [:index]
|
||||||
accept_rss_auth :index
|
accept_rss_auth :index
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy
|
accept_api_auth :index, :show, :create, :update, :destroy
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
include SortHelper
|
include SortHelper
|
||||||
helper :issues
|
helper :issues
|
||||||
include TimelogHelper
|
include TimelogHelper
|
||||||
helper :custom_fields
|
helper :custom_fields
|
||||||
include CustomFieldsHelper
|
include CustomFieldsHelper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
sort_init 'spent_on', 'desc'
|
sort_init 'spent_on', 'desc'
|
||||||
sort_update 'spent_on' => 'spent_on',
|
sort_update 'spent_on' => 'spent_on',
|
||||||
@ -40,14 +40,14 @@ class TimelogController < ApplicationController
|
|||||||
'project' => "#{Project.table_name}.name",
|
'project' => "#{Project.table_name}.name",
|
||||||
'issue' => 'issue_id',
|
'issue' => 'issue_id',
|
||||||
'hours' => 'hours'
|
'hours' => 'hours'
|
||||||
|
|
||||||
cond = ARCondition.new
|
cond = ARCondition.new
|
||||||
if @issue
|
if @issue
|
||||||
cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}"
|
cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}"
|
||||||
elsif @project
|
elsif @project
|
||||||
cond << @project.project_condition(Setting.display_subprojects_issues?)
|
cond << @project.project_condition(Setting.display_subprojects_issues?)
|
||||||
end
|
end
|
||||||
|
|
||||||
retrieve_date_range
|
retrieve_date_range
|
||||||
cond << ['spent_on BETWEEN ? AND ?', @from, @to]
|
cond << ['spent_on BETWEEN ? AND ?', @from, @to]
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class TimelogController < ApplicationController
|
|||||||
# Paginate results
|
# Paginate results
|
||||||
@entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions)
|
@entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions)
|
||||||
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
|
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
|
||||||
@entries = TimeEntry.visible.find(:all,
|
@entries = TimeEntry.visible.find(:all,
|
||||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||||
:conditions => cond.conditions,
|
:conditions => cond.conditions,
|
||||||
:order => sort_clause,
|
:order => sort_clause,
|
||||||
@ -69,7 +69,7 @@ class TimelogController < ApplicationController
|
|||||||
format.api {
|
format.api {
|
||||||
@entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions)
|
@entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions)
|
||||||
@offset, @limit = api_offset_and_limit
|
@offset, @limit = api_offset_and_limit
|
||||||
@entries = TimeEntry.visible.find(:all,
|
@entries = TimeEntry.visible.find(:all,
|
||||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||||
:conditions => cond.conditions,
|
:conditions => cond.conditions,
|
||||||
:order => sort_clause,
|
:order => sort_clause,
|
||||||
@ -86,7 +86,7 @@ class TimelogController < ApplicationController
|
|||||||
}
|
}
|
||||||
format.csv {
|
format.csv {
|
||||||
# Export all entries
|
# Export all entries
|
||||||
@entries = TimeEntry.visible.find(:all,
|
@entries = TimeEntry.visible.find(:all,
|
||||||
:include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
|
:include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
|
||||||
:conditions => cond.conditions,
|
:conditions => cond.conditions,
|
||||||
:order => sort_clause)
|
:order => sort_clause)
|
||||||
@ -94,7 +94,7 @@ class TimelogController < ApplicationController
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
# TODO: Implement html response
|
# TODO: Implement html response
|
||||||
@ -106,7 +106,7 @@ class TimelogController < ApplicationController
|
|||||||
def new
|
def new
|
||||||
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||||
render :action => 'edit'
|
render :action => 'edit'
|
||||||
end
|
end
|
||||||
@ -115,9 +115,9 @@ class TimelogController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||||
|
|
||||||
if @time_entry.save
|
if @time_entry.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@ -131,21 +131,21 @@ class TimelogController < ApplicationController
|
|||||||
format.html { render :action => 'edit' }
|
format.html { render :action => 'edit' }
|
||||||
format.api { render_validation_errors(@time_entry) }
|
format.api { render_validation_errors(@time_entry) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||||
end
|
end
|
||||||
|
|
||||||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||||
def update
|
def update
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
|
||||||
|
|
||||||
if @time_entry.save
|
if @time_entry.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@ -159,7 +159,7 @@ class TimelogController < ApplicationController
|
|||||||
format.html { render :action => 'edit' }
|
format.html { render :action => 'edit' }
|
||||||
format.api { render_validation_errors(@time_entry) }
|
format.api { render_validation_errors(@time_entry) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def bulk_edit
|
def bulk_edit
|
||||||
@ -186,7 +186,7 @@ class TimelogController < ApplicationController
|
|||||||
|
|
||||||
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
|
||||||
def destroy
|
def destroy
|
||||||
@time_entries.each do |t|
|
@time_entries.each do |t|
|
||||||
begin
|
begin
|
||||||
unless t.destroy && t.destroyed?
|
unless t.destroy && t.destroyed?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
@ -258,7 +258,7 @@ private
|
|||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_optional_project
|
def find_optional_project
|
||||||
if !params[:issue_id].blank?
|
if !params[:issue_id].blank?
|
||||||
@issue = Issue.find(params[:issue_id])
|
@issue = Issue.find(params[:issue_id])
|
||||||
@ -268,7 +268,7 @@ private
|
|||||||
end
|
end
|
||||||
deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true)
|
deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Retrieves the date range based on predefined ranges or specific from/to param dates
|
# Retrieves the date range based on predefined ranges or specific from/to param dates
|
||||||
def retrieve_date_range
|
def retrieve_date_range
|
||||||
@free_period = false
|
@free_period = false
|
||||||
@ -309,7 +309,7 @@ private
|
|||||||
else
|
else
|
||||||
# default
|
# default
|
||||||
end
|
end
|
||||||
|
|
||||||
@from, @to = @to, @from if @from && @to && @from > @to
|
@from, @to = @to, @from if @from && @to && @from > @to
|
||||||
@from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)
|
@from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)
|
||||||
@to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)
|
@to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user