@@ -1,40 +1,41 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2008 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class JournalsController < ApplicationController |
|
19 | 19 | before_filter :find_journal |
|
20 | 20 | |
|
21 | 21 | def edit |
|
22 | 22 | if request.post? |
|
23 | 23 | @journal.update_attributes(:notes => params[:notes]) if params[:notes] |
|
24 | 24 | @journal.destroy if @journal.details.empty? && @journal.notes.blank? |
|
25 | call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params}) | |
|
25 | 26 | respond_to do |format| |
|
26 | 27 | format.html { redirect_to :controller => 'issues', :action => 'show', :id => @journal.journalized_id } |
|
27 | 28 | format.js { render :action => 'update' } |
|
28 | 29 | end |
|
29 | 30 | end |
|
30 | 31 | end |
|
31 | 32 | |
|
32 | 33 | private |
|
33 | 34 | def find_journal |
|
34 | 35 | @journal = Journal.find(params[:id]) |
|
35 | 36 | render_403 and return false unless @journal.editable_by?(User.current) |
|
36 | 37 | @project = @journal.journalized.project |
|
37 | 38 | rescue ActiveRecord::RecordNotFound |
|
38 | 39 | render_404 |
|
39 | 40 | end |
|
40 | 41 | end |
@@ -1,7 +1,8 | |||
|
1 | 1 | <% form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %> |
|
2 | 2 | <%= text_area_tag :notes, @journal.notes, :class => 'wiki-edit', |
|
3 | 3 | :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %> |
|
4 | <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %> | |
|
4 | 5 | <p><%= submit_tag l(:button_save) %> |
|
5 | 6 | <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " + |
|
6 | 7 | "Element.show('journal-#{@journal.id}-notes'); return false;" %></p> |
|
7 | 8 | <% end %> |
@@ -1,8 +1,10 | |||
|
1 | 1 | if @journal.frozen? |
|
2 | 2 | # journal was destroyed |
|
3 | 3 | page.remove "change-#{@journal.id}" |
|
4 | 4 | else |
|
5 | 5 | page.replace "journal-#{@journal.id}-notes", render_notes(@journal) |
|
6 | 6 | page.show "journal-#{@journal.id}-notes" |
|
7 | 7 | page.remove "journal-#{@journal.id}-form" |
|
8 | 8 | end |
|
9 | ||
|
10 | call_hook(:view_journals_update_rjs_bottom, { :page => page, :journal => @journal }) |
General Comments 0
You need to be logged in to leave comments.
Login now