Mercurial > hg > soundsoftware-site
diff app/controllers/issues_controller.rb @ 909:cbb26bc654de redmine-1.3
Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2012 19:09:32 +0000 |
parents | 0c939c159af4 |
children | 5e80956cc792 433d4f72a19b |
line wrap: on
line diff
--- a/app/controllers/issues_controller.rb Fri Feb 24 18:36:29 2012 +0000 +++ b/app/controllers/issues_controller.rb Fri Feb 24 19:09:32 2012 +0000 @@ -89,15 +89,20 @@ @issue_count_by_group = @query.issue_count_by_group respond_to do |format| - format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? } - format.api + format.html { render :template => 'issues/index', :layout => !request.xhr? } + format.api { + Issue.load_relations(@issues) if include_in_api_response?('relations') + } format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } - format.csv { send_data(issues_to_csv(@issues, @project), :type => 'text/csv; header=present', :filename => 'export.csv') } + format.csv { send_data(issues_to_csv(@issues, @project, @query, params), :type => 'text/csv; header=present', :filename => 'export.csv') } format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') } end else - # Send html if the query is not valid - render(:template => 'issues/index.rhtml', :layout => !request.xhr?) + respond_to do |format| + format.html { render(:template => 'issues/index', :layout => !request.xhr?) } + format.any(:atom, :csv, :pdf) { render(:nothing => true) } + format.api { render_validation_errors(@query) } + end end rescue ActiveRecord::RecordNotFound render_404 @@ -116,10 +121,10 @@ @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @edit_allowed = User.current.allowed_to?(:edit_issues, @project) - @priorities = IssuePriority.all + @priorities = IssuePriority.active @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) respond_to do |format| - format.html { render :template => 'issues/show.rhtml' } + format.html { render :template => 'issues/show' } format.api format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") } @@ -139,11 +144,11 @@ call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) if @issue.save attachments = Attachment.attach_files(@issue, params[:attachments]) - render_attachment_warning_if_needed(@issue) - flash[:notice] = l(:notice_successful_create) call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| format.html { + render_attachment_warning_if_needed(@issue) + flash[:notice] = l(:notice_issue_successful_create, :id => "<a href='#{issue_path(@issue)}'>##{@issue.id}</a>") redirect_to(params[:continue] ? { :action => 'new', :project_id => @project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } : { :action => 'show', :id => @issue }) } @@ -280,7 +285,7 @@ # TODO: Refactor, not everything in here is needed by #edit def update_issue_from_params @allowed_statuses = @issue.new_statuses_allowed_to(User.current) - @priorities = IssuePriority.all + @priorities = IssuePriority.active @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) @time_entry.attributes = params[:time_entry] @@ -309,14 +314,14 @@ render_error l(:error_no_tracker_in_project) return false end - @issue.start_date ||= Date.today + @issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date? if params[:issue].is_a?(Hash) @issue.safe_attributes = params[:issue] if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record? @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] end end - @priorities = IssuePriority.all + @priorities = IssuePriority.active @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) end