summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-27 13:34:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-27 13:34:41 +0000
commit262741913119f61eb4ccdd21410e552fdaca159d (patch)
tree76a647109db21853c4fa4fa04335a63fe76a80a4 /app/controllers
parentca807c8d928497bc8c68310bd852a2b85c83e975 (diff)
downloadredmine-262741913119f61eb4ccdd21410e552fdaca159d.tar.gz
redmine-262741913119f61eb4ccdd21410e552fdaca159d.zip
Keep track of issue description changes (#746).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4954 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/journals_controller.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index 189204e26..37e52ca53 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -1,5 +1,5 @@
-# redMine - project management software
-# Copyright (C) 2006-2008 Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -16,12 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalsController < ApplicationController
- before_filter :find_journal, :only => [:edit]
+ before_filter :find_journal, :only => [:edit, :diff]
before_filter :find_issue, :only => [:new]
before_filter :find_optional_project, :only => [:index]
- before_filter :authorize, :only => [:new, :edit]
+ before_filter :authorize, :only => [:new, :edit, :diff]
accept_key_auth :index
-
+ menu_item :issues
+
helper :issues
helper :queries
include QueriesHelper
@@ -43,6 +44,17 @@ class JournalsController < ApplicationController
render_404
end
+ def diff
+ @issue = @journal.issue
+ if params[:detail_id].present?
+ @detail = @journal.details.find_by_id(params[:detail_id])
+ else
+ @detail = @journal.details.detect {|d| d.prop_key == 'description'}
+ end
+ (render_404; return false) unless @issue && @detail
+ @diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value)
+ end
+
def new
journal = Journal.find(params[:journal_id]) if params[:journal_id]
if journal
@@ -67,6 +79,7 @@ class JournalsController < ApplicationController
end
def edit
+ (render_403; return false) unless @journal.editable_by?(User.current)
if request.post?
@journal.update_attributes(:notes => params[:notes]) if params[:notes]
@journal.destroy if @journal.details.empty? && @journal.notes.blank?
@@ -86,10 +99,10 @@ class JournalsController < ApplicationController
end
end
-private
+ private
+
def find_journal
@journal = Journal.find(params[:id])
- (render_403; return false) unless @journal.editable_by?(User.current)
@project = @journal.journalized.project
rescue ActiveRecord::RecordNotFound
render_404