@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -18,7 +18,7 | |||
|
18 | 18 | class IssuesController < ApplicationController |
|
19 | 19 | menu_item :new_issue, :only => [:new, :create] |
|
20 | 20 | default_search_scope :issues |
|
21 | ||
|
21 | ||
|
22 | 22 | before_filter :find_issue, :only => [:show, :edit, :update] |
|
23 | 23 | before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :move, :perform_move, :destroy] |
|
24 | 24 | before_filter :check_project_uniqueness, :only => [:move, :perform_move] |
@@ -30,10 +30,10 class IssuesController < ApplicationController | |||
|
30 | 30 | accept_key_auth :index, :show, :create, :update, :destroy |
|
31 | 31 | |
|
32 | 32 | rescue_from Query::StatementInvalid, :with => :query_statement_invalid |
|
33 | ||
|
33 | ||
|
34 | 34 | helper :journals |
|
35 | 35 | helper :projects |
|
36 |
include ProjectsHelper |
|
|
36 | include ProjectsHelper | |
|
37 | 37 | helper :custom_fields |
|
38 | 38 | include CustomFieldsHelper |
|
39 | 39 | helper :issue_relations |
@@ -60,12 +60,12 class IssuesController < ApplicationController | |||
|
60 | 60 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
|
61 | 61 | verify :method => :post, :only => :bulk_update, :render => {:nothing => true, :status => :method_not_allowed } |
|
62 | 62 | verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
|
63 | ||
|
63 | ||
|
64 | 64 | def index |
|
65 | 65 | retrieve_query |
|
66 | 66 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
|
67 | 67 | sort_update(@query.sortable_columns) |
|
68 | ||
|
68 | ||
|
69 | 69 | if @query.valid? |
|
70 | 70 | case params[:format] |
|
71 | 71 | when 'csv', 'pdf' |
@@ -77,16 +77,16 class IssuesController < ApplicationController | |||
|
77 | 77 | else |
|
78 | 78 | @limit = per_page_option |
|
79 | 79 | end |
|
80 | ||
|
80 | ||
|
81 | 81 | @issue_count = @query.issue_count |
|
82 | 82 | @issue_pages = Paginator.new self, @issue_count, @limit, params['page'] |
|
83 | 83 | @offset ||= @issue_pages.current.offset |
|
84 | 84 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], |
|
85 |
:order => sort_clause, |
|
|
86 |
:offset => @offset, |
|
|
85 | :order => sort_clause, | |
|
86 | :offset => @offset, | |
|
87 | 87 | :limit => @limit) |
|
88 | 88 | @issue_count_by_group = @query.issue_count_by_group |
|
89 | ||
|
89 | ||
|
90 | 90 | respond_to do |format| |
|
91 | 91 | format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? } |
|
92 | 92 | format.api |
@@ -101,17 +101,17 class IssuesController < ApplicationController | |||
|
101 | 101 | rescue ActiveRecord::RecordNotFound |
|
102 | 102 | render_404 |
|
103 | 103 | end |
|
104 | ||
|
104 | ||
|
105 | 105 | def show |
|
106 | 106 | @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
107 | 107 | @journals.each_with_index {|j,i| j.indice = i+1} |
|
108 | 108 | @journals.reverse! if User.current.wants_comments_in_reverse_order? |
|
109 | ||
|
109 | ||
|
110 | 110 | if User.current.allowed_to?(:view_changesets, @project) |
|
111 | 111 | @changesets = @issue.changesets.visible.all |
|
112 | 112 | @changesets.reverse! if User.current.wants_comments_in_reverse_order? |
|
113 | 113 | end |
|
114 | ||
|
114 | ||
|
115 | 115 | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } |
|
116 | 116 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
117 | 117 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
@@ -156,7 +156,7 class IssuesController < ApplicationController | |||
|
156 | 156 | end |
|
157 | 157 | end |
|
158 | 158 | end |
|
159 | ||
|
159 | ||
|
160 | 160 | def edit |
|
161 | 161 | update_issue_from_params |
|
162 | 162 | |
@@ -218,7 +218,7 class IssuesController < ApplicationController | |||
|
218 | 218 | set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids) |
|
219 | 219 | redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project}) |
|
220 | 220 | end |
|
221 | ||
|
221 | ||
|
222 | 222 | def destroy |
|
223 | 223 | @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f |
|
224 | 224 | if @hours > 0 |
@@ -266,14 +266,14 private | |||
|
266 | 266 | rescue ActiveRecord::RecordNotFound |
|
267 | 267 | render_404 |
|
268 | 268 | end |
|
269 | ||
|
269 | ||
|
270 | 270 | def find_project |
|
271 | 271 | project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] |
|
272 | 272 | @project = Project.find(project_id) |
|
273 | 273 | rescue ActiveRecord::RecordNotFound |
|
274 | 274 | render_404 |
|
275 | 275 | end |
|
276 | ||
|
276 | ||
|
277 | 277 | # Used by #edit and #update to set some common instance variables |
|
278 | 278 | # from the params |
|
279 | 279 | # TODO: Refactor, not everything in here is needed by #edit |
@@ -283,7 +283,7 private | |||
|
283 | 283 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
|
284 | 284 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
|
285 | 285 | @time_entry.attributes = params[:time_entry] |
|
286 | ||
|
286 | ||
|
287 | 287 | @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil) |
|
288 | 288 | @issue.init_journal(User.current, @notes) |
|
289 | 289 | @issue.safe_attributes = params[:issue] |
@@ -299,7 +299,7 private | |||
|
299 | 299 | else |
|
300 | 300 | @issue = @project.issues.visible.find(params[:id]) |
|
301 | 301 | end |
|
302 | ||
|
302 | ||
|
303 | 303 | @issue.project = @project |
|
304 | 304 | # Tracker must be set before custom field values |
|
305 | 305 | @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) |
General Comments 0
You need to be logged in to leave comments.
Login now