diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 07:12:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 07:12:30 +0000 |
commit | 94c2356f383000cea42072a94b351f79ff4567d4 (patch) | |
tree | a1162b7ee00ddd498d1cb52d3d6299fd9bde9b08 /app/controllers | |
parent | 0714ced81572a1501d37bc866855a7f339c3bf03 (diff) | |
download | redmine-94c2356f383000cea42072a94b351f79ff4567d4.tar.gz redmine-94c2356f383000cea42072a94b351f79ff4567d4.zip |
Load changesets and time entries tabs async (#3058).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@18275 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/issues_controller.rb | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 73afc79d5..79077017c 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -20,7 +20,7 @@ class IssuesController < ApplicationController default_search_scope :issues - before_action :find_issue, :only => [:show, :edit, :update] + before_action :find_issue, :only => [:show, :edit, :update, :issue_tab] before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] before_action :authorize, :except => [:index, :new, :create] before_action :find_optional_project, :only => [:index, :new, :create] @@ -86,13 +86,10 @@ class IssuesController < ApplicationController def show @journals = @issue.visible_journals_with_index - @changesets = @issue.changesets.visible.preload(:repository, :user).to_a + @has_changesets = @issue.changesets.visible.preload(:repository, :user).exists? @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } - if User.current.wants_comments_in_reverse_order? - @journals.reverse! - @changesets.reverse! - end + @journals.reverse! if User.current.wants_comments_in_reverse_order? if User.current.allowed_to?(:view_time_entries, @project) Issue.load_visible_spent_hours([@issue]) @@ -109,7 +106,10 @@ class IssuesController < ApplicationController retrieve_previous_and_next_issue_ids render :template => 'issues/show' } - format.api + format.api { + @changesets = @issue.changesets.visible.preload(:repository, :user).to_a + @changesets.reverse! if User.current.wants_comments_in_reverse_order? + } format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } format.pdf { send_file_headers! :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf" @@ -194,6 +194,21 @@ class IssuesController < ApplicationController end end + def issue_tab + return render_error :status => 422 unless request.xhr? + tab = params[:name] + + case tab + when 'time_entries' + @time_entries = @issue.time_entries.visible.preload(:activity, :user).to_a + render :partial => 'issues/tabs/time_entries', :locals => {:time_entries => @time_entries} + when 'changesets' + @changesets = @issue.changesets.visible.preload(:repository, :user).to_a + changesets.reverse! if User.current.wants_comments_in_reverse_order? + render :partial => 'issues/tabs/changesets', :locals => {:changesets => @changesets} + end + end + # Bulk edit/copy a set of issues def bulk_edit @issues.sort! |