From 169f16fb32091701bcaa962872ea35b5772a1539 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 20 Sep 2012 15:20:48 -0400 Subject: Remove Commits#compare, add CompareController --- app/controllers/compare_controller.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/controllers/compare_controller.rb (limited to 'app/controllers/compare_controller.rb') diff --git a/app/controllers/compare_controller.rb b/app/controllers/compare_controller.rb new file mode 100644 index 00000000000..1124fd0caa3 --- /dev/null +++ b/app/controllers/compare_controller.rb @@ -0,0 +1,22 @@ +class CompareController < ApplicationController + before_filter :project + layout "project" + + # Authorize + before_filter :add_project_abilities + before_filter :authorize_read_project! + before_filter :authorize_code_access! + before_filter :require_non_empty_project + + def show + result = Commit.compare(project, params[:from], params[:to]) + + @commits = result[:commits] + @commit = result[:commit] + @diffs = result[:diffs] + @refs_are_same = result[:same] + @line_notes = [] + + @commits = CommitDecorator.decorate(@commits) + end +end -- cgit v1.2.1 From 6cb626ef516a230b2af4e15145488d4c57cd048c Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 25 Sep 2012 23:10:50 -0400 Subject: Add Compare#index and Compare#create actions Create just redirects to our specially-formatted #show action --- app/controllers/compare_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/controllers/compare_controller.rb') diff --git a/app/controllers/compare_controller.rb b/app/controllers/compare_controller.rb index 1124fd0caa3..62f968fd1ed 100644 --- a/app/controllers/compare_controller.rb +++ b/app/controllers/compare_controller.rb @@ -8,6 +8,9 @@ class CompareController < ApplicationController before_filter :authorize_code_access! before_filter :require_non_empty_project + def index + end + def show result = Commit.compare(project, params[:from], params[:to]) @@ -19,4 +22,8 @@ class CompareController < ApplicationController @commits = CommitDecorator.decorate(@commits) end + + def create + redirect_to project_compare_path(@project, params[:from], params[:to]) + end end -- cgit v1.2.1