diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-01-21 04:39:56 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-01-21 04:39:56 +0000 |
commit | 6bb1ea8ae8a1f7495ceb1ca656a056dbf11d3dac (patch) | |
tree | 4ad42455b3b4bfc62e5b0b4a7799b3a628e44dcd /app/controllers | |
parent | e2a999743e972f56dbd0e9b20bb7facb9a4a672d (diff) | |
download | redmine-6bb1ea8ae8a1f7495ceb1ca656a056dbf11d3dac.tar.gz redmine-6bb1ea8ae8a1f7495ceb1ca656a056dbf11d3dac.zip |
Use regular edit/update actions and named routes for JournalsController.
git-svn-id: http://svn.redmine.org/redmine/trunk@15074 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/journals_controller.rb | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index bae6ca2bc..382a84eb0 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -16,10 +16,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class JournalsController < ApplicationController - before_filter :find_journal, :only => [:edit, :diff] + before_filter :find_journal, :only => [:edit, :update, :diff] before_filter :find_issue, :only => [:new] before_filter :find_optional_project, :only => [:index] - before_filter :authorize, :only => [:new, :edit, :diff] + before_filter :authorize, :only => [:new, :edit, :update, :diff] accept_rss_auth :index menu_item :issues @@ -82,19 +82,20 @@ class JournalsController < ApplicationController 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? - call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params}) - respond_to do |format| - format.html { redirect_to issue_path(@journal.journalized) } - format.js { render :action => 'update' } - end - else - respond_to do |format| - # TODO: implement non-JS journal update - format.js - end + respond_to do |format| + # TODO: implement non-JS journal update + format.js + end + end + + def update + (render_403; return false) unless @journal.editable_by?(User.current) + @journal.update_attributes(:notes => params[:notes]) if params[:notes] + @journal.destroy if @journal.details.empty? && @journal.notes.blank? + call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params}) + respond_to do |format| + format.html { redirect_to issue_path(@journal.journalized) } + format.js end end |