Mercurial > hg > soundsoftware-site
comparison app/controllers/.svn/text-base/journals_controller.rb.svn-base @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 # redMine - project management software | |
2 # Copyright (C) 2006-2008 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 class JournalsController < ApplicationController | |
19 before_filter :find_journal | |
20 | |
21 def edit | |
22 if request.post? | |
23 @journal.update_attributes(:notes => params[:notes]) if params[:notes] | |
24 @journal.destroy if @journal.details.empty? && @journal.notes.blank? | |
25 call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params}) | |
26 respond_to do |format| | |
27 format.html { redirect_to :controller => 'issues', :action => 'show', :id => @journal.journalized_id } | |
28 format.js { render :action => 'update' } | |
29 end | |
30 end | |
31 end | |
32 | |
33 private | |
34 def find_journal | |
35 @journal = Journal.find(params[:id]) | |
36 (render_403; return false) unless @journal.editable_by?(User.current) | |
37 @project = @journal.journalized.project | |
38 rescue ActiveRecord::RecordNotFound | |
39 render_404 | |
40 end | |
41 end |